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:
-
Field Summary
Fields inherited from class com.jbstrap.ui.components.form.FormItem
appends, clearButton, column, defaultState, defaultValue, description, formItemSize, helpIcon, label, labelPosition, labelSizes, modified, originalValue, params, prepends, required, showLabel, state, tabIndex, value, visible
Fields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition
-
Constructor Summary
ConstructorDescriptionDualListBox
(DataDescriptorColumn column) Creates a dual list box based on the specified DataDescriptor component.DualListBox
(DataDescriptorColumn column, String language) Creates a dual list box based on the specified DataDescriptor according to the language code.DualListBox
(String name, String label) Creates an empty dual list box with the specified name and label.DualListBox
(String name, String label, String language) Creates an empty dual list box with the specified name and label according to the language code.Creates a dual list box with the specified name and label.Creates an empty dual list box with the specified name and label. -
Method Summary
Modifier and TypeMethodDescriptionfinal DualListBox
addElement
(Object dataValue, Object displayValue) Adds an item to the dual list box.final DualListBox
addElements
(Map<Object, Object> data) Adds multiple items to the dual list box.void
The operations to be executed after the drawing of the componentfinal DualListBox
clear()
Clears the value set of the dual list box and removes all items from the value set.void
drawEditor
(StringWriter writer) Draws the editor component.This method implements actual data retrieval.final DualListBox
Gets the value set data from the database.final DualListBox
Gets the dual list box’s value set data from the database, fulfilling the specified filter criterion.final Criteria
Gets the filter criterion used to retrieve the value set.Gets the name of the DataDescriptor column containing value set data values.Gets the DataDescriptor associated with the dual list box value set.Gets the name of the DataDescriptor column containing the value set’s displayed values.Gets the DataDescriptor names for all specified display value.Gets the separator text.You cannot get a single displayed value of the dual list box since always multiple values are selected.Gets the displayed values for the selected items.Gets additional values from the relation table.final String
Gets the database name of the relation table.You cannot get a single displayed value of the dual list box since always multiple values are selected.Gets the displayed values for the originally selected items.final String
Gets the record-relation table join description.getValue()
Gets the current value of the dual list box.Gets the relation table column name where the component’s value is saved to.void
init()
The component initialization method.boolean
Checks if the component automatically retrieves its value set from the database.boolean
Sets if the component is enabled.boolean
Sets if the component can take multiple values.boolean
Specifies if the dual list box is displayed in read-only mode.void
onShow()
The operations to be executed after the component is displayed on the clientfinal DualListBox
removeElement
(Object dataValue) Removes an item from the dual list box’s value set based on the item’s data value.setAutoFetchData
(boolean autoFetch) Sets if the component should automatically query the data for the value set from the database.final DualListBox
setCollator
(Collator collator) Sets the collator instance sorting the value set.setCustomFetch
(FetchEvent fetchEvent) Sets a custom query.final DualListBox
setDataColumn
(String columnName) Specifies the name of the DataDescriptor which contains value set data values.final DualListBox
setDataDescriptor
(DataDescriptor dataDesriptor) Sets the DataDescriptor associated with the value set.setDefaultValue
(Object defaultValue) Sets the default value of the dual list box.setDispalyColumnNames
(String... columnNames) Sets the columns containing the displayed value.final DualListBox
setDisplayColumn
(String columnName) Sets the name of the DataDescriptor column containing the value set’s displayed values.final DualListBox
setDisplayColumnSeparator
(String separator) Sets the separator text for the display values.setEnabled
(boolean enabled) Enables/disables the dual list box.final DualListBox
setExtendValues
(String extendValues) This parameter enables you to save additional data to the relation table.final DualListBox
setFilterCriteria
(Criteria criteria) Sets the filter criterion used to filter the value set.final DualListBox
setJoinTableName
(String joinTableName) This method sets the name of the relation table.setReadOnly
(boolean readOnly) Sets the form item to read-only mode.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.setSort
(boolean sort) Specifies if the displayed values are sorted.Sets the dual list box value set according to the specified collator.Sets the current value of the dual list box.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.Methods inherited from class com.jbstrap.ui.components.form.FormItem
_addComponent, _setReverseShow, _setState, addComponent, addRecalcOnChangeColumn, addRecalcOnChangeColumns, addRecalcOnChangeColumns, addValueChangeHandler, clearValue, convertValueToJavaScript, convertValueToJavaScript, drawComponent, enableClearButton, eraseValue, getCalculateValue, getColumn, getComponents, getDataType, getDefaultState, getDescription, getFormItemSize, getLabel, getLabelPosition, getLabelSize, getLabelSize, getName, getOriginalValue, getParam, getParamAsBoolean, getParamAsDate, getParamAsDate, getParamAsDouble, getParamAsInteger, getParamAsLong, getParamAsNumber, getParamAsString, getRecalcOnChangeColumnsList, getState, getTabIndex, getValueAsBoolean, getValueAsDate, getValueAsDouble, getValueAsFloat, getValueAsInteger, getValueAsLong, getValueAsString, isAssignable, isAutoCalculate, isModified, isRequired, isReverseShow, isShowLabel, isVisible, onFormItemValueChanged, onHotKeyEventHandler, redraw, removeParam, resetState, runAfterDrawOnAddon, runOnHideOnAddon, runOnShowOnAddon, setCalculateValue, setDataType, setDataType, setDescription, setFocus, setFormItemSize, setLabel, setLabelPosition, setLabelSize, setLabelSize, setMargin, setModified, setObjectValue, setOriginalObjectValue, setOriginalValue, setPadding, setParam, setParams, setRequired, setShowLabel, setState, setTabIndex, setVisible, triggerFormChange, writeHTML
Methods inherited from class com.jbstrap.ui.Component
_hide, _setAttribute, addAllowedRole, addComponent, addComponents, addDeniedRole, addHandler, addStyle, addStyleClass, addStyleClasses, clearfix, closeTag, combinateAccess, containsStyle, containsStyleClass, draw, drawSubComponents, error, flattendComponentTree, getAccess, getAccessMode, getAllowedRoles, getAttribute, getAttributes, getBackgroundColor, getBorderColor, getClient, getComponentById, getComponents, getComponentsByClass, getData, getDeniedRoles, getHandlers, getId, getLanguageCode, getParent, getParent, getRegisteredEvents, getStyle, getStyleClasses, getTextAlign, getTextColor, getToolTip, getToolTipPosition, getTypeName, getUI, insertComponentAfter, insertComponentBefore, isAccess, isDrawn, isEventBubbling, onHide, openTag, removeAllComponents, removeAllowedRole, removeAllStyleClasses, removeAttribute, removeComponent, removeComponent, removeComponents, removeDeniedRole, removeHandler, removeStyle, removeStyle, removeStyleClass, removeStyleClasses, replaceComponent, replaceStyleClass, runAfterDraw, runJavaScript, runJavaScript, runJavaScript, runOnHide, runOnShow, say, setAttribute, setBackgroundColor, setBorder, setBorderColor, setData, setDisplayType, setEventBubbling, setFlex, setFloating, setHeight100, setHeight25, setHeight50, setHeight75, setHeightAuto, setLanguage, setName, setOverflow, setParent, setScrollable, setSelectionType, setShadow, setStyle, setTextAlign, setTextColor, setToolTip, setToolTipPosition, setWidth100, setWidth25, setWidth50, setWidth75, setWidthAuto, showNotification, showNotification, showProcessIndicator, toggleStyleClass
Methods inherited from class com.jbstrap.core.messagebus.MessageBus
closeMessageBus, messageBusOpened, openMessageBus, renewSubscription, sendMessageToMessageBus, subscribeMessageBus, unsubscribeAllListeners, unsubscribeMessageBus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jbstrap.ui.Animatable
addAnimationEndHandler, addAnimationStartHandler, getAnimation, removeAnimation, setAnimation
Methods inherited from interface com.jbstrap.ui.CanDrop
addDropEventHandler
Methods inherited from interface com.jbstrap.ui.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggable
Methods inherited from interface com.jbstrap.ui.Fetchable
addFetchDoneHandler, fireFetchDoneEvent
Methods inherited from interface com.jbstrap.ui.Focusable
addFocusHandler, addFocusInHandler, addFocusOutHandler, addLosesFocusHandler
Methods inherited from interface com.jbstrap.ui.HandleHotKey
addHotKey, addHotKey, removeHotKey, removeHotKeys
Methods inherited from interface com.jbstrap.ui.components.form.SupportHelpIcon
getHelpIcon, getHelpText, setHelpIcon, setHelpText
-
Constructor Details
-
DualListBox
Creates an empty dual list box with the specified name and label.- Parameters:
name
- Dual list box namelabel
- Dual list box label text Ifnull
is specified, no label is assigned to the dual list box.- Throws:
NullPointerException
- Thrown if the specified name isnull
-
DualListBox
Creates an empty dual list box with the specified name and label according to the language code.- Parameters:
name
- Dual list box namelabel
- Dual list box label text Ifnull
is specified, no label is assigned to the dual list box.language
- Language code according to which the component is created If not specified ornull
is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameterJBStrapParamType.DEFAULT_LANGUAGE
.- Throws:
NullPointerException
- Thrown if the specified name isnull
-
DualListBox
Creates an empty dual list box with the specified name and label.- Parameters:
name
- Dual list box namelabel
- Dual list box label text Ifnull
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 isnull
IllegalArgumentException
- Thrown if the data value or the displayed value in the value set isnull
- See Also:
-
DualListBox
Creates a dual list box with the specified name and label.- Parameters:
name
- Dual list box namelabel
- Dual list box label text Ifnull
is specified, no label is assigned to the dual list box.language
- Language code according to which the component is created If not specified ornull
is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameterJBStrapParamType.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 isnull
IllegalArgumentException
- Thrown if the data value or the displayed value in the value set isnull
- See Also:
-
DualListBox
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 columnDataDescriptorColumn.isNullable()
- If the field gets a value ofnull
, it is not designated as mandatory. If the field value is not set tonull
, 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 astrue
, the query is performed automatically. Iffalse
is specified, the query is not performed. Data query must be implemented from code by using thefetchData()
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 tableTo 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
- Iftrue
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
- Iffalse
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 itMetaParamName.HELP_ICON
- If an icon name is specified in the parameter, also listed in the enumIcon
, 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 tonull
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
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 columnDataDescriptorColumn.isNullable()
- If the field gets a value ofnull
, it is not designated as mandatory. If the field value is not set tonull
, 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 astrue
, the query is performed automatically. Iffalse
is specified, the data query is not performed. It must be implemented from code by calling thefetchData()
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 tableTo 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
- Iftrue
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
- Iffalse
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 enumIcon
, 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 fieldlanguage
- Language code according to which the component is created If not specified ornull
is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameterJBStrapParamType.DEFAULT_LANGUAGE
.- Throws:
NullPointerException
- Thrown if the parameter’s specified column is set tonull
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
This method sets the name of the relation table. Values are saved to the relation table.- Specified by:
setJoinTableName
in interfaceMultiValueFormItem<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
Gets the database name of the relation table.- Specified by:
getJoinTableName
in interfaceMultiValueFormItem<DualListBox>
- Returns:
- Relation table name or
null
if not specified
-
setRecordColumnName
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 interfaceMultiValueFormItem<DualListBox>
- Parameters:
recordColumnName
- Description of the record-relation table join- Returns:
- Dual list box component
-
getRecordColumnName
Gets the record-relation table join description.- Specified by:
getRecordColumnName
in interfaceMultiValueFormItem<DualListBox>
- Returns:
- Description of the saved record-relation table record link or
null
if not specified
-
setValueColumnName
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 interfaceMultiValueFormItem<DualListBox>
- Parameters:
valueColumnName
- Relation table column name where the component value is saved to- Returns:
- Dual list box component
-
getValueColumnName
Gets the relation table column name where the component’s value is saved to.- Specified by:
getValueColumnName
in interfaceMultiValueFormItem<DualListBox>
- Returns:
- Relation table column name where the dual list box value is saved or
null
if not specified
-
fetchData
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. Ifnull
is set, the value set is not filtered and all the records in the table are queried.
-
addElement
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 selecteddisplayValue
- The item’s display value- Returns:
- Dual list box component
- Throws:
IllegalArgumentException
- Thrown if the specified data value or displayed value isnull
-
addElements
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 isnull
-
removeElement
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
Clears the value set of the dual list box and removes all items from the value set.- Returns:
- Dual list box component
-
setDataDescriptor
Sets the DataDescriptor associated with the value set.- Specified by:
setDataDescriptor
in interfaceBasedOnDataDescriptor<DualListBox>
- Parameters:
dataDesriptor
- The DataDescriptor instance from where the component retrieves its value set- Returns:
- Dual list box component
-
getDataDescriptor
Gets the DataDescriptor associated with the dual list box value set.- Specified by:
getDataDescriptor
in interfaceBasedOnDataDescriptor<DualListBox>
- Returns:
- DataDescriptor instance associated with the dual list box value set or
null
if not specified
-
setDataColumn
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
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
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
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
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
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
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 Ifnull
is specified, there is no separator text. Values are concatenated.- Returns:
- Dual list box component
-
getDisplayColumnSeparator
Gets the separator text.- Returns:
- Separator text
-
setValue
Sets the current value of the dual list box.- Overrides:
setValue
in classFormItem<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. Ifnull
is specified, no selected item is included in the component.- Returns:
- Form item component
-
init
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 classFormItem<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 componentBy 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 classFormItem<List<Object>,
DualListBox>
-
onShow
public void onShow()Description copied from class:Component
The operations to be executed after the component is displayed on the clientBy 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 classFormItem<List<Object>,
DualListBox>
-
getValue
Gets the current value of the dual list box.- Overrides:
getValue
in classFormItem<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 alsonull
.
-
getDisplayValue
You cannot get a single displayed value of the dual list box since always multiple values are selected.- Specified by:
getDisplayValue
in interfaceDifferentDataDisplayValue
- Returns:
null
-
getOriginalDisplayValue
You cannot get a single displayed value of the dual list box since always multiple values are selected.- Specified by:
getOriginalDisplayValue
in interfaceDifferentDataDisplayValue
- Returns:
null
-
getDisplayValues
Gets the displayed values for the selected items.- Specified by:
getDisplayValues
in interfaceDifferentMultiDataDisplayValue
- Returns:
- A list of displayed values selected by the user;
null
is returned if the user has not selected any items
-
getOriginalDisplayValues
Gets the displayed values for the originally selected items.- Specified by:
getOriginalDisplayValues
in interfaceDifferentMultiDataDisplayValue
- Returns:
- A list of displayed values originally selected in the dual list box or
null
if no items have been selected
-
drawEditor
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 classFormItem<List<Object>,
DualListBox> - Parameters:
writer
- The HTML string writer class instance; write here the HTML code for the input field
-
setSort
Specifies if the displayed values are sorted. By default, the value set is displayed sorted.- Parameters:
sort
- Iftrue
is set, the value set is displayed sorted- Returns:
- Dual list box component
-
setSort
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
- Iftrue
is specified, the value set is displayed sorted, otherwise it is displayed unsortedcollator
- Collator instance describing sorting- Returns:
- Dual list box component
- See Also:
-
setCollator
Sets the collator instance sorting the value set.- Parameters:
collator
- Collator instance for sorting- Returns:
- Dual list box component
-
setDefaultValue
Sets the default value of the dual list box.- Specified by:
setDefaultValue
in classFormItem<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
Gets the filter criterion used to retrieve the value set.- Specified by:
getCriteria
in interfaceFilterable<DualListBox>
- Returns:
- Filter criterion used for the query or
null
if no filter criterion is specified
-
fetchData
Gets the value set data from the database.- Specified by:
fetchData
in interfaceFetchable<DualListBox>
- Specified by:
fetchData
in interfaceFilterable<DualListBox>
- Returns:
- The component
-
setFilterCriteria
Sets the filter criterion used to filter the value set.- Specified by:
setFilterCriteria
in interfaceFilterable<DualListBox>
- Parameters:
criteria
- Filter criterion used for the value set- Returns:
- Dual list box component
-
setAutoFetchData
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 interfaceFetchable<DualListBox>
- Specified by:
setAutoFetchData
in interfaceFilterable<DualListBox>
- Parameters:
autoFetch
- If set totrue
, the query is executed automatically. Otherwise, the value set items are not automatically retrieved. It must be implemented from code by calling thefetchData()
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 interfaceFetchable<DualListBox>
- Specified by:
isAutoFetchData
in interfaceFilterable<DualListBox>
- Returns:
- If
true
is set, the data for the value set is automatically queried, otherwise not.
-
setReadOnly
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 classFormItem<List<Object>,
DualListBox> - Parameters:
readOnly
- Iftrue
is set, the form item is switched to read-only mode and the user is unable to modify the value. Iffalse
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 classFormItem<List<Object>,
DualListBox> - Returns:
- If
true
is set, the form element is visible, otherwisefalse
-
setEnabled
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 classFormItem<List<Object>,
DualListBox> - Parameters:
enabled
- Iftrue
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 classComponent<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 returnstrue
because multiple selection is allowed in a dual list box.- Specified by:
isMultiselect
in interfaceMultiValueFormItem<DualListBox>
- Returns:
true
-
setExtendValues
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 interfaceMultiValueFormItem<DualListBox>
- Parameters:
extendValues
- The extended values to be added to the table- Returns:
- Dual list box component
-
getExtendValues
Gets additional values from the relation table.- Specified by:
getExtendValues
in interfaceMultiValueFormItem<DualListBox>
- Returns:
- Additional values in the relation table or
null
-
setCustomFetch
Sets a custom query. When calling the fetchData method, the specifiedFetchEvent
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. TheFetchable.fetchData()
function runs callback methods on the returned records.- Specified by:
fetch
in interfaceFetchable<DualListBox>
- Parameters:
startRow
- The first row of the query that appears in the returned listendRow
- The last row of the query that appears in the returned listcriteria
- The criteria used during the query Ifnull
, no criteria will be used, every record is queried.orders
- The orderings that will be applied to the query results. Ifnull
, the data will not be ordered.client
- The client that started the query. Ifnull
, 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 queryDataAccessException
- Occurs if the user in the specified client has no access to read the data
-