Class SuggestRecipesController
java.lang.Object
no.ntnu.idatt1002.demo.controller.SuggestRecipesController
- All Implemented Interfaces:
javafx.fxml.Initializable
The controller manages the view SuggestRecipes.fxml that displays a list of food types that the
user has available, called 'fridge' and four tiles showing the four recipes that requires the
lowest number of ingredients that are currently not at hand. These 'recipe tiles' are dynamically
loaded and update whenever food types are removed or added to the 'fridge'. Food types are
removed from the fridge by selecting it from the fridge-list and pressing 'Remove' and added by
pressing 'Add to Fridge' upon which a new window is opened. If the ingredients at hand list is
empty or the recipe register is empty or not existing, the page will still load, but the 'fridge'
will be empty and no recipe suggestions will appear.
- Author:
- hannesofie
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(URL url, ResourceBundle resourceBundle) The initialize method of the controller takes in a URL (location) and ResourceBundle(resources) to initialize the controller once its root element has been processed.
-
Constructor Details
-
SuggestRecipesController
public SuggestRecipesController()
-
-
Method Details
-
initialize
The initialize method of the controller takes in a URL (location) and ResourceBundle(resources) to initialize the controller once its root element has been processed. The method also provides the controller with an up do date IngredientsAtHand object by calling 'readIngredientsAtHand', as well as an up-to-date RecipeRegister by reading it from file. Once this data is in place, the method calls 'setRecipeTiles()' to populate the grid with tiles representing the four recipes requiring the least ingredients not at hand.- Specified by:
initialize
in interfacejavafx.fxml.Initializable
- Parameters:
url
- The location to resolve the relative paths to the root object.resourceBundle
- Resources used to localize the root object.
-