Class JPanelEditDate

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JPanelEditDate extends JPanelEdit
panel contains 3 fields: 2 comboboxes (day, month), 1 text field (year), panel handles proper day/month and leap-year input.
Version:
1.0
Author:
David Parsons
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • dayCombobox

      private JComboBox dayCombobox
      DOCUMENT ME!
    • monthCombobox

      private JComboBox monthCombobox
      DOCUMENT ME!
    • noFutureDates

      private boolean noFutureDates
      DOCUMENT ME!
    • noPastDates

      private boolean noPastDates
      DOCUMENT ME!
    • xml

      private boolean xml
      DOCUMENT ME!
    • yearTextField

      private JTextField yearTextField
      DOCUMENT ME!
  • Constructor Details

    • JPanelEditDate

      public JPanelEditDate(String initialText, boolean xml)
      Builds the panel with 3 fields. It is necessary to validate these fields before accepting the values.
      Parameters:
      initialText - the text which will fill the text field whn begun-- date string will be in mm/dd/yyyy format
      xml - DOCUMENT ME!
  • Method Details

    • checkFields

      public boolean checkFields()
      Because DICOM requires 4-digit years, we must check the year field. If the year-text has fewer or more than 4 digits, the field must be fixed. Any year with 4 digits is okay.

      If there is an error, the errorString is set to describe the problem and errorComponent is set to point to the JComponent that had an illegal value. This method then returns false. When processed normally, the caller finds a true, and the errorString and errorComponent are set to null to prevent undesired consequences.

      Specified by:
      checkFields in class JPanelEdit
      Returns:
      boolean FieldsOKAY
      See Also:
    • getCodedValue

      public Object getCodedValue()
      If the information held by the panel is stored as a code (as in 'M' for "male" or 'F' for "female"), then this code will be returned by this method. If there is no code for this value, this method will return a the same value as getPanelValue()
      Specified by:
      getCodedValue in class JPanelEdit
      Returns:
      the coded value. If the panel has no coded value, then the return value will be the String returned by getPanelValue().
    • getPanelValue

      public String getPanelValue()
      concatonates the date as MM/DD/YYYY; padding any years invalid input: '<' 1000 with leading zeros.
      Specified by:
      getPanelValue in class JPanelEdit
      Returns:
      DOCUMENT ME!
    • restrictNoFutureDates

      public boolean restrictNoFutureDates()
      accessor to find out whether the panel is set to restrict the panel-display from displaying dates in the future.
      Returns:
      boolean whether the user may select a date in the future.
    • restrictNoFutureDates

      public void restrictNoFutureDates(boolean permission)
      sets the panel use the restriction that it is to allow no dates after today.
      Parameters:
      permission - to display dates in the future. true prevents the panel from displaying a date in the future; false (the default) permits selection of a date in the future.
    • restrictPastDates

      public boolean restrictPastDates()
      accessor to find out whether the panel is set to restrict the panel-display from displaying dates in the past.
      Returns:
      boolean whether the user may select a date in the past.
    • restrictPastDates

      public void restrictPastDates(boolean permission)
      sets the panel use the restriction that it is to allow no dates prior to today.
      Parameters:
      permission - to display dates in the past. true prevents the panel from displaying a date in the past; false (the default) permits selection of a date in the past.
    • updatePanel

      private void updatePanel(int numberOfDays, int currentMonth, int year)
      self-verification of panel values, prior to requesting for checkFields. In fact, so that it is not necessary to explicitly verify the value.
      Parameters:
      numberOfDays - DOCUMENT ME!
      currentMonth - DOCUMENT ME!
      year - DOCUMENT ME!