Class DualListBox

All Implemented Interfaces:
Animatable<DualListBox>, CanDrop<DualListBox>, SupportHelpIcon<DualListBox>, Draggable<DualListBox>, Fetchable<DualListBox>, Focusable<DualListBox>, HandleHotKey<DualListBox>, BasedOnDataDescriptor<DualListBox>, DifferentDataDisplayValue, DifferentMultiDataDisplayValue, Filterable<DualListBox>, MultiValueFormItem<DualListBox>

Dual list box form item

The component implements two parallel lists. The lists display the values passed to the component. By default the component’s value set is displayed on the left. The user is able to move one or several items to the list on the right. The list on the right contains items selected by the user. These items are the component’s value. The component provides a selection option which enables the user to select several items from a value set and save it to a given field.

The dual list box component is a form item which means it can be placed on the Form component. The standalone use of this component requires the implementation of event and value handling from code.

The component enables the user to move items from one list to the other by clicking on them. Buttons above the list make it possible to move all items from one list to the other at the same time. Lists can be filtered individually if there is an input field above the list.

Supported events:

AnimationStart AnimationEnd, Drop, DragStart, DragEnd HotKey

Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • DualListBox

      public DualListBox(String name, String label)
      Creates an empty dual list box with the specified name and label.
      Parameters:
      name - Dual list box name
      label - Dual list box label text If null is specified, no label is assigned to the dual list box.
      Throws:
      NullPointerException - Thrown if the specified name is null
    • DualListBox

      public DualListBox(String name, String label, String language)
      Creates an empty dual list box with the specified name and label according to the language code.
      Parameters:
      name - Dual list box name
      label - Dual list box label text If null is specified, no label is assigned to the dual list box.
      language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      Throws:
      NullPointerException - Thrown if the specified name is null
    • DualListBox

      public DualListBox(String name, String label, Map<Object,Object> elements)
      Creates an empty dual list box with the specified name and label.
      Parameters:
      name - Dual list box name
      label - Dual list box label text If null is specified, no label is assigned to the dual list box.
      elements - Map containing the value set of the dual list box The map key is equal to the dual list box data value and the map value is the displayed value.
      Throws:
      NullPointerException - Thrown if the specified name is null
      IllegalArgumentException - Thrown if the data value or the displayed value in the value set is null
      See Also:
    • DualListBox

      public DualListBox(String name, String label, String language, Map<Object,Object> elements)
      Creates a dual list box with the specified name and label.
      Parameters:
      name - Dual list box name
      label - Dual list box label text If null is specified, no label is assigned to the dual list box.
      language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      elements - Map containing the value set of the dual list box The map key is equal to the dual list box data value and the map value is the displayed value.
      Throws:
      NullPointerException - Thrown if the specified name is null
      IllegalArgumentException - Thrown if the data value or the displayed value in the value set is null
      See Also:
    • DualListBox

      public DualListBox(DataDescriptorColumn column)

      Creates a dual list box based on the specified DataDescriptor component.

      The method creates and sets the dual list box component based on the specified DataDescriptor column. The following parameters of the DataDescriptor are used:

      • DataDesriptorColumn.getTitle - Input field label set using the DataDescriptor column
      • DataDescriptorColumn.isNullable() - If the field gets a value of null, it is not designated as mandatory. If the field value is not set to null, it is designated as a mandatory field.
      • MetaParamName.DATADESCRIPTOR - The name of the DataDescriptor from where the dual list box retrieves its value set If the parameter is specified, the dual list box component’s value set is automatically read from the database and the component is populated with data upon being displayed.
      • MetaParamName.DATA_COLUMN - Name of the DataDescriptor column containing the dual list box data value The data value of the dual list box is the value taken by the dual list box if the user selects the specified value from the value set.
      • MetaParamName.DISPLAY_COLUMN - Name of the DataDescriptor column where the dual list box retrieves its values If you want to display multiple column values in the dual list box, all column names must be specified, separated with a comma (“,”). The displayed value is the value to be displayed on the interface upon being selected.
      • MetaParamName.DISPLAY_COLUMN_SEPARATOR - If multiple column values are shown in the combobox component, this parameter specifies the column separator If no column separator is specified, values are listed in a consecutive order.
      • MetaParamName.CRITERIA - This parameter specifies the filter criterion used to query the data. If no filter criterion is specified, all data values in the DataDescriptor are added to the dual list box as a value set.
      • MetaParamName.AUTO_FETCH - Sets if the dual list box should automatically get value set items from the database If not specified, or provided as true, the query is performed automatically. If false is specified, the query is not performed. Data query must be implemented from code by using the fetchData() method.
      • MetaParamName.MULTI_VALUE_JOIN_TABLE - Database relation table This parameter must be specified if multiple components can be selected. The parameter accepts a database table name in the same format as used in the database.
      • MetaParamName.MULTI_VALUE_RECORD_COLUMN - This parameter links the saved record and the record in the relation table

        To do this, specify the name of the column in the relation table. The record’s primary key is saved to this column. If the record has a composite key, all fields in the composite key’s columns must be listed. Field names must be listed separated with a comma in the same order as in the composite key. Specify fields in the same manner they are in the database.
        If the relation table and record are not joined using the primary key, the join type must be specified by setting the field name in the relation table and making it equal (use the equals sign “=”) to the record attribute whose value is saved to the specified field.

        E.g.: column=recordAttributeName. You can specify multiple field-attribute pairs separated with a comma.

      • MetaParamName.MULTI_VALUE_VALUE_COLUMN - This parameter specifies the column in the relation table containing the component value. The component value is a list of data values. If multiple values have been selected in the component, the relation table will also have multiple records. Upon record modification, relation table records are also updated. If the user deletes a value from the component, the corresponding relation table record is also deleted.
      • MetaParamName.MULTI_VALUE_EXTEND_VALUES - If you want to save multiple relation table values, this parameter enables you to do so. The parameter assigns a static value to one or more fields in the relation table. Specify the field name in the relation table and a static value, preceded by an equals sign (“=”). (E.g.: column=12 or column=ABC)
        If you do not specify a static value, you can use the attribute of a saved record. Instead of a static value, specify the attribute name. E.g.: columnName=${recordAttributeName}. The specified data is saved to every relation table record. Multiple values can also be specified separated with commas.
      • MetaParamName.SIZE - The input field size is set from the value specified here. (Available values: SMALL, MEDIUM, LARGE)
      • MetaParamName.STATE - The input field state is set from these values. (Available values: DEFAULT, ERROR, WARNING, SUCCESS, INFO)
      • MetaParamName.DEFAULT_VALUE - The value specified here is set as the input field’s default value. The value must be specified based on the field’s data type, in this case it must be a text value.
      • MetaParamName.READ_ONLY - If true is set, the field is created as a read-only field. Otherwise, the field is created as writable and the user can freely modify its content.
      • MetaParamName.ENABLED - If false is specified, the field is created as disabled. Otherwise the field is created as enabled.
      • MetaParamName.HELP - If this parameter is specified, an icon is displayed next to the input field and the text specified here appears as a help text if the user moves the mouse over it
      • MetaParamName.HELP_ICON - If an icon name is specified in the parameter, also listed in the enum Icon, the default help icon is changed to the icon.
      • MetaParamName.DESCRIPTION - The text specified here will appear below the field, in a smaller, italic font.
      • MetaParamName.TAB_INDEX - The value specified here determines the order of the input focus (when the user presses the Tab key). The smaller the value is, the sooner the field receives focus. The greater the value is, the later the field gets focus. If the parameter is not specified, the field’s tab index receives the value of the field’s position in a sequence as specified in the DataDescriptor. If that is also not specified, the focus order is based on which data value was entered earlier into the DataDescriptor.

      Parameters:
      column - DataDescriptor column used to create the field
      Throws:
      NullPointerException - Thrown if the parameter’s specified column is set to null
      IllegalArgumentException - Thrown if the parameters DATA_VALUE or DISPLAY_VALUE are specified, but DATADESCRIPTOR is not specified or there are no columns in the DataDescriptor identified as DATADESCRIPTOR by the names specified in the parameters DATA_VALUE or DISPLAY_VALUE
      See Also:
    • DualListBox

      public DualListBox(DataDescriptorColumn column, String language)

      Creates a dual list box based on the specified DataDescriptor according to the language code.

      The method creates and sets the dual list box component based on the specified DataDescriptor column. The following parameters of the DataDescriptor are used:

      • DataDescriptorColumn.getTitle - Input field label set using the DataDescriptor column
      • DataDescriptorColumn.isNullable() - If the field gets a value of null, it is not designated as mandatory. If the field value is not set to null, it is designated as a mandatory field.
      • MetaParamName.DATADESCRIPTOR - The name of the DataDescriptor from where the dual list box retrieves its value set If the parameter is specified, the dual list box component automatically retrieves its value set from the database and is populated with data upon being displayed.
      • MetaParamName.DATA_COLUMN - Name of the DataDescriptor column containing the dual list box data value The data value of the dual list box is the value taken by the dual list box if the user selects the specified value from the value set.
      • MetaParamName.DISPLAY_COLUMN - Name of the DataDescriptor column from where the dual list box retrieves its values If you want to display the value of multiple columns in the dual list box, all column names must be specified separated with a “,” (comma). The displayed value is the value to be displayed on the interface.
      • MetaParamName.DISPLAY_COLUMN_SEPARATOR - If multiple column values are shown in the combobox component, this parameter specifies the column separator If no column separator is specified, values are listed in a consecutive order.
      • MetaParamName.CRITERIA - This parameter specifies the filter criterion used to query the data. If no filter criterion is specified, all data values in the DataDescriptor are added to the dual list box as a value set.
      • MetaParamName.AUTO_FETCH - Sets if the dual list box should automatically get value set items from the database If not specified, or provided as true, the query is performed automatically. If false is specified, the data query is not performed. It must be implemented from code by calling the fetchData() method.
      • MetaParamName.MULTI_VALUE_JOIN_TABLE - Relation table name in the database This parameter must be specified if multiple component values can be selected. The parameter accepts a database table name in the same format as used in the database.
      • MetaParamName.MULTI_VALUE_RECORD_COLUMN - This parameter links the saved record and the record in the relation table

        To do this, specify the name of the column in the relation table. The record’s primary key is saved to this column. If the record has a composite key, all column fields in the composite key from the relation table must be listed, separated with a comma in the same order as they are in the composite key. Specify fields in the same manner they are in the database.
        If the relation table and record are not joined using the primary key, the join type must be specified by setting the field name in the relation table and making it equal (use the equals sign “=”) to the record attribute whose value is saved to the specified field.

        E.g.: column=recordAttributeName. You can specify multiple field-attribute pairs separated with a comma.

      • MetaParamName.MULTI_VALUE_VALUE_COLUMN - This parameter specifies the column in the relation table containing the component value. The component value is a list of data values. If multiple values have been selected in the component, the relation table will also have multiple records. Upon record modification, relation table records are also updated. If the user deletes a value from the component, the corresponding relation table record is also deleted.
      • MetaParamName.MULTI_VALUE_EXTEND_VALUES - If you want to save multiple relation table values, this parameter enables you to do so. The parameter assigns a static value to one or more fields in the relation table. Specify the field name in the relation table and a static value, preceded by an equals sign (“=”). (E.g.: column=12 or column=ABC)
        If you do not specify a static value, you can use the attribute of a saved record. Instead of a static value, specify the attribute name. E.g.: columnName=${recordAttributeName}. The specified data is saved to every relation table record. Multiple values can also be specified separated with commas.
      • MetaParamName.SIZE - The input field size is set from the value specified here. (Available values: SMALL, MEDIUM, LARGE)
      • MetaParamName.STATE - The input field state is set from these values. (Available values: DEFAULT, ERROR, WARNING, SUCCESS, INFO)
      • MetaParamName.DEFAULT_VALUE - The value specified here is set as the input field’s default value. The value must be specified based on the field’s data type, in this case it must be a text value.
      • MetaParamName.READ_ONLY - If true is set, the field is created as a read-only field. Otherwise, the field is created as writable and the user can freely modify its content.
      • MetaParamName.ENABLED - If false is specified, the field is created as disabled. In all other cases the field is created as enabled.
      • MetaParamName.HELP - If this parameter is specified, an icon is displayed next to the input field and the text specified here appears as a help text if the user moves the mouse over it.
      • MetaParamName.HELP_ICON - If an icon name is specified in the parameter, also listed in the enum Icon, the default help icon is changed to the icon.
      • MetaParamName.DESCRIPTION - The text specified here will appear below the field, in a smaller, italic font.
      • MetaParamName.TAB_INDEX - The value specified here determines the order of the input focus (when the user presses the Tab key). The smaller the value is, the sooner the field receives focus. The greater the value is, the later the field gets focus. If the parameter is not specified, the field’s tab index receives the value of the field’s position in a sequence as specified in the DataDescriptor. If that is also not specified, the focus order is based on which data value was entered earlier into the DataDescriptor.

      Parameters:
      column - DataDescriptor column used to create the field
      language - Language code according to which the component is created If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      Throws:
      NullPointerException - Thrown if the parameter’s specified column is set to null
      IllegalArgumentException - Thrown if the parameters DATA_VALUE or DISPLAY_VALUE are specified, but DATADESCRIPTOR is not specified or there are no columns in the DataDescriptor identified as DATADESCRIPTOR by the names specified in the parameters DATA_VALUE or DISPLAY_VALUE
      See Also:
  • Method Details

    • setJoinTableName

      public final DualListBox setJoinTableName(String joinTableName)
      This method sets the name of the relation table. Values are saved to the relation table.
      Specified by:
      setJoinTableName in interface MultiValueFormItem<DualListBox>
      Parameters:
      joinTableName - Table name for the relation table Specify the table name exactly the same way it is used in the database.
      Returns:
      Dual list box data value
    • getJoinTableName

      public final String getJoinTableName()
      Gets the database name of the relation table.
      Specified by:
      getJoinTableName in interface MultiValueFormItem<DualListBox>
      Returns:
      Relation table name or null if not specified
    • setRecordColumnName

      public final DualListBox setRecordColumnName(String recordColumnName)

      You can use this setting to specify the way the saved record and the record in the relation table are joined.

      To do this, specify the name of the column in the relation table. The record’s primary key is saved to this column. If the record has a composite key, all fields in the composite key must be listed from the relation table, separated with a comma in the same order they are in the key. Specify fields in the same manner they are in the database.
      If the relation table and record are not joined using the relation table, the join type must be specified by setting the field name in the relation table and making it equal (use the equals sign “=”) to the record attribute whose value is saved to the specified field.

      E.g.: column=recordAttributeName. You can use this format to assign multiple values separated with a comma.

      Set the name of the column in the relation table where you want to save the ID of the main record. If there are several columns, then the columns are separated by a comma (,).
      Specified by:
      setRecordColumnName in interface MultiValueFormItem<DualListBox>
      Parameters:
      recordColumnName - Description of the record-relation table join
      Returns:
      Dual list box component
    • getRecordColumnName

      public final String getRecordColumnName()
      Gets the record-relation table join description.
      Specified by:
      getRecordColumnName in interface MultiValueFormItem<DualListBox>
      Returns:
      Description of the saved record-relation table record link or null if not specified
    • setValueColumnName

      public final DualListBox setValueColumnName(String valueColumnName)
      Sets the relation table column name where the component value is saved.
      The component value is a list of data values. If multiple values have been selected in the component, the relation table will also have multiple records. Upon record modification, relation table records are also updated. If the user deletes a value from the component, the corresponding relation table record is also deleted.
      Specified by:
      setValueColumnName in interface MultiValueFormItem<DualListBox>
      Parameters:
      valueColumnName - Relation table column name where the component value is saved to
      Returns:
      Dual list box component
    • getValueColumnName

      public String getValueColumnName()
      Gets the relation table column name where the component’s value is saved to.
      Specified by:
      getValueColumnName in interface MultiValueFormItem<DualListBox>
      Returns:
      Relation table column name where the dual list box value is saved or null if not specified
    • fetchData

      public final DualListBox fetchData(Criteria criteria)
      Gets the dual list box’s value set data from the database, fulfilling the specified filter criterion.
      Parameters:
      criteria - Filter criterion used for the value set. If null is set, the value set is not filtered and all the records in the table are queried.
    • addElement

      public final DualListBox addElement(Object dataValue, Object displayValue)
      Adds an item to the dual list box. The new value is displayed automatically.
      Parameters:
      dataValue - Data value of the item; taken by the dual list box upon being selected
      displayValue - The item’s display value
      Returns:
      Dual list box component
      Throws:
      IllegalArgumentException - Thrown if the specified data value or displayed value is null
    • addElements

      public final DualListBox addElements(Map<Object,Object> data)
      Adds multiple items to the dual list box. New items are automatically displayed.
      Parameters:
      data - Map with the new values The map key is a data value and the map value is the displayed value. A data value is the value taken by the dual list box upon being selected. A displayed value is the value visible to the user.
      Returns:
      Dual list box component
      Throws:
      IllegalArgumentException - Thrown if the data value or displayed value of any new item is null
    • removeElement

      public final DualListBox removeElement(Object dataValue)
      Removes an item from the dual list box’s value set based on the item’s data value.
      Parameters:
      dataValue - The data value referencing the item to be removed
      Returns:
      Dual list box component
    • clear

      public final DualListBox clear()
      Clears the value set of the dual list box and removes all items from the value set.
      Returns:
      Dual list box component
    • setDataDescriptor

      public final DualListBox setDataDescriptor(DataDescriptor dataDesriptor)
      Sets the DataDescriptor associated with the value set.
      Specified by:
      setDataDescriptor in interface BasedOnDataDescriptor<DualListBox>
      Parameters:
      dataDesriptor - The DataDescriptor instance from where the component retrieves its value set
      Returns:
      Dual list box component
    • getDataDescriptor

      public DataDescriptor getDataDescriptor()
      Gets the DataDescriptor associated with the dual list box value set.
      Specified by:
      getDataDescriptor in interface BasedOnDataDescriptor<DualListBox>
      Returns:
      DataDescriptor instance associated with the dual list box value set or null if not specified
    • setDataColumn

      public final DualListBox setDataColumn(String columnName)
      Specifies the name of the DataDescriptor which contains value set data values. A data value is a value taken by the dual list box if the item is selected.
      Parameters:
      columnName - DataDescriptor column containing data values
      Returns:
      Dual list box component
      Throws:
      IllegalArgumentException - Thrown if there is not DataDescriptor set for the component or the specified DataDescriptor column is not included in the DataDescriptor
    • getDataColumnName

      public String getDataColumnName()
      Gets the name of the DataDescriptor column containing value set data values.
      Returns:
      DataDescriptor column name containing the value set’s data values or null if not specified
    • setDisplayColumn

      public final DualListBox setDisplayColumn(String columnName)
      Sets the name of the DataDescriptor column containing the value set’s displayed values.

      A displayed value is the value visible to the user.

      Parameters:
      columnName - DataDescriptor column name
      Returns:
      Dual list box component
      Throws:
      IllegalArgumentException - Thrown if there is not DataDescriptor set for the component or the specified DataDescriptor column is not included in the DataDescriptor
    • setDispalyColumnNames

      public DualListBox setDispalyColumnNames(String... columnNames)
      Sets the columns containing the displayed value. In case of multiple displayed values, the columns specified here are joined and the concatenated value is displayed.
      Parameters:
      columnNames - A list of DataDescriptor columns containing the value set’s displayed values
      Returns:
      Dual list box component
      Throws:
      IllegalArgumentException - Thrown if there is not DataDescriptor set for the component or the specified DataDescriptor column is not included in the DataDescriptor
    • getDisplayColumnName

      public String getDisplayColumnName()
      Gets the name of the DataDescriptor column containing the value set’s displayed values.
      Returns:
      DataDescriptor column name containing the value set’s data values or null if not specified If multiple DataDescriptor columns are displayed, the method returns the first specified name.
    • getDisplayColumnNames

      public List<String> getDisplayColumnNames()
      Gets the DataDescriptor names for all specified display value.
      Returns:
      A list of DataDescriptor column names containing the displayed values of the dual list box If no values are specified, an empty list is returned.
    • setDisplayColumnSeparator

      public final DualListBox setDisplayColumnSeparator(String separator)
      Sets the separator text for the display values. The default separator is a space character. If multiple displayed value columns are specified for the dual list box component, column values are separated using this text.
      Parameters:
      separator - Separator If null is specified, there is no separator text. Values are concatenated.
      Returns:
      Dual list box component
    • getDisplayColumnSeparator

      public String getDisplayColumnSeparator()
      Gets the separator text.
      Returns:
      Separator text
    • setValue

      public DualListBox setValue(List<Object> value)
      Sets the current value of the dual list box.
      Overrides:
      setValue in class FormItem<List<Object>,DualListBox>
      Parameters:
      value - Current value of the dual list box The current value of the dual list box is a list containing data values for the selected items. If null is specified, no selected item is included in the component.
      Returns:
      Form item component
    • init

      public void init() throws JavaScriptLoadError
      Description copied from class: Component
      The component initialization method.

      Empty method, only needs to be overwritten when making a custom component, that needs to call an initializing JavaScript on the client side. The method is called by the framework after the component is drawn, but before the afterDraw() method. The use of this method during application development is not allowed. This method is meant for inner use only.

      Overrides:
      init in class FormItem<List<Object>,DualListBox>
      Throws:
      JavaScriptLoadError - If there was a JavaScript error during the initialization.
    • afterDraw

      public void afterDraw()
      Description copied from class: Component
      The operations to be executed after the drawing of the component

      By default, this is an empty method. It has to be overwritten on a component or page if additional operations have to be executed after the drawing process. One such operation is data retrieval, which shouldn't run in constructors so that the user could see results of an operation or navigation process.

      Overrides:
      afterDraw in class FormItem<List<Object>,DualListBox>
    • onShow

      public void onShow()
      Description copied from class: Component
      The operations to be executed after the component is displayed on the client

      By default, this is an empty method. It has to be overwritten on a component or page, if additional operations have to be executed after the component is displayed. This method is nearly identical to the afterDraw() method, they differ in when they are executed. This method runs after the component is displayed on the client. Meaning that it is executed even if the component isn't redrawn, but only set to be visible after being hidden.

      Overrides:
      onShow in class FormItem<List<Object>,DualListBox>
    • getValue

      public List<Object> getValue()
      Gets the current value of the dual list box.
      Overrides:
      getValue in class FormItem<List<Object>,DualListBox>
      Returns:
      A list of data values for the selected items (that is, items moved by the user from left to right) If the component’s value is null, the return value is also null.
    • getDisplayValue

      public String getDisplayValue()
      You cannot get a single displayed value of the dual list box since always multiple values are selected.
      Specified by:
      getDisplayValue in interface DifferentDataDisplayValue
      Returns:
      null
    • getOriginalDisplayValue

      public String getOriginalDisplayValue()
      You cannot get a single displayed value of the dual list box since always multiple values are selected.
      Specified by:
      getOriginalDisplayValue in interface DifferentDataDisplayValue
      Returns:
      null
    • getDisplayValues

      public List<String> getDisplayValues()
      Gets the displayed values for the selected items.
      Specified by:
      getDisplayValues in interface DifferentMultiDataDisplayValue
      Returns:
      A list of displayed values selected by the user; null is returned if the user has not selected any items
    • getOriginalDisplayValues

      public List<String> getOriginalDisplayValues()
      Gets the displayed values for the originally selected items.
      Specified by:
      getOriginalDisplayValues in interface DifferentMultiDataDisplayValue
      Returns:
      A list of displayed values originally selected in the dual list box or null if no items have been selected
    • drawEditor

      public void drawEditor(StringWriter writer)
      Description copied from class: FormItem

      Draws the editor component.

      You do not need to use this method during development, but all components extending the form item must implement it. Use the method to generate the input field’s HTML code. This code is then inserted into the corresponding DOM code when drawing the form item.

      Specified by:
      drawEditor in class FormItem<List<Object>,DualListBox>
      Parameters:
      writer - The HTML string writer class instance; write here the HTML code for the input field
    • setSort

      public DualListBox setSort(boolean sort)
      Specifies if the displayed values are sorted. By default, the value set is displayed sorted.
      Parameters:
      sort - If true is set, the value set is displayed sorted
      Returns:
      Dual list box component
    • setSort

      public DualListBox setSort(boolean sort, Collator collator)
      Sets the dual list box value set according to the specified collator. By default, the dual list box value set is displayed in alphabetical order.
      Parameters:
      sort - If true is specified, the value set is displayed sorted, otherwise it is displayed unsorted
      collator - Collator instance describing sorting
      Returns:
      Dual list box component
      See Also:
    • setCollator

      public final DualListBox setCollator(Collator collator)
      Sets the collator instance sorting the value set.
      Parameters:
      collator - Collator instance for sorting
      Returns:
      Dual list box component
    • setDefaultValue

      public DualListBox setDefaultValue(Object defaultValue)
      Sets the default value of the dual list box.
      Specified by:
      setDefaultValue in class FormItem<List<Object>,DualListBox>
      Parameters:
      defaultValue - A list of data values selected when the dual list box is in the default state
      Returns:
      Form item component
    • getCriteria

      public final Criteria getCriteria()
      Gets the filter criterion used to retrieve the value set.
      Specified by:
      getCriteria in interface Filterable<DualListBox>
      Returns:
      Filter criterion used for the query or null if no filter criterion is specified
    • fetchData

      public final DualListBox fetchData()
      Gets the value set data from the database.
      Specified by:
      fetchData in interface Fetchable<DualListBox>
      Specified by:
      fetchData in interface Filterable<DualListBox>
      Returns:
      The component
    • setFilterCriteria

      public final DualListBox setFilterCriteria(Criteria criteria)
      Sets the filter criterion used to filter the value set.
      Specified by:
      setFilterCriteria in interface Filterable<DualListBox>
      Parameters:
      criteria - Filter criterion used for the value set
      Returns:
      Dual list box component
    • setAutoFetchData

      public DualListBox setAutoFetchData(boolean autoFetch)
      Sets if the component should automatically query the data for the value set from the database. By default the dual list box value set is automatically queried from the database upon being displayed.
      Specified by:
      setAutoFetchData in interface Fetchable<DualListBox>
      Specified by:
      setAutoFetchData in interface Filterable<DualListBox>
      Parameters:
      autoFetch - If set to true, the query is executed automatically. Otherwise, the value set items are not automatically retrieved. It must be implemented from code by calling the fetchData() method.
      Returns:
      Dual list box component
    • isAutoFetchData

      public boolean isAutoFetchData()
      Checks if the component automatically retrieves its value set from the database.
      Specified by:
      isAutoFetchData in interface Fetchable<DualListBox>
      Specified by:
      isAutoFetchData in interface Filterable<DualListBox>
      Returns:
      If true is set, the data for the value set is automatically queried, otherwise not.
    • setReadOnly

      public DualListBox setReadOnly(boolean readOnly)
      Description copied from class: FormItem
      Sets the form item to read-only mode. By default, the form item is displayed as writable and the user can freely modify the form item value. If the component is set to read-only mode, the user is unable to modify the form item value.
      Overrides:
      setReadOnly in class FormItem<List<Object>,DualListBox>
      Parameters:
      readOnly - If true is set, the form item is switched to read-only mode and the user is unable to modify the value. If false is set, the form item is switched to writable mode and the user is able to modify form item value.
      Returns:
      Form item component
    • isReadOnly

      public boolean isReadOnly()
      Specifies if the dual list box is displayed in read-only mode. If the dual list box is displayed as read-only, the user is not allowed to move items from one list to the other.
      Overrides:
      isReadOnly in class FormItem<List<Object>,DualListBox>
      Returns:
      If true is set, the form element is visible, otherwise false
    • setEnabled

      public DualListBox setEnabled(boolean enabled)
      Enables/disables the dual list box. By default the dual list box is displayed as enabled. If the component is disabled, the user is not allowed to modify the component’s value (cannot move items from one list to the other).
      Overrides:
      setEnabled in class FormItem<List<Object>,DualListBox>
      Parameters:
      enabled - If true is set, the component is enabled, otherwise disabled
      Returns:
      Dual list box component
    • isEnabled

      public boolean isEnabled()
      Sets if the component is enabled.
      Overrides:
      isEnabled in class Component<DualListBox>
      Returns:
      If true is set, the dual list box is enabled Otherwise it is disabled.
    • isMultiselect

      public boolean isMultiselect()
      Sets if the component can take multiple values. The method always returns true because multiple selection is allowed in a dual list box.
      Specified by:
      isMultiselect in interface MultiValueFormItem<DualListBox>
      Returns:
      true
    • setExtendValues

      public final DualListBox setExtendValues(String extendValues)
      This parameter enables you to save additional data to the relation table. The parameter assigns a static value to a relation table field. Specify the the relation table field first, then the static value, preceded by an equals sign (=). (E.g.: column=12 or column=ABC)
      If you do not specify a static value, you can use the attribute of a saved record. Instead of a static value, specify the attribute name. E.g.: columnName=${recordAttributeName}. The specified data is saved to every relation table record. If you specify not just a single additional value, specify a ist of values separated by commas.
      Specified by:
      setExtendValues in interface MultiValueFormItem<DualListBox>
      Parameters:
      extendValues - The extended values to be added to the table
      Returns:
      Dual list box component
    • getExtendValues

      public String getExtendValues()
      Gets additional values from the relation table.
      Specified by:
      getExtendValues in interface MultiValueFormItem<DualListBox>
      Returns:
      Additional values in the relation table or null
    • setCustomFetch

      public DualListBox setCustomFetch(FetchEvent fetchEvent)
      Sets a custom query. When calling the fetchData method, the specified FetchEvent implementation is called, then callback methods are run on records returned by the onFetch method.
      Parameters:
      fetchEvent - Custom query implementation
    • fetch

      public List<Record> fetch(int startRow, int endRow, Criteria criteria, List<Order> orders, Client client) throws FindException, DataAccessException
      Description copied from interface: Fetchable
      This method implements actual data retrieval. The Fetchable.fetchData() function runs callback methods on the returned records.
      Specified by:
      fetch in interface Fetchable<DualListBox>
      Parameters:
      startRow - The first row of the query that appears in the returned list
      endRow - The last row of the query that appears in the returned list
      criteria - The criteria used during the query If null, no criteria will be used, every record is queried.
      orders - The orderings that will be applied to the query results. If null, the data will not be ordered.
      client - The client that started the query. If null, the query will happen without checking for access rights.
      Returns:
      The list of records that meet the specified filter criteria.
      Throws:
      FindException - Occurs if an error was encountered during the query
      DataAccessException - Occurs if the user in the specified client has no access to read the data