Package View

Class CustomerDashboardView

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class CustomerDashboardView extends JPanel
The CustomerDashboardView class represents the dashboard view for a customer in the application.

This class extends JPanel to provide a container for displaying the customer dashboard. It contains the necessary components and functionality to display the customer's information panel, current bills panel, and interact with the parent application. It inherits the layout and background properties from JPanel.

See Also:
  • Field Details

    • customerInfoPanel

      private JPanel customerInfoPanel
      The customer information panel.
      See Also:
    • currentBillsPanel

      private JPanel currentBillsPanel
      The current bills panel.
      See Also:
    • customer

      private Customer customer
      The customer object.
      See Also:
    • app

      protected App app
      The parent application instance.
      See Also:
  • Constructor Details

    • CustomerDashboardView

      public CustomerDashboardView(App app, Customer customer)
      CustomerDashboardView represents the dashboard view for a customer in the application.

      This class extends a container with a BorderLayout and sets a white background. It displays the customer's information panel at the top, a scrollable content pane in the center, and an "Add Bill" button at the bottom. The view is initialized with an instance of the parent application and a customer object.

      Note: The customer's bills are obtained from the customer object.

      Parameters:
      app - The parent application.
      customer - The customer object for which the dashboard view is created.
      See Also:
  • Method Details

    • createContentPane

      private JPanel createContentPane()
      Creates a content pane for the application.

      This method creates a JPanel that serves as the content pane for the application. The content pane has a vertical BoxLayout and a white background. It adds the "currentBillsPanel" to the content pane.

      Returns:
      A JPanel serving as the content pane.
      See Also:
    • createCustomerInfoPanel

      private JPanel createCustomerInfoPanel()
      Creates a panel displaying customer information.

      This method creates a JPanel that displays customer information, including the username and email. It also includes a logout button that triggers the "selectionPane" method in the parent application when clicked. The panel has a background color and uses a GroupLayout layout manager for arranging its components.

      Note: The customer information is obtained from the "customer" object, which is assumed to be an instance of a customer class.

      Returns:
      A JPanel displaying customer information.
      See Also:
    • createCurrentBillsPanel

      private JPanel createCurrentBillsPanel(ArrayList<UtilityBill> bills)
      Creates a panel to display a list of current utility bills.

      This method creates a JPanel that displays a list of current utility bills. The panel includes a title, "Utility Bills", and dynamically generates bill panels using the createBillPanel(UtilityBill) method for each bill in the provided bills list. If the list is empty or null, a message indicating "None" is displayed.

      Note: The actual implementation of the bill panel creation is done by the createBillPanel(UtilityBill) method, which sets up the necessary UI components for each bill. This method only handles the layout and arrangement of the bill panels. It also sets the title label and adds the bill panels to the content panel.

      Parameters:
      bills - The list of utility bills to be displayed.
      Returns:
      A JPanel displaying the list of current utility bills.
      See Also:
    • createBillPanel

      private JPanel createBillPanel(UtilityBill bill)
      Creates a panel to display information about a utility bill.

      This method creates a JPanel that displays information about a utility bill. The panel includes labels for the utility type, meter measurement, price, and date of the bill. It also includes buttons for editing and deleting the bill.

      Note: The actual implementation of the bill editing and deletion functionality is not shown in this method. The method only sets up the necessary UI components and defines the button actions.

      Parameters:
      bill - The utility bill for which the panel is created.
      Returns:
      A JPanel displaying information about the utility bill.
      See Also: