|
|
|
@ -225,16 +225,17 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
if (rid != null) { |
|
|
|
|
this.recipe = loadRecipe(rid); |
|
|
|
|
} else { |
|
|
|
|
// alternative (and probably dead) version of "new
|
|
|
|
|
// alternative (and probably dead) version of
|
|
|
|
|
// "new
|
|
|
|
|
// recipe".
|
|
|
|
|
this.recipe = new Recipe(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
userSession.setRecipe(this.recipe); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getIngredients().setWrappedData( |
|
|
|
|
buildIngredientFacade(recipe.getIngredientHash())); |
|
|
|
|
buildIngredientFacade(recipe.getIngredientHash())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -245,7 +246,7 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
*/ |
|
|
|
|
private Recipe loadRecipe(Long recipeId) { |
|
|
|
|
Recipe recipe = recipeService.findDetails(recipeId); |
|
|
|
|
if ( recipe == null ) { |
|
|
|
|
if (recipe == null) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -658,7 +659,7 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
* |
|
|
|
|
* Use this to assemble the suggestion list. |
|
|
|
|
*/ |
|
|
|
|
private String cuisinePartial; |
|
|
|
|
private String cuisinePartial = ""; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return the cuisinePartial |
|
|
|
@ -667,13 +668,22 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
return cuisinePartial; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<String> cuisineSuggestions(String query) { |
|
|
|
|
if (!query.equals(cuisinePartial)) { |
|
|
|
|
setCuisinePartial(query); |
|
|
|
|
} |
|
|
|
|
return getCuisineList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set query for eligibility, force list to rebuild. |
|
|
|
|
* |
|
|
|
|
* @param cuisinePartial the cuisinePartial to set |
|
|
|
|
*/ |
|
|
|
|
public void setCuisinePartial(String cuisinePartial) { |
|
|
|
|
this.cuisinePartial = cuisinePartial; |
|
|
|
|
this.cuisineList = null; // trigger construction of new
|
|
|
|
|
// list.
|
|
|
|
|
// trigger construction of new list.
|
|
|
|
|
this.cuisineList = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<String> masterCuisineList = null; |
|
|
|
@ -701,7 +711,7 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return the cuisineList built by matching the master list |
|
|
|
|
* agaist the partial cuisine names. |
|
|
|
|
* against the partial cuisine names. |
|
|
|
|
*/ |
|
|
|
|
public List<String> getCuisineList() { |
|
|
|
|
if (this.cuisineList == null) { |
|
|
|
@ -856,7 +866,7 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
this.category += catToAdd; |
|
|
|
|
catToAdd = ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ***
|
|
|
|
|
|
|
|
|
|
Part imageFile = null; |
|
|
|
@ -877,6 +887,7 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Load/replace images. Computes thumbnail. |
|
|
|
|
* |
|
|
|
|
* @param event Notused |
|
|
|
|
*/ |
|
|
|
|
public void ajaxUploadImage(AjaxBehaviorEvent event) { |
|
|
|
@ -886,16 +897,17 @@ public class RecipeDetailBean implements Serializable { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Remove images from recipe |
|
|
|
|
* |
|
|
|
|
* @param event Notused |
|
|
|
|
*/ |
|
|
|
|
public void ajaxDeleteImage(AjaxBehaviorEvent event) { |
|
|
|
|
this.recipe.setImage(null); |
|
|
|
|
this.recipe.setThumb(null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return marker for image. Unlike normal JSF, I don't |
|
|
|
|
* care if it gets multiple times and returns different values. |
|
|
|
|
* Return marker for image. Unlike normal JSF, I don't care |
|
|
|
|
* if it gets multiple times and returns different values. |
|
|
|
|
* |
|
|
|
|
* @return "random" string |
|
|
|
|
*/ |
|
|
|
|