java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
cmpt213.assignment4.packagedeliveries.client.view.util.customUI.ExtraFieldUI
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ExtraFieldUI extends JPanel
Custom class that holds all possible extra field UIs. Swaps out different JComponents depending on PackageType.
See Also:
  • Field Details

  • Constructor Details

    • ExtraFieldUI

      public ExtraFieldUI(FocusListener fl, com.github.lgooddatepicker.optionalusertools.DateTimeChangeListener dtel)
      Constructor for ExtraField, sets look, feel, and fields.
      Parameters:
      fl - FocusListener that JTextAreas will add.
      dtel - DateTimeChangeListener that DateTimePickers will add.
  • Method Details

    • getTitle

      public JLabel getTitle()
      Getter method for the title.
      Returns:
      The title field.
    • getField

      public String getField(PackageFactory.PackageType type)
      Getter method that returns the String version of this object.
      Parameters:
      type - The PackageBase type that determines what to return
      Returns:
      A String version of the object that can be saved in cmpt213.assignment4.packagedeliveries.client.control classes.
    • setDate

      public void setDate(LocalDateTime newDate)
      Sets the date on the Perishable date.
      Parameters:
      newDate - A LocalDateTime object that holds the expiry date.
    • changeType

      public void changeType(PackageFactory.PackageType type, boolean packageTypeSelected)
      Changes the type of the extra field, determines what is shown on the UI.
      Parameters:
      type - Which Type's extra field to change to.
      packageTypeSelected - If no type is selected, this will be true.
    • isSet

      public boolean isSet(PackageFactory.PackageType type)
      Verifies if field is set, updates UI accordingly.
      Parameters:
      type - Tells method which extra field to check.
      Returns:
      True if set properly, false otherwise.