Package com.mg105.user_interface
Class InventoryDisplay
java.lang.Object
com.mg105.user_interface.InventoryDisplay
- All Implemented Interfaces:
Alert,InventoryViewInterface,Toggleable
A user interface class that displays the state of the inventory to the user and allows them to
perform actions that relate to the inventory and its items.
-
Constructor Summary
ConstructorsConstructorDescriptionInventoryDisplay(InventoryController controller) Creates a new instance of inventory display -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItemView(String name, String description, boolean isUsable, String quantity) Adds the details of the item to the displayvoidOpens a window displaying a message to the uservoidchangeItemView(String name, String description, boolean isUsable, String quantity) Changes the details of an already displayed item and displays the changes@NotNull javafx.scene.ScenegetScene()Returns the scene that displays the information for the InventoryvoidremoveItemView(String name) Removes an item from the inventory ui.voidtoggle(boolean isVisible) Changes the state of the InventoryDisplay based on if the inventory display is shown in the ui
-
Constructor Details
-
InventoryDisplay
Creates a new instance of inventory display- Parameters:
controller- an object that interprets user inputs to make changes about the inventory
-
-
Method Details
-
getScene
@NotNull public @NotNull javafx.scene.Scene getScene()Returns the scene that displays the information for the Inventory- Specified by:
getScenein interfaceToggleable- Returns:
- the scene that displays the information for the Inventory.
-
toggle
public void toggle(boolean isVisible) Changes the state of the InventoryDisplay based on if the inventory display is shown in the ui- Specified by:
togglein interfaceToggleable- Parameters:
isVisible- true if the Toggleable is now visible, false otherwise. If false the Toggleable is expected to do nothing on ANY user inputs.
-
removeItemView
Removes an item from the inventory ui. Precondition there must not be an items of the type name in the inventory- Specified by:
removeItemViewin interfaceInventoryViewInterface- Parameters:
name- the name of the item to be removed
-
alert
Opens a window displaying a message to the user -
addItemView
Adds the details of the item to the display- Specified by:
addItemViewin interfaceInventoryViewInterface- Parameters:
name- the name of the item to adddescription- the description of the item to addisUsable- true iff the item can be used by a userquantity- the number of items of this type in the Inventory
-
changeItemView
Changes the details of an already displayed item and displays the changes- Specified by:
changeItemViewin interfaceInventoryViewInterface- Parameters:
name- the name of the item to change details aboutdescription- the description of the itemisUsable- true iff the item is usablequantity- the number of items of this type in the Inventory
-