Package Controller
Class EditMenuController
java.lang.Object
Controller.EditMenuController
Controller for the Edit Menu Screen
- Since:
- 2023-03-07
-
Field Summary
Modifier and TypeFieldDescriptionprivate javafx.scene.control.TextField
TextField
to allow for user input to add aMenuItem
private javafx.scene.control.Button
Button
that will triggeraddItemClicked(ActionEvent)
private javafx.scene.control.TextField
TextField
to allow for user input to add aMenuItem
private javafx.scene.control.TextField
TextField
to allow for user input to add aMenuItem
private DatabaseConnect
Connection to the databaseprivate javafx.scene.control.Button
Button
Button to navigate to the data trends sceneprivate javafx.scene.control.Button
Button
that will triggerdeleteItemClicked(ActionEvent)
private javafx.scene.control.TextField
TextField
to allow for user input to remove aMenuItem
private javafx.scene.control.Button
Button
Button to navigate edit menu sceneprivate javafx.scene.control.Button
Button
Button to navigate employees sceneprivate javafx.scene.control.Button
Button
Button to navigate inventory sceneprivate javafx.scene.control.Button
Button
Button to logoutTableColumn
displaying the ID number ofMenuItem
TableColumn
displaying the name of theMenuItem
TableColumn
displaying the price of theMenuItem
private javafx.scene.control.TableView<MenuItem>
TableView
ofMenuItem
to displayTableColumn
displaying the quantity ofMenuItem
soldprivate javafx.scene.control.Button
Button
Button to navigate order sceneprivate javafx.scene.control.Button
Button
Button to navigate order history sceneprivate SceneSwitch
Switches between scenes or tabsprivate SessionData
Current session dataprivate javafx.scene.control.TextField
TextField
to allow for user input to update aMenuItem
private javafx.scene.control.TextField
TextField
to allow for user input to update aMenuItem
private javafx.scene.control.Button
Button
that will triggerupdateItemClicked(ActionEvent)
private javafx.scene.control.TextField
TextField
to allow for user input to update aMenuItem
private javafx.scene.control.TextField
TextField
to allow for user input to update aMenuItem
-
Constructor Summary
ConstructorDescriptionDefault constructor to prevent errorsEditMenuController
(SessionData session) Allows for passing session data from scene to scene -
Method Summary
Modifier and TypeMethodDescriptionvoid
addItemClicked
(javafx.event.ActionEvent e) If item doesn't exist, it adds it to menu table and adds its recipe to the recipeitem tableprivate void
addItemsToRecipe
(Map<Long, Long> recipeMap, long menuID) Adds items to the recipe tableprivate void
Reset all text fields that get user input for editing a menu item to nullvoid
deleteItemClicked
(javafx.event.ActionEvent e) Remove item from menu table and recipe item table if it existsprivate javafx.collections.ObservableList<MenuItem>
Gets all menu items from the databasevoid
Loads menu items onto screen from database.void
navButtonClicked
(javafx.event.ActionEvent event) Handle switching scenes through the navigation barparseRecipe
(String[] recipe) private void
removeItemsFromRecipe
(long menuID) Remove all recipe items from the recipe table that have a specified menu ID numberprivate void
Initialized the columns formenuTable
void
updateItemClicked
(javafx.event.ActionEvent e) Update existing item in the menuitem table.private void
UpdatesmenuTable
in the Graphical User Interface
-
Field Details
-
session
Current session data- See Also:
-
database
Connection to the database- See Also:
-
sceneSwitch
Switches between scenes or tabs- See Also:
-
orderButton
private javafx.scene.control.Button orderButtonButton
Button to navigate order scene -
orderHistoryButton
private javafx.scene.control.Button orderHistoryButtonButton
Button to navigate order history scene -
inventoryButton
private javafx.scene.control.Button inventoryButtonButton
Button to navigate inventory scene -
employeesButton
private javafx.scene.control.Button employeesButtonButton
Button to navigate employees scene -
editMenuButton
private javafx.scene.control.Button editMenuButtonButton
Button to navigate edit menu scene -
dataTrendsButton
private javafx.scene.control.Button dataTrendsButtonButton
Button to navigate to the data trends scene -
logoutButton
private javafx.scene.control.Button logoutButtonButton
Button to logout -
numberSold
TableColumn
displaying the quantity ofMenuItem
sold -
updateIDText
private javafx.scene.control.TextField updateIDTextTextField
to allow for user input to update aMenuItem
-
updateNameText
private javafx.scene.control.TextField updateNameTextTextField
to allow for user input to update aMenuItem
-
updateCostText
private javafx.scene.control.TextField updateCostTextTextField
to allow for user input to update aMenuItem
-
updateRecipeText
private javafx.scene.control.TextField updateRecipeTextTextField
to allow for user input to update aMenuItem
-
addNameText
private javafx.scene.control.TextField addNameTextTextField
to allow for user input to add aMenuItem
-
addCostText
private javafx.scene.control.TextField addCostTextTextField
to allow for user input to add aMenuItem
-
addRecipeText
private javafx.scene.control.TextField addRecipeTextTextField
to allow for user input to add aMenuItem
-
deleteItemID
private javafx.scene.control.TextField deleteItemIDTextField
to allow for user input to remove aMenuItem
-
updateItemButton
private javafx.scene.control.Button updateItemButtonButton
that will triggerupdateItemClicked(ActionEvent)
-
addItemButton
private javafx.scene.control.Button addItemButtonButton
that will triggeraddItemClicked(ActionEvent)
-
deleteItemButton
private javafx.scene.control.Button deleteItemButtonButton
that will triggerdeleteItemClicked(ActionEvent)
-
-
Constructor Details
-
EditMenuController
public EditMenuController()Default constructor to prevent errors -
EditMenuController
Allows for passing session data from scene to scene- Parameters:
session
-SessionData
passed in fromSceneSwitch
-
-
Method Details
-
initialize
public void initialize()Loads menu items onto screen from database. Sets other fields to null -
updateItemClicked
public void updateItemClicked(javafx.event.ActionEvent e) Update existing item in the menuitem table. First checks if the item exists, then updates its values that the user entered that aren't null, then updates the recipeitem table- Parameters:
e
-ActionEvent
ofupdateItemButton
-
addItemClicked
public void addItemClicked(javafx.event.ActionEvent e) If item doesn't exist, it adds it to menu table and adds its recipe to the recipeitem table- Parameters:
e
-ActionEvent
ofaddItemButton
-
deleteItemClicked
public void deleteItemClicked(javafx.event.ActionEvent e) Remove item from menu table and recipe item table if it exists- Parameters:
e
-ActionEvent
ofdeleteItemClicked(ActionEvent)
-
clearTextFields
private void clearTextFields()Reset all text fields that get user input for editing a menu item to null -
setUpTable
private void setUpTable()Initialized the columns formenuTable
-
getMenuItems
Gets all menu items from the database- Returns:
ObservableList
ofMenuItem
-
updateTable
private void updateTable()UpdatesmenuTable
in the Graphical User Interface -
parseRecipe
-
addItemsToRecipe
Adds items to the recipe table- Parameters:
recipeMap
-Map
parsed byparseRecipe(String[])
menuID
- ID number of the menu item
-
removeItemsFromRecipe
private void removeItemsFromRecipe(long menuID) Remove all recipe items from the recipe table that have a specified menu ID number- Parameters:
menuID
- ID number of the menu to remove from the recipe table.
-