Class Menu


  • public class Menu
    extends java.lang.Object
    The 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
      void createClientMenu​(java.lang.String name, boolean active)
      Displays a menu for creating a new client with the given name and active status.
      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
      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.
      void createVendorMenu​(java.lang.String name, boolean active)
      Displays a menu for creating a vendor with the given name and active status.
      void editClientMenu​(java.lang.String name, boolean active)
      Displays the menu to edit a client, including the actual values and options to change them.
      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.
      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
      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.
      void endMenu()
      This method prints a goodbye message at the end of the menu.
      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.
      void listClientMenu()
      Displays a formatted list of all the clients stored in the controller's client instances list.
      void listOrderByClientMenu​(int orderID)
      This method displays a list of orders placed by a specific client, identified by their client ID.
      void listOrderMenu()
      This method displays a list of orders in a bordered format.
      void listProductByVendorMenu​(int vendorID)
      Displays a list of products associated with the given vendor ID in a bordered format.
      void listProductMenu()
      This method displays a list of products in a bordered format.
      void listVendorMenu()
      This method displays a list of vendors in a bordered format.
      void mainMenu()
      Prints the main menu for the Drop-shipping program.
      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.
      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.
      void selectProductMenu​(java.lang.String name, int id)
      Displays the select product menu with the current product information and options to change it
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Menu

        public Menu()
    • 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 created
        active - 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 client
        active - 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 created
        price - the price of the product to be created
        nutriscore - the nutriscore of the product to be created
        vendorId - 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 order
        name - the name of the client creating the order
        products - 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 client
        active - 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 vendor
        id - 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 value
        active - 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 selected
        id - 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 product
        price - the price of the product
        nutriscore - the nutriscore of the product
        vendorId - the ID of the vendor associated with the product
        vendorName - 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 order
        paid - true if the order has been paid, false otherwise
        clientId - the ID of the client associated with the order
        clientName - the name of the client associated with the order
        totalPrice - 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 order
        name - the name of the client associated with the order
        paid - the paid status of the order
        products - the list of products associated with the order