Class FWChoiceFormComponent

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

public class FWChoiceFormComponent extends FWAbstractFormComponent implements ChangeListener
Form component to choose one or several options. The options come from option children (attributes id, label, image; text or a result child as value; without label the text is localised from the id) or dynamically from a form filler. The component delegates the display to a choice subcomponent, chosen by the attribute type (list, radio, combo, check, singlecheck) or automatically:
  • required, multiple selection: list
  • required, single selection: radio buttons (up to 5 options) or combo box
  • not required: checkboxes (multiple selection) or combo box
Further attributes: multiselect, showAll, localize (all with parameter tokens), default. Without options, or if the type does not fit the multiple selection setting, a label is shown instead.
Author:
ckunze, Andreas Enders
See Also:
  • Constructor Details

    • FWChoiceFormComponent

      public FWChoiceFormComponent(String aFormId, String aFieldId, boolean aShowBorder, org.jdom2.Element aParameters, net.simplace.core.FWObservable aObservable)
      Constructs a new choice form component and initializes it with aParameters.
      Parameters:
      aFormId - id of the form the component is placed in
      aFieldId - id of the component, also the parameter key of its value
      aShowBorder - true to show a caption label
      aParameters - the form element with attributes and option children
      aObservable - parameters of the functionality
  • Method Details

    • getValue

      public String getValue()
      Specified by:
      getValue in class FWAbstractFormComponent
      Returns:
      the value of the selected option(s), as provided by the subcomponent
    • setValue

      public void setValue(Object aValue)
      Selects the option(s) with the given value and notifies dependent components, if the value changes.
      Specified by:
      setValue in class FWAbstractFormComponent
      Parameters:
      aValue - the value to select
    • setEnabled

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

      public void update(net.simplace.core.FWObservable aObservabal, Object aKeyOfParameterChanged)
      Description copied from class: FWAbstractFormComponent
      Reacts to a changed parameter: re-evaluates enabled and visible (a disabled or hidden component is reset to its default), resets the default value and re-runs the form filler, if the changed parameter is used in them. Changes of the component's own value are ignored.
      Specified by:
      update in interface net.simplace.core.FWObserver
      Overrides:
      update in class FWAbstractFormComponent
      Parameters:
      aObservabal - the parameters
      aKeyOfParameterChanged - key of the changed parameter
    • stateChanged

      public void stateChanged(ChangeEvent aEvent)
      Notifies other controls, if the choice's value has changed.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      aEvent - the change event of the subcomponent
    • processFormFiller

      public void processFormFiller()
      Takes the options from the form filler (optionally all with the image formFiller.image) and updates the subcomponent; a label subcomponent is replaced by an appropriate one and vice versa if there are no options.
      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)