Class FWSingleCheckboxChoiceSubComponent

All Implemented Interfaces:
ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class FWSingleCheckboxChoiceSubComponent extends FWAbstractFormSubComponent implements ItemListener
This class is used by FWChoiceFormComponent, to display a single checkbox for a yes/no choice. The first option gives text and value of the unchecked state, the second option the value of the checked state; without second option a checked option <id>.selected with the default value is created.
Author:
Andreas Enders
See Also:
  • Constructor Details

    • FWSingleCheckboxChoiceSubComponent

      public FWSingleCheckboxChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aEnabled, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap)
      Parameters:
      aOptions - the options: unchecked state, optionally checked state
      aEnabled - true if the checkbox is enabled
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
    • FWSingleCheckboxChoiceSubComponent

      public FWSingleCheckboxChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aEnabled, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap, String aDefaultValue)
      Parameters:
      aOptions - the options: unchecked state, optionally checked state
      aEnabled - true if the checkbox is enabled
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
      aDefaultValue - the checkbox is checked initially if this equals the value of the checked state
  • Method Details

    • getValue

      public String getValue()
      Specified by:
      getValue in class FWAbstractFormSubComponent
      Returns:
      the value of the checked or unchecked state
    • getSelectedValueList

      public List<Object> getSelectedValueList()
      Specified by:
      getSelectedValueList in class FWAbstractFormSubComponent
      Returns:
      a list containing the value of the current state
    • setValue

      public void setValue(String aValue)
      Checks the checkbox if the value equals the value of the checked state, otherwise unchecks it.
      Specified by:
      setValue in class FWAbstractFormSubComponent
      Parameters:
      aValue - the value; null is ignored
    • setSelectedIDs

      public void setSelectedIDs(String aIDs)
      Checks the checkbox if the id equals the id of the checked state, otherwise unchecks it.
      Parameters:
      aIDs - the id; null is ignored
    • updateCheckBox

      public void updateCheckBox(Vector<FWFormOption> aFormOptionVector)
      Replaces the checkbox by a new one for the given options (the checked state is kept) and notifies the listeners.
      Parameters:
      aFormOptionVector - the new options
    • setEnabled

      public void setEnabled(boolean aIsEnabled)
      Overrides:
      setEnabled in class FWAbstractFormSubComponent
      Parameters:
      aIsEnabled - true to enable the checkbox
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      Notifies the parent component if the value of this component has changed.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      e - the item event