Class FWDateFormComponent

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, net.simplace.core.FWBusyIndicator, net.simplace.core.FWObserver

public class FWDateFormComponent extends FWAbstractFormComponent implements ChangeListener
This form component provides means to specify a date at a pre-determinable precision (attribute precision: YEAR, MONTH_YEAR/YEAR_MONTH or DAY_MONTH_YEAR/YEAR_MONTH_DAY; if missing, the precision of the min value is used). Depending on that precision, appropriate controls are going to be displayed: a year spinner, month and year spinners, or a date label with a calendar popup button. The component evaluates expressions / placeholders for its min, max and default attributes (defaults: 1.1.1, 31.12.9999 and today) and rebuilds itself when a parameter used in them changes.
Author:
ckunze
See Also:
  • Constructor Details

    • FWDateFormComponent

      public FWDateFormComponent(String aFormId, String aFieldId, boolean aShowLabel, org.jdom2.Element aParameters, net.simplace.core.FWObservable aObservable)
      Creates a date form component with the appropriate controls according to the desired date-precision.
      Parameters:
      aFormId - id of the form the component is placed in
      aFieldId - id of the component, also the parameter key of its value
      aShowLabel - true to show a caption label
      aParameters - the form element (attributes precision, min, max, default)
      aObservable - parameters of the functionality
  • Method Details

    • getValue

      public String getValue()
      Specified by:
      getValue in class FWAbstractFormComponent
      Returns:
      The currently selected date
    • setValue

      public void setValue(Object aValue)
      Allows to set the selected date at any time; the date is limited to min/max and the controls are rebuilt.
      Specified by:
      setValue in class FWAbstractFormComponent
      Parameters:
      aValue - The date that is to be selected. It has to conform to a supported precision in order to be parseable.
    • stateChanged

      public void stateChanged(ChangeEvent e)
      This event handler gets called if either the subcontrols or the FWFormattedDate have changed: a changed control updates the value, a changed value updates the controls and notifies dependent components.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - the change event
    • setEnabled

      public void setEnabled(boolean aIsEnabled)
      Overrides:
      setEnabled in class JComponent
      Parameters:
      aIsEnabled - true to enable the controls
    • update

      public void update(net.simplace.core.FWObservable aObservable, Object aKeyOfParameterChanged)
      In addition to the base behaviour, rebuilds the component when a parameter used in precision, min, max or default changes.
      Specified by:
      update in interface net.simplace.core.FWObserver
      Overrides:
      update in class FWAbstractFormComponent
      Parameters:
      aObservable - the parameters
      aKeyOfParameterChanged - key of the changed parameter
    • processFormFiller

      public void processFormFiller()
      Takes the date (FWFormattedDate) from the form filler; it is not replaced by the default. Anything else returned by the filler is ignored with a warning.
      Specified by:
      processFormFiller in class FWAbstractFormComponent
    • getValueCell

      protected com.lowagie.text.Rectangle getValueCell(int aType)
      Description copied from class: FWAbstractFormComponent
      Returns the value cell used for generating the RTF, PDF or HTML version of the form.
      Specified by:
      getValueCell in class FWAbstractFormComponent
      Parameters:
      aType - output type, e.g. PrintHelper.TYPE_PDF
      Returns:
      an iText cell (PdfPCell for PDF, Cell otherwise)