Package View

Class EditServiceView

Record Components:
app - The application instance that controls the view.
serviceType - The type of service being edited.
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class EditServiceView extends JPanel
A graphical user interface panel for editing service details. This class extends JPanel to create a user interface for editing service information, such as utility type, service charges, and unit charges. Users can edit the values and save the changes.
See Also:
  • Field Details

    • app

      protected App app
      The main application instance that this UI is associated with.
      See Also:
    • typeLabel

      private JLabel typeLabel
      Label displaying the type of service.
    • servicePriceLabel

      private JLabel servicePriceLabel
      Label displaying the price of the service.
    • unitPriceLabel

      private JLabel unitPriceLabel
      Label displaying the unit price of the service.
    • backButton

      private JButton backButton
      Button to navigate back to the previous screen.
    • saveButton

      private JButton saveButton
      Button to save the configured pricing information.
  • Constructor Details

    • EditServiceView

      public EditServiceView(App app, ServiceType serviceType)
      EditServiceView represents a user interface for modifying and saving service pricing details. Users can edit and save the service charges and unit charges for a specific service type.
      Parameters:
      app - The main application instance associated with this view.
      serviceType - The service type for which pricing details will be edited.
      Throws:
      NullPointerException - if the 'app' parameter is null.
  • Method Details

    • createFieldLabel

      private JLabel createFieldLabel(String text)
      Creates and configures a field label for display in the user interface.
      Parameters:
      text - The text content of the label.
      Returns:
      A JLabel component representing the field label.
    • createEditableLabel

      private JLabel createEditableLabel(String text)
      Creates and configures an editable label for display in the user interface.
      Parameters:
      text - The text content of the label.
      Returns:
      A JLabel component representing the editable label.
    • createEditButton

      private JButton createEditButton(String text, JLabel targetLabel)
      Creates and configures an edit button for interaction in the user interface.
      Parameters:
      text - The text content of the button.
      targetLabel - The JLabel that the button will edit when clicked.
      Returns:
      A JButton component representing the edit button.
    • isNumeric

      private boolean isNumeric(String str)
      Checks if the given string represents a numeric value.
      Parameters:
      str - The string to be checked for numeric validity.
      Returns:
      true if the string is a valid numeric representation; false otherwise.
      Throws:
      NullPointerException - If the input string is null.