Class FWCheckboxChoiceSubComponent

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

public class FWCheckboxChoiceSubComponent extends FWAbstractFormSubComponent implements ItemListener
This class is used by FWChoiceFormComponent, to display a list of choices from which any number of items may be selected (one checkbox per option, in a scrollable container). If required, at least one checkbox stays selected. Parameters of the form component:
  • multiselect_seperator - separator of the selected values (default ,); if it contains ', the values are quoted
  • sql_where_param - if set, the value is an SQL condition <param>='v1' OR <param>='v2' ...
Author:
ckunze
See Also:
  • Constructor Details

    • FWCheckboxChoiceSubComponent

      public FWCheckboxChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aEnabled, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap)
      Parameters:
      aOptions - list of options to be displayed to the user
      aEnabled - true if the checkboxes are enabled
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
    • FWCheckboxChoiceSubComponent

      public FWCheckboxChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aEnabled, boolean aShowAll, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap)
      Parameters:
      aOptions - list of options to be displayed to the user
      aEnabled - true if the checkboxes are enabled
      aShowAll - true to show all options without vertical scroll bar
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
    • FWCheckboxChoiceSubComponent

      public FWCheckboxChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aEnabled, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap, String aDefaultValue)
      Parameters:
      aOptions - list of options to be displayed to the user
      aEnabled - true if the checkboxes are enabled
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
      aDefaultValue - comma-separated ids of the checkboxes initially selected (ALL for all)
    • FWCheckboxChoiceSubComponent

      public FWCheckboxChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aIsRequired, boolean aEnabled, boolean aShowAll, net.simplace.core.FWObservable aObservable, Map<String,Object> aFormComponentParameterMap, String aDefaultValue)
      Parameters:
      aOptions - list of options to be displayed to the user
      aIsRequired - true if at least one option must be selected
      aEnabled - true if the checkboxes are enabled
      aShowAll - true to show all options without vertical scroll bar
      aObservable - parameters of the functionality
      aFormComponentParameterMap - parameters of the containing form component
      aDefaultValue - comma-separated ids of the checkboxes initially selected (ALL for all)
  • Method Details

    • getValue

      public String getValue()
      Specified by:
      getValue in class FWAbstractFormSubComponent
      Returns:
      the values of the selected checkboxes, separated by multiselect_seperator, or an SQL condition if sql_where_param is set; with a single checkbox and nothing selected the default value
    • getSelectedValueList

      public List<Object> getSelectedValueList()
      Specified by:
      getSelectedValueList in class FWAbstractFormSubComponent
      Returns:
      the values of the selected checkboxes
    • setValue

      public void setValue(String aValue)
      Selects the checkboxes whose values are in the list (ALL selects all). If no value matches, the list is interpreted as ids (see setSelectedIDs(String)).
      Specified by:
      setValue in class FWAbstractFormSubComponent
      Parameters:
      aValue - comma-separated list of the values (or ids) to be selected; null is ignored
    • setSelectedIDs

      public void setSelectedIDs(String aIDs)
      Selects the checkboxes with the given ids (ALL selects all).
      Parameters:
      aIDs - comma-separated list of the ids to be selected; null selects the first checkbox if required
    • updateCheckBoxes

      public void updateCheckBoxes(Vector<FWFormOption> aFormOptionVector)
      Replaces the checkboxes by new ones for the given options and notifies the listeners. Options that were selected before (same id) stay selected; if none of them exists any more, the first checkbox is selected if required.
      Parameters:
      aFormOptionVector - the new options
    • setEnabled

      public void setEnabled(boolean aIsEnabled)
      Enables or disables all checkboxes.
      Overrides:
      setEnabled in class FWAbstractFormSubComponent
      Parameters:
      aIsEnabled - true to enable
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      Keeps at least one checkbox selected (if required and there are several) and notifies the listeners.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      e - the item event