Class ListBoxField

All Implemented Interfaces:
IFormField, IAbstractElement, IBlockElement, IElement, IPropertyContainer

public class ListBoxField extends AbstractSelectField
A field that represents a control for selecting one or several of the provided options.
  • Constructor Details

    • ListBoxField

      public ListBoxField (String id, int size, boolean allowMultipleSelection)
      Create a new list box field.
      Parameters:
      size - the size of the list box, which will define the height of visible properties, shall be greater than zero
      allowMultipleSelection - a boolean flag that defines whether multiple options are allowed to be selected at once
      id - the id
  • Method Details

    • getDefaultProperty

      public  T1 getDefaultProperty (int property)
      Description copied from class: FormField
      Gets the default property from this entity.
      Specified by:
      getDefaultProperty in interface IPropertyContainer
      Overrides:
      getDefaultProperty in class FormField<AbstractSelectField>
      Type Parameters:
      T1 - the return type associated with the property
      Parameters:
      property - the property to be retrieved
      Returns:
      the default property value. If the default property is not defined, null will be returned
    • addOption

      public ListBoxField addOption (String option)
      Add an option for ListBoxField. The option is not selected.
      Parameters:
      option - string representation of the option.
      Returns:
      this ListBoxField.
    • addOption

      public ListBoxField addOption (String option, boolean selected)
      Add an option for ListBoxField.
      Parameters:
      option - string representation of the option.
      selected - true is the option if selected, false otherwise.
      Returns:
      this ListBoxField.
    • getSelectedStrings

      public List<String> getSelectedStrings()
      Get a list of selected options.
      Returns:
      a list of display values of selected options.
    • makeNewRenderer

      protected IRenderer makeNewRenderer()
      Description copied from class: AbstractElement
      Creates new renderer instance.
      Specified by:
      makeNewRenderer in class AbstractElement<AbstractSelectField>
      Returns:
      new IRenderer