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 SummaryConstructorsConstructorDescriptionInventoryDisplay(InventoryController controller) Creates a new instance of inventory display
- 
Method SummaryModifier 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- 
InventoryDisplayCreates 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 interface- Toggleable
- Returns:
- the scene that displays the information for the Inventory.
 
- 
togglepublic void toggle(boolean isVisible) Changes the state of the InventoryDisplay based on if the inventory display is shown in the ui- Specified by:
- togglein interface- Toggleable
- Parameters:
- isVisible- true if the Toggleable is now visible, false otherwise. If false the Toggleable is expected to do nothing on ANY user inputs.
 
- 
removeItemViewRemoves an item from the inventory ui. Precondition there must not be an items of the type name in the inventory- Specified by:
- removeItemViewin interface- InventoryViewInterface
- Parameters:
- name- the name of the item to be removed
 
- 
alertOpens a window displaying a message to the user
- 
addItemViewAdds the details of the item to the display- Specified by:
- addItemViewin interface- InventoryViewInterface
- Parameters:
- name- the name of the item to add
- description- the description of the item to add
- isUsable- true iff the item can be used by a user
- quantity- the number of items of this type in the Inventory
 
- 
changeItemViewChanges the details of an already displayed item and displays the changes- Specified by:
- changeItemViewin interface- InventoryViewInterface
- Parameters:
- name- the name of the item to change details about
- description- the description of the item
- isUsable- true iff the item is usable
- quantity- the number of items of this type in the Inventory
 
 
-