Class Menu
- java.lang.Object
-
- Menu
-
public class Menu extends java.lang.ObjectThe Menu class displays the main menu of the Drop-shipping program, varios menus to create, list and edit objects and a goodbye message at the end of the menu.- Author:
- Joel Olivera
-
-
Constructor Summary
Constructors Constructor Description Menu()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateClientMenu(java.lang.String name, boolean active)Displays a menu for creating a new client with the given name and active status.voidcreateOrderMenu(int id, java.lang.String name, java.util.ArrayList<ProductOnOrder> products)Creates a menu for creating an order, which displays client and product informationvoidcreateProductMenu(java.lang.String name, float price, char nutriscore, int vendorId, java.lang.String vendorName)This method creates a product menu with the actual values of the product specified by the input parameters: name, price, nutriscore, and vendorId.voidcreateVendorMenu(java.lang.String name, boolean active)Displays a menu for creating a vendor with the given name and active status.voideditClientMenu(java.lang.String name, boolean active)Displays the menu to edit a client, including the actual values and options to change them.voideditOrderMenu(int id, java.lang.String name, boolean paid, java.util.ArrayList<ProductOnOrder> products)Displays the menu for editing an order, showing current and potential values for client ID, name, and paid status, as well as a shopping list of products on the order.voideditProductMenu(java.lang.String name, float price, char nutriscore, int vendorId, java.lang.String vendorName)Displays the edit product menu with the current product information and options to change itvoideditVendorMenu(java.lang.String name, boolean active)Displays the edit vendor menu with the current vendor's name and active status as actual values, and the options to change them, drop the vendor, or exit without saving.voidendMenu()This method prints a goodbye message at the end of the menu.voidlistAllObjectsMenu()Prints a formatted console menu that lists all available objects within the system, including vendors, products, clients, and orders, and their associated actions.voidlistClientMenu()Displays a formatted list of all the clients stored in the controller's client instances list.voidlistOrderByClientMenu(int orderID)This method displays a list of orders placed by a specific client, identified by their client ID.voidlistOrderMenu()This method displays a list of orders in a bordered format.voidlistProductByVendorMenu(int vendorID)Displays a list of products associated with the given vendor ID in a bordered format.voidlistProductMenu()This method displays a list of products in a bordered format.voidlistVendorMenu()This method displays a list of vendors in a bordered format.voidmainMenu()Prints the main menu for the Drop-shipping program.voidselectClientMenu(java.lang.String name, int id)Prints a client selection menu for editing purposes with the actual client information, available clients option, and change selected option.voidselectOrderMenu(int id, boolean paid, int clientId, java.lang.String clientName, float totalPrice)Displays the select order menu with actual, view, and change values.voidselectProductMenu(java.lang.String name, int id)Displays the select product menu with the current product information and options to change itvoidselectVendorMenu(java.lang.String name, int id)Displays a vendor menu with options to edit the selected vendor's values, view available vendors, drop the selected vendor, or change the selected vendor's values.
-
-
-
Method Detail
-
mainMenu
public void mainMenu()
Prints the main menu for the Drop-shipping program. The menu displays various options for the user to choose from, such as adding default objects, creating new vendors/clients/products/orders, listing existing vendors/clients/products/orders, editing existing vendors/clients/products/orders, and exiting the program.
-
endMenu
public void endMenu()
This method prints a goodbye message at the end of the menu. It also displays my name and the name of the program.
-
createVendorMenu
public void createVendorMenu(java.lang.String name, boolean active)Displays a menu for creating a vendor with the given name and active status. The menu has options for changing the vendor's name and active status. Also, the user can choose to finish saving changes or exit without saving.- Parameters:
name- the name of the vendor to be createdactive- the active value of the vendor to be created
-
createClientMenu
public void createClientMenu(java.lang.String name, boolean active)Displays a menu for creating a new client with the given name and active status. Allows the user to change the name and active status before finishing and saving the new client.- Parameters:
name- the name of the new clientactive- the active status of the new client
-
createProductMenu
public void createProductMenu(java.lang.String name, float price, char nutriscore, int vendorId, java.lang.String vendorName)This method creates a product menu with the actual values of the product specified by the input parameters: name, price, nutriscore, and vendorId. The menu allows the user to view available vendors, and to change any of the product values: name, price, nutriscore, and vendorId.- Parameters:
name- the name of the product to be createdprice- the price of the product to be creatednutriscore- the nutriscore of the product to be createdvendorId- the vendor ID of the product to be created
-
createOrderMenu
public void createOrderMenu(int id, java.lang.String name, java.util.ArrayList<ProductOnOrder> products)Creates a menu for creating an order, which displays client and product information- Parameters:
id- the ID of the client creating the ordername- the name of the client creating the orderproducts- the list of products to be displayed in the menu
-
listAllObjectsMenu
public void listAllObjectsMenu()
Prints a formatted console menu that lists all available objects within the system, including vendors, products, clients, and orders, and their associated actions.The method invokes other methods to print out the specific options related to each object.
- See Also:
listVendorMenu(),listProductMenu(),listClientMenu(),listOrderMenu()
-
listVendorMenu
public void listVendorMenu()
This method displays a list of vendors in a bordered format. The list of vendors is retrieved using the 'getVendorInstances()' method from the provided 'controller' object, and is displayed using the 'toString()' method of each vendor instance.
-
listClientMenu
public void listClientMenu()
Displays a formatted list of all the clients stored in the controller's client instances list. Each client is printed using their toString method.
-
listProductMenu
public void listProductMenu()
This method displays a list of products in a bordered format. The list of products is retrieved using the 'getProductInstances()' method from the provided 'controller' object, and is displayed using the 'toString()' method of each product instance.
-
listOrderMenu
public void listOrderMenu()
This method displays a list of orders in a bordered format. The list of orders is retrieved using the 'getOrderInstances()' method from the provided 'controller' object, and is displayed using the 'toString()' method of each order instance.
-
listProductByVendorMenu
public void listProductByVendorMenu(int vendorID)
Displays a list of products associated with the given vendor ID in a bordered format. Retrieves the list of products using the 'getProductInstances()' method from the provided 'controller' object, and displays the product information using the 'toString()' method of each product instance.- Parameters:
vendorID- an integer representing the vendor ID whose associated products are to be listed
-
listOrderByClientMenu
public void listOrderByClientMenu(int orderID)
This method displays a list of orders placed by a specific client, identified by their client ID. The list of orders is retrieved using the 'getOrderInstances()' method from the provided 'controller' object, and is displayed using the 'toString()' method of each order instance.- Parameters:
orderID- the ID of the client whose orders are to be displayed
-
selectClientMenu
public void selectClientMenu(java.lang.String name, int id)Prints a client selection menu for editing purposes with the actual client information, available clients option, and change selected option.- Parameters:
name- The name of the client to be displayed.id- The ID of the client to be displayed.
-
editClientMenu
public void editClientMenu(java.lang.String name, boolean active)Displays the menu to edit a client, including the actual values and options to change them.- Parameters:
name- the current name of the clientactive- the current status of the client
-
selectVendorMenu
public void selectVendorMenu(java.lang.String name, int id)Displays a vendor menu with options to edit the selected vendor's values, view available vendors, drop the selected vendor, or change the selected vendor's values.- Parameters:
name- the name of the selected vendorid- the ID of the selected vendor
-
editVendorMenu
public void editVendorMenu(java.lang.String name, boolean active)Displays the edit vendor menu with the current vendor's name and active status as actual values, and the options to change them, drop the vendor, or exit without saving.- Parameters:
name- the current name of the vendor to display as an actual valueactive- the current active status of the vendor to display as an actual value
-
selectProductMenu
public void selectProductMenu(java.lang.String name, int id)Displays the select product menu with the current product information and options to change it- Parameters:
name- the name of the product to be selectedid- the ID of the product to be selected
-
editProductMenu
public void editProductMenu(java.lang.String name, float price, char nutriscore, int vendorId, java.lang.String vendorName)Displays the edit product menu with the current product information and options to change it- Parameters:
name- the name of the productprice- the price of the productnutriscore- the nutriscore of the productvendorId- the ID of the vendor associated with the productvendorName- the name of the vendor associated with the product
-
selectOrderMenu
public void selectOrderMenu(int id, boolean paid, int clientId, java.lang.String clientName, float totalPrice)Displays the select order menu with actual, view, and change values.- Parameters:
id- the ID of the orderpaid- true if the order has been paid, false otherwiseclientId- the ID of the client associated with the orderclientName- the name of the client associated with the ordertotalPrice- the total price of the order
-
editOrderMenu
public void editOrderMenu(int id, java.lang.String name, boolean paid, java.util.ArrayList<ProductOnOrder> products)Displays the menu for editing an order, showing current and potential values for client ID, name, and paid status, as well as a shopping list of products on the order.- Parameters:
id- the ID of the client associated with the ordername- the name of the client associated with the orderpaid- the paid status of the orderproducts- the list of products associated with the order
-
-