public class RecipeView extends ViewWithMenu
Modifier and Type | Field and Description |
---|---|
private javafx.scene.control.TextArea |
instructionTextArea |
private ListComponent<ProductAmount> |
listComponent |
private javafx.scene.layout.VBox |
listViewContainer |
private javafx.scene.control.Spinner<java.lang.Integer> |
numPeopleSpinner |
private static java.lang.String |
RECIPE_FXML
The fxml resource for the view
|
private RecipeController |
recipeController |
private javafx.scene.text.Text |
title |
Constructor and Description |
---|
RecipeView(RecipeController controller,
javafx.scene.Scene scene,
Recipe recipe,
java.util.List<Product> allProductsList) |
Modifier and Type | Method and Description |
---|---|
boolean |
askUserOverWriteConfirmation()
Opens a popup asking the user to confirm the overwrite
The boolean answer is then returned
|
java.lang.String |
getInstructionsText()
Returns the string present in the instructions text area
|
double |
getNumberAtPosition(int position)
Returns the amount of a certain product located at a given
position in the recipe.
|
int |
getNumPeopleValue()
Returns the value present in the spinner containing the information of how
many people was the recipe conceived for.
|
java.util.List<ProductAmount> |
getProductAmountsList() |
boolean |
isListModified() |
void |
onGenerateGroceryList()
Called whenever the user clicks on the generate
grocery list button.
|
void |
onSaveChanges()
Called whenever the user clicks on the save button.
|
void |
setAmountOfItemAtPosition(int position,
double newAmount)
Allows to change the amount value of a certain product at
a given position in the recipe.
|
void |
setIsListModified(boolean isListModified) |
private void |
setUpInstructionsTextArea(java.lang.String instructions)
Writes the instructions string given as parameter in the text area.
|
private void |
setUpSpinner(int numPeople)
Sets the spinner to the value given as parameter.
|
void |
showErrorGettingRecipe() |
void |
showErrorSavingRecipe()
Opens a popup informing the user that an error has occurred while saving the recipe.
|
boolean |
showSaveMessageBox()
Opens a popup asking the user for a confirmation on whether ir not he/she
wants to save the recipe.
|
void |
showSuccessPopup()
Shows a popup stating that the recipe was successfully saved.
|
createMenu, disableHelpButton, enableHelpButton, getHeader, onEditProfileClick, onHelpClick, onLogoutClick, onMyGroceryListsClick, onMyRecipesClick, onShowMapClick
showDatabaseConnectionError, showDataBaseInternalError
private static final java.lang.String RECIPE_FXML
private javafx.scene.control.Spinner<java.lang.Integer> numPeopleSpinner
private javafx.scene.text.Text title
private javafx.scene.control.TextArea instructionTextArea
private javafx.scene.layout.VBox listViewContainer
private ListComponent<ProductAmount> listComponent
private RecipeController recipeController
public RecipeView(RecipeController controller, javafx.scene.Scene scene, Recipe recipe, java.util.List<Product> allProductsList)
private void setUpInstructionsTextArea(java.lang.String instructions)
instructions
- private void setUpSpinner(int numPeople)
Adds a listener so that the recipeController gets notified whenever a change is made.
numPeople
- public void onSaveChanges()
public void onGenerateGroceryList()
public double getNumberAtPosition(int position)
position
- public void setAmountOfItemAtPosition(int position, double newAmount)
position
- newAmount
- public void showSuccessPopup()
public boolean showSaveMessageBox()
public void showErrorSavingRecipe()
public int getNumPeopleValue()
public java.lang.String getInstructionsText()
public boolean askUserOverWriteConfirmation()
public void setIsListModified(boolean isListModified)
public boolean isListModified()
public java.util.List<ProductAmount> getProductAmountsList()
public void showErrorGettingRecipe()