Class ComboboxItem
- All Implemented Interfaces:
Animatable<ComboboxItem>,CanDrop<ComboboxItem>,SupportAppend<ComboboxItem>,SupportHelpIcon<ComboboxItem>,SupportPlaceholder<ComboboxItem>,Draggable<ComboboxItem>,Fetchable<ComboboxItem>,Focusable<ComboboxItem>,HandleHotKey<ComboboxItem>,BasedOnDataDescriptor<ComboboxItem>,DifferentDataDisplayValue,DifferentMultiDataDisplayValue,Filterable<ComboboxItem>,MultiValueFormItem<ComboboxItem>
Combobox item
The component implements a combobox, forcing the user to only input value(s) from a predetermined set of values. The combobox values can be filtered by the user. The component supports sorting, and the set of values can be uploaded from a database as well.
The component can be in multi-select mode or single select.
The use of the component is recommended, when the selectable set of values is small. If there are too many selectable values, the use of the combobox might slow down.
If using a lot of selectable values, the SelectorItem component is recommended instead, since it handles larger amounts of selectable values better.
This component is a form item, which means it can be placed, and it will be handled by the Form component. It can be used on its own, but in this case
the developer must implement event and value handlers.
Supported events:
AnimationStart
AnimationEnd,
Focus
FocusOut
FocusIn
LosesFocus
KeyPress,
KeyUp,
KeyDown,
Drop,
DragStart,
DragEnd
HotKey
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
FieldsFields 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, visibleFields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition -
Constructor Summary
ConstructorsConstructorDescriptionComboboxItem(DataDescriptorColumn column) Creates a combobox input field, based on the specified DataDescriptor column.ComboboxItem(DataDescriptorColumn column, String language) Creates a combobox input field, based on the specified DataDescriptor column and language.ComboboxItem(String name) Creates an empty combobox input field with the specified nameComboboxItem(String name, String label) Creates an empty combobox input field with the specified name and labelComboboxItem(String name, String label, String language) Creates an empty combobox input field with the specified name, label and languageCreates a combobox input field with the specified name, label and language.Creates a combobox input field with the specified name and label. -
Method Summary
Modifier and TypeMethodDescriptionprotected ComboboxItem_addElement(Object dataValue, Object displayValue) addElement(Object dataValue, Object displayValue) Adds the specified element to the combobox set of values.addElements(Map<Object, Object> data) Adds the specified elements to the combobox set of values.voidThe operations to be executed after the drawing of the componentfinal ComboboxItemclear()Clears the combobox's set of valuesfinal ComboboxItemclose()Closes the combobox listfinal booleancontainsElement(Object dataValue) Determines if the specified data value is among the combobox's values.protected StringconvertKeyToJavaScript(Object value) voiddrawEditor(StringWriter writer) Draws the editor component.This method implements actual data retrieval.Fetches datafinal ComboboxItemFetches the combobox's set of values, following the specified criteriafinal CriteriaGets the criteria that is applied to the records that are in the combobox set of valuesGets the name of the DataDescriptor column, that contains the data valuesintGets the value's data countGets the DataDescriptor, that is used by the comboboxGets a list containing of the combobox's data values.Gets the name of the DataDescriptor column that contains the display values.Gets the names of the DataDescriptor column that contains the display values.Gets the separator character that is used to separate the display values.Gets the display value of the currently selected combobox valueGets the display values that correspond to the data values, if the user can select multiple values in the combobox,Gets the extended values from the relation tablefinal StringGets the name of the relation table, that is used, when the user can select multiple values in the comboboxGets the display value of the original combobox valueGets the original display values that correspond to the data values, if the user can select multiple values in the combobox,final StringGets description of the connection of the saved recordGets the name of the column, where the component values are to be saved.voidinit()The component initialization method.final booleanDetermines if the combobox allows a null value.booleanDetermines if the auto data fetch is enabled or notbooleanDetermines if the combobox is enabled on the interface or not.booleanDetermines if the user can select multiple values in the combobox.booleanDetermines if the combobox is read onlyvoidonShow()The operations to be executed after the component is displayed on the clientfinal ComboboxItemremoveElement(Object dataValue) Removes the specified element from the combobox set of values.final ComboboxItemsetAllowNull(boolean allowNull) Sets if the combobox can accept null values.final ComboboxItemsetAutoFetchData(boolean autoFetch) Sets if the data is automatically fetched from the database.final ComboboxItemsetCollator(Collator collator) Sets the sorting collatorsetCustomFetch(FetchEvent fetchEvent) Sets a custom query.final ComboboxItemsetDataColumn(String columnName) Sets the name of the DataDescriptor column, that contains the data values(data values are the actual values that are used by the component when the user selects something, not the displayed value).final ComboboxItemsetDataDescriptor(DataDescriptor dataDescriptor) Sets the DataDescriptor, that is used by the Combobox component, to read the set of values from.setDefaultValue(Object defaultValue) Sets the default value of the comboboxfinal ComboboxItemsetDisplayColumn(String columnName) Sets the name of the DataDescriptor column, that contains the display values.final ComboboxItemsetDisplayColumns(String... columnNames) Sets the names of the DataDescriptor columns If multiple display values are used.final ComboboxItemsetDisplayColumnSeparator(String separator) Sets the separator character that is used to separate the display values.setEnabled(boolean enabled) Sets the combobox to be enabled.final ComboboxItemsetExtendValues(String extendValues) If further data is to be stored in the relation table, it can be set using this parameter.final ComboboxItemsetFilterCriteria(Criteria criteria) Sets the criteria that is applied to the records that are in the combobox set of valuesfinal ComboboxItemsetJoinTableName(String joinTableName) If the user can select multiple values in the combobox, those values will be saved to a separate relation table.final ComboboxItemsetMultiselect(boolean multiple) Sets if the user can select multiple values in the combobox.final ComboboxItemsetReadOnly(boolean readOnly) Sets the combobox to be read only for the user.final ComboboxItemsetRecordColumnName(String recordColumnName) This is where the connection of the saved record and the record in the table can be set.setRequired(boolean required) If set, the combobox has to be filled out by the user.setSort(boolean sort) Sets if the combobox values appear sorted to the user.Sets the sorting of the combobox values.Sets the current value of the combobox.final ComboboxItemsetValueColumnName(String valueColumnName) Sets the name of the column , where the component values are to be saved.setVisible(boolean visible) Sets if the component is visible on the interface.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, getValue, 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, setShowLabel, setState, setTabIndex, triggerFormChange, writeHTMLMethods 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, toggleStyleClassMethods inherited from class com.jbstrap.core.messagebus.MessageBus
closeMessageBus, messageBusOpened, openMessageBus, renewSubscription, sendMessageToMessageBus, subscribeMessageBus, unsubscribeAllListeners, unsubscribeMessageBusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jbstrap.ui.Animatable
addAnimationEndHandler, addAnimationStartHandler, getAnimation, removeAnimation, setAnimationMethods inherited from interface com.jbstrap.ui.CanDrop
addDropEventHandlerMethods inherited from interface com.jbstrap.ui.Draggable
addDragEndEventHandler, addDragStartEventHandler, setDraggableMethods inherited from interface com.jbstrap.ui.Fetchable
addFetchDoneHandler, fireFetchDoneEventMethods inherited from interface com.jbstrap.ui.Focusable
addFocusHandler, addFocusInHandler, addFocusOutHandler, addLosesFocusHandler, setFocusMethods inherited from interface com.jbstrap.ui.HandleHotKey
addHotKey, addHotKey, removeHotKey, removeHotKeysMethods inherited from interface com.jbstrap.ui.components.form.SupportAppend
append, append, append, prepend, prepend, prepend, removeAppend, removePrependMethods inherited from interface com.jbstrap.ui.components.form.SupportHelpIcon
getHelpIcon, getHelpText, setHelpIcon, setHelpTextMethods inherited from interface com.jbstrap.ui.components.form.SupportPlaceholder
getPlaceholder, setPlaceholder
-
Field Details
-
dataMap
-
-
Constructor Details
-
ComboboxItem
Creates an empty combobox input field with the specified name- Parameters:
name- The name of the combobox- Throws:
NullPointerException- If the specified name isnull
-
ComboboxItem
Creates an empty combobox input field with the specified name and label- Parameters:
name- The name of the comboboxlabel- The label of the combobox. Ifnull, no label will be used- Throws:
NullPointerException- If the specified name isnull
-
ComboboxItem
Creates an empty combobox input field with the specified name, label and language- Parameters:
name- The name of the comboboxlabel- The label of the combobox. Ifnull, no label will be usedlanguage- The language code to be used by the form item. If not specified, ornullthe default language will be used. The framework's default language can be set by theJBStrapParamType.DEFAULT_LANGUAGEJBStrap parameter- Throws:
NullPointerException- If the specified name isnull
-
ComboboxItem
Creates a combobox input field with the specified name and label. Fills up the combobox with the specified values.- Parameters:
name- The name of the comboboxlabel- The label of the combobox. Ifnull, no label will be usedelements- The map containing the values to be added to the combobox. The map key is the combobox data value, and the value is the display value.- Throws:
NullPointerException- If the specified name isnullIllegalArgumentException- If any of the specified map's key or value isnull- See Also:
-
ComboboxItem
Creates a combobox input field with the specified name, label and language. Fills up the combobox with the specified values.- Parameters:
name- The name of the comboboxlabel- The label of the combobox. Ifnull, no label will be usedlanguage- The language code to be used by the form item. If not specified, ornullthe default language will be used. The framework's default language can be set by theJBStrapParamType.DEFAULT_LANGUAGEJBStrap parameterelements- The map containing the values to be added to the combobox. The map key is the combobox data value, and the value is the display value.- Throws:
NullPointerException- If the specified name isnullIllegalArgumentException- If any of the specified map's key or value isnull- See Also:
-
ComboboxItem
Creates a combobox input field, based on the specified DataDescriptor column.
The method creates and sets the Combobox item, based on the parameters of the specified column. The following parameters are used:
DataDescriptorColumn.getTitle- The field label is the one specified for 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.MULTIPLE- Iftrue, multiple values can be selected from the combobox values. Otherwise, only one can be selected.MetaParamName.ALLOW_NULL- Iftrue, the combobox will accept null values, regardless of the DataDescriptor Column's settings. Also allows the user to delete previous values from the combobox. Iffalse, the user cannot use null values. If not specified, it will follow the DataDescriptor Column's settings.MetaParamName.DATADESCRIPTOR- The name of the DataDescriptor, where the Combobox will read the values from. If specified, the component will be able to read the values automatically, and will fill itself out, after displaying.MetaParamName.DATA_COLUMN- The name of the DataDescriptor column, that contains the combobox values. This is the value, that the combobox will have, when the user selects it from the set of values.MetaParamName.DISPLAY_COLUMN- The name of the column that contains the combobox display values. If multiple columns are to be used, the name of the columns must be seperated by a "," character.MetaParamName.DISPLAY_COLUMN_SEPARATOR- If multiple column values are to be used, their values will be separated by the character specified here. If not specified, the values will follow each other, with no character, or spacing between them.MetaParamName.CRITERIA- This is where the filter criteria can be specified, in text form, which will be used during the DataDescriptor queries. If not specified, every value from the DataDescriptor will be used in the combobox.MetaParamName.AUTO_FETCH- Sets if the auto fetch is enabled or not. Iftrue, or not specified, the data fetch from the database will be automatic. Iffalsethe fetch won't happen, the program logic must implement it, by calling thefetchData()method.MetaParamName.MULTI_VALUE_JOIN_TABLE- The name of the 1:N relation table in the database. Must be specified, if multi-select is enabled. Note: the name to be specified here is not a Domain class name, but the database table name, as it appears in the database.MetaParamName.MULTI_VALUE_RECORD_COLUMN- This is where the saved record and record in the relation table must be connected. This is done by specifying the name of the column (as it appears in the table), where the primary key of the record is to be saved. If the record has a complex key, then the fields in the columns (that are from the table) that respond to the key, must be listed in the parameter. They must be separated by a "," character, in the order that the fields are in the complex key (that are connected to the record). They must be specified exactly as they appear in the database.
If the table and the record is not to be connected with a primary key, the connection must be specified in the parameter, by specifying the name of the table field, then assigning a record attribute name, after a "=" character.
(Example: column=recordAttributeName.) In this format, multiple connections can be specified, separated by a "," character.MetaParamName.MULTI_VALUE_VALUE_COLUMN- This is where the column (containing the component's value) of the relation table must be specified. The component values are in the dataValue, in a list. If the component has multiple values selected, then multiple records will be in the relation table as well. If the component is modified, the records in the table will also be modified. That is, if the user deletes something from the component, the corresponding table record will be deleted as well.MetaParamName.MULTI_VALUE_EXTEND_VALUES- If further data is to be stored in the relation table, it can be set using this parameter. Static values can be assigned to a relation table, by specifying the field name, then a "=" character, then the static value to be saved (Example: column=12 or column=ABC)
If the value is not static, a saved record's attribute can be used, by specifying the field name, followed by a "=" character, followed by the name of an attribute in the record: columnName=${recordAttributeName}. Values specified like this will be saved in every relation table. Multiple values can be specified, following the above mentioned formats, by separating the values with a "," character.MetaParamName.PLACEHOLDER- Placeholder text to be used in the input field. This text is displayed if no other text is entered into the input field.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, that is, it must be a text value.MetaParamName.READ_ONLY- Iftrueis set, the field is created as a read-only field. Otherwise the field is created as writable and the user is free to change its content.MetaParamName.ENABLED- Iffalseis set, the field is 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 text 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 gets 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 focus order value set for the field 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- The DataDescriptor column, that will be the basis of the component- Throws:
NullPointerException- If the specified column isnullIllegalArgumentException- If the DATA_VALUE or DISPLAY_VALUE parameters are specified, but not the DATADESCRIPTOR parameter, or if the DATA_VALUE or the DISPLAY_VALUE column names do not match the column names in the specified DATADESCRIPTOR- See Also:
-
ComboboxItem
Creates a combobox input field, based on the specified DataDescriptor column and language.
The method creates and sets the Combobox item, based on the parameters of the specified column. The following parameters are used:
DataDescriptorColumn.getTitle- The field label is the one specified for 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.MULTIPLE- Iftrue, multiple values can be selected from the combobox values. Otherwise, only one can be selected.MetaParamName.ALLOW_NULL- Iftrue, the combobox will accept null values, regardless of the DataDescriptor Column's settings. Also allows the user to delete previous values from the combobox. Iffalse, the user cannot use null values. If not specified, it will follow the DataDescriptor Column's settings.MetaParamName.DATADESCRIPTOR- The name of the DataDescriptor, where the Combobox will read the values from. If specified, the component will be able to read the values automatically, and will fill itself out, after displaying.MetaParamName.DATA_COLUMN- The name of the DataDescriptor column, that contains the combobox values. This is the value, that the combobox will have, when the user selects it from the set of values.MetaParamName.DISPLAY_COLUMN- The name of the column that contains the combobox display values. If multiple columns are to be used, the name of the columns must be seperated by a "," character.MetaParamName.DISPLAY_COLUMN_SEPARATOR- If multiple column values are to be used, their values will be separated by the character specified here. If not specified, the values will follow each other, with no character, or spacing between them.MetaParamName.CRITERIA- This is where the filter criteria can be specified, in text form, which will be used during the DataDescriptor queries. If not specified, every value from the DataDescriptor will be used in the combobox.MetaParamName.AUTO_FETCH- Sets if the auto fetch is enabled or not. Iftrue, or not specified, the data fetch from the database will be automatic. Iffalsethe fetch won't happen, the program logic must implement it, by calling thefetchData()method.MetaParamName.MULTI_VALUE_JOIN_TABLE- The name of the 1:N relation table in the database. Must be specified, if multi-select is enabled. Note: the name to be specified here is not a Domain class name, but the database table name, as it appears in the database.MetaParamName.MULTI_VALUE_RECORD_COLUMN- This is where the saved record and record in the relation table must be connected. This is done by specifying the name of the column (as it appears in the table), where the primary key of the record is to be saved. If the record has a complex key, then the fields in the columns (that are from the table) that respond to the key, must be listed in the parameter. They must be separated by a "," character, in the order that the fields are in the complex key (that are connected to the record). They must be specified exactly as they appear in the database.
If the table and the record is not to be connected with a primary key, the connection must be specified in the parameter, by specifying the name of the table field, then assigning a record attribute name, after a "=" character.
(Example: column=recordAttributeName.) In this format, multiple connections can be specified, separated by a "," character.MetaParamName.MULTI_VALUE_VALUE_COLUMN- This is where the column (containing the component's value) of the relation table must be specified. The component values are in the dataValue, in a list. If the component has multiple values selected, then multiple records will be in the relation table as well. If the component is modified, the records in the table will also be modified. That is, if the user deletes something from the component, the corresponding table record will be deleted as well.MetaParamName.MULTI_VALUE_EXTEND_VALUES- If further data is to be stored in the relation table, it can be set using this parameter. Static values can be assigned to a relation table, by specifing the field name, then a "=" character, then the static value to be saved (Example: column=12 or column=ABC)
If the value is not static, a saved record's attribute can be used, by specifying the field name, followed by a "=" character, followed by the name of an attribute in the record: columnName=${recordAttributeName}. Values specified like this will be saved in every relation table. Multiple values can be specified, following the above mentioned formats, by separating the values with a "," character.MetaParamName.PLACEHOLDER- Placeholder text to be used in the input field. This text is displayed if no other text is entered into the input field.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, that is, it must be a text value.MetaParamName.READ_ONLY- Iftrueis set, the field is created as a read-only field. Otherwise the field is created as writable and the user is free to change its content.MetaParamName.ENABLED- Iffalseis set, the field is 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 text 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 gets 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 focus order value set for the field 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- The DataDescriptor column, that will be the basis of the componentlanguage- The language code to be used by the form item. If not specified, ornullthe default language will be used. The framework's default language can be set by theJBStrapParamType.DEFAULT_LANGUAGEJBStrap parameter- Throws:
NullPointerException- If the specified column isnullIllegalArgumentException- If the DATA_VALUE or DISPLAY_VALUE parameters are specified, but not the DATADESCRIPTOR parameter, or if the DATA_VALUE or the DISPLAY_VALUE column names do not match the column names in the specified DATADESCRIPTOR- See Also:
-
-
Method Details
-
setJoinTableName
If the user can select multiple values in the combobox, those values will be saved to a separate relation table. This table can be specified with this method. If the user can only select one value, this setting is ignored.- Specified by:
setJoinTableNamein interfaceMultiValueFormItem<ComboboxItem>- Parameters:
joinTableName- The name of the table, that is in a 1:N relation with the database. The name must be exactly the same, as it appears in the database- Returns:
- The combobox component
-
getJoinTableName
Gets the name of the relation table, that is used, when the user can select multiple values in the combobox- Specified by:
getJoinTableNamein interfaceMultiValueFormItem<ComboboxItem>- Returns:
- The name of the table with the 1:N relation, or
nullif not specified
-
setRecordColumnName
This is where the connection of the saved record and the record in the table can be set.
This is done by specifying the name of the relation table column, where the record's primary key is to be saved. If the record has a complex key, then every column field that is in the key must be listed from the relation table, separated with a "," character, in the order the fields are in the record's complex key. They must be specified exactly like they are in the database.
If the table and the record is not to be connected with a primary key, the connection must be specified in the parameter, by specifying the name of the table field, then assigning a record attribute name, after a "=" character.
(Example: column=recordAttributeName.) In this format, mutliple connections can be specified, separated by a "," character.- Specified by:
setRecordColumnNamein interfaceMultiValueFormItem<ComboboxItem>- Parameters:
recordColumnName- Description of the connection of the saved record- Returns:
- The combobox component
-
getRecordColumnName
Gets description of the connection of the saved record- Specified by:
getRecordColumnNamein interfaceMultiValueFormItem<ComboboxItem>- Returns:
- The description, or
nullif not specified
-
setValueColumnName
Sets the name of the column , where the component values are to be saved.
The component value is in a value in the dataValue list. If multiple values can be selected, the table will also have multiple records. If the component is modified/deleted, the records in the table are also modified/deleted accordingly.- Specified by:
setValueColumnNamein interfaceMultiValueFormItem<ComboboxItem>- Parameters:
valueColumnName- The name of the relation table column, where the combobox values are saved- Returns:
- The combobox component
-
getValueColumnName
Gets the name of the column, where the component values are to be saved.- Specified by:
getValueColumnNamein interfaceMultiValueFormItem<ComboboxItem>- Returns:
- The name of the relation table column, where the combobox values are saved, or
nullif not specified
-
fetchData
Fetches the combobox's set of values, following the specified criteria- Parameters:
criteria- The criteria to be applied to the fetch- Returns:
- The combobox component
-
setMultiselect
Sets if the user can select multiple values in the combobox.- Parameters:
multiple- Iftrue, multiple values can be selected from the combobox values. Otherwise only one can be selected.- Returns:
- The combobox component
-
isMultiselect
public boolean isMultiselect()Determines if the user can select multiple values in the combobox.- Specified by:
isMultiselectin interfaceMultiValueFormItem<ComboboxItem>- Returns:
true, multiple values can be selected from the combobox values. Otherwise only one can be selected.
-
convertKeyToJavaScript
- Parameters:
value- The original value- Returns:
- The value converted to a JavaScript value as String
-
init
Description copied from class:ComponentThe 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:
initin classFormItem<Object,ComboboxItem> - Throws:
JavaScriptLoadError- If there was a JavaScript error during the initialization.
-
_addElement
- Parameters:
dataValue- The data value of the new elementdisplayValue- The display value of the new element.- Returns:
- The combobox component
- Throws:
IllegalArgumentException- If either value isnull
-
addElement
Adds the specified element to the combobox set of values. The added new value will be displayed automatically- Parameters:
dataValue- The data value of the new elementdisplayValue- The display value of the new element.- Returns:
- The combobox component
- Throws:
IllegalArgumentException- If either value isnull
-
addElements
Adds the specified elements to the combobox set of values. The added new value will be displayed automatically- Parameters:
data- Map of the new elements. The map key is the data value, the value is the display value.- Returns:
- The combobox component
- Throws:
IllegalArgumentException- If any of the specified values arenull
-
removeElement
Removes the specified element from the combobox set of values. Specified by its data value.- Parameters:
dataValue- The data value of the element that is to be removed.- Returns:
- The combobox component
-
clear
Clears the combobox's set of values- Returns:
- The combobox component
-
setAllowNull
Sets if the combobox can accept null values. If true, a small "x" icon will appear in the combobox, that will allow the user to delete the current value. In this case, the combobox will have anullvalue. If false, the user cannot delete the value, they can only modify.- Parameters:
allowNull- Iftrue, it allows null values, otherwise it will not- Returns:
- The combobox component
-
isAllowNull
public final boolean isAllowNull()Determines if the combobox allows a null value.- Returns:
- If
true, it allows it, otherwise, not
-
setDataDescriptor
Sets the DataDescriptor, that is used by the Combobox component, to read the set of values from.- Specified by:
setDataDescriptorin interfaceBasedOnDataDescriptor<ComboboxItem>- Parameters:
dataDescriptor- The DataDescriptor instance, used by the combobox- Returns:
- Component instance
- See Also:
-
getDataDescriptor
Gets the DataDescriptor, that is used by the combobox- Specified by:
getDataDescriptorin interfaceBasedOnDataDescriptor<ComboboxItem>- Returns:
- The DataDescriptor instance, used by the combobox or
null, if not set
-
setDataColumn
Sets the name of the DataDescriptor column, that contains the data values(data values are the actual values that are used by the component when the user selects something, not the displayed value).- Parameters:
columnName- The data value column name in the DataDescriptor- Returns:
- The combobox component
- Throws:
IllegalArgumentException- If the component has no DataDescriptor set, or if the specified column is not found
-
getDataColumnName
Gets the name of the DataDescriptor column, that contains the data values- Returns:
- The data value column name in the DataDescriptor or
null, if not set
-
setDisplayColumn
Sets the name of the DataDescriptor column, that contains the display values. The display values are the values that the user actually sees in the combobox.- Parameters:
columnName- The display value column name in the DataDescriptor- Returns:
- The combobox component
- Throws:
IllegalArgumentException- If the component has no DataDescriptor set, or if the specified column is not found
-
setDisplayColumns
Sets the names of the DataDescriptor columns If multiple display values are used. The displaye values are the values that the user actually sees in the combobox. If multiple columns are specified, they will be separated by the character specified in thesetDisplayColumnSeparatormethod. By default, this is an empty string, so the values will follow each other with no spacing.- Parameters:
columnNames- The display value column names- Returns:
- The combobox component
-
getDisplayColumnName
Gets the name of the DataDescriptor column that contains the display values. If multiple columns are used, the first column will be returned.- Returns:
- The name of the display columns, or
nullif not specified
-
getDisplayColumnNames
Gets the names of the DataDescriptor column that contains the display values.- Returns:
- A list containing the name of the DataDescriptor columns, that contain the display values. If no columns were specified, the list will be empty
-
setDisplayColumnSeparator
Sets the separator character that is used to separate the display values. By default this is an empty string, so the display values will have no spacing between them- Parameters:
separator- The display value separator character. Ifnull, the values will not be separated- Returns:
- The combobox component
-
getDisplayColumnSeparator
Gets the separator character that is used to separate the display values.- Returns:
- The display value separator character. If not specified, it will be an empty string
-
drawEditor
Description copied from class:FormItemDraws 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:
drawEditorin classFormItem<Object,ComboboxItem> - Parameters:
writer- The HTML string writer class instance; write here the HTML code for the input field
-
getDisplayValue
Gets the display value of the currently selected combobox value- Specified by:
getDisplayValuein interfaceDifferentDataDisplayValue- Returns:
- The display value of the currently selected combobox value, or
nullif the combobox value isnull, or if it has no values
-
getOriginalDisplayValue
Gets the display value of the original combobox value- Specified by:
getOriginalDisplayValuein interfaceDifferentDataDisplayValue- Returns:
- The display value of the original combobox value or
null, if the oriignal value isnull, or if it has no values
-
getDisplayValues
Gets the display values that correspond to the data values, if the user can select multiple values in the combobox,- Specified by:
getDisplayValuesin interfaceDifferentMultiDataDisplayValue- Returns:
- A list of the display values, if the user can select multiple values, and has chosen at least one value, otherwise it will return with
null
-
getOriginalDisplayValues
Gets the original display values that correspond to the data values, if the user can select multiple values in the combobox,- Specified by:
getOriginalDisplayValuesin interfaceDifferentMultiDataDisplayValue- Returns:
- A list of the original display values, if the user can select multiple values, and has chosen at least one value, otherwise it will return with
null
-
setSort
Sets if the combobox values appear sorted to the user. By default, the combobox values are sorted.- Parameters:
sort- Iftrue, the values will be sorted. Iffalse, the values will be in the order they were uploaded- Returns:
- The combobox component
-
setSort
Sets the sorting of the combobox values. The sorting can be specified by using a collator. By default, the values are sorted in an A-Z order.- Parameters:
sort- Iftrue, the values will be sorted. Iffalse, the values will be sorted in the upload ordercollator- The sorting collator object instance- Returns:
- The combobox component
- See Also:
-
setCollator
Sets the sorting collator- Parameters:
collator- The instance of the sorting collator- Returns:
- The combobox component
- See Also:
-
setDefaultValue
Sets the default value of the combobox- Specified by:
setDefaultValuein classFormItem<Object,ComboboxItem> - Parameters:
defaultValue- The default value. Must be the same data type as the data type of the combo box- Returns:
- The combobox component
-
getCriteria
Gets the criteria that is applied to the records that are in the combobox set of values- Specified by:
getCriteriain interfaceFilterable<ComboboxItem>- Returns:
- The filter criteria or
null, if none was set
-
fetchData
Fetches data- Specified by:
fetchDatain interfaceFetchable<ComboboxItem>- Specified by:
fetchDatain interfaceFilterable<ComboboxItem>- Returns:
- The component
- Throws:
UnsupportedOperationException- If no DataDescriptor was set
-
setFilterCriteria
Sets the criteria that is applied to the records that are in the combobox set of values- Specified by:
setFilterCriteriain interfaceFilterable<ComboboxItem>- Parameters:
criteria- Filter criterion used to query the data Ifnullis set, the previous filter criterion is deleted.- Returns:
- The combobox component
-
getDataCount
public int getDataCount()Gets the value's data count- Returns:
- The number of values. If none, it will be 0
-
setAutoFetchData
Sets if the data is automatically fetched from the database. By default, this is enabled- Specified by:
setAutoFetchDatain interfaceFetchable<ComboboxItem>- Specified by:
setAutoFetchDatain interfaceFilterable<ComboboxItem>- Parameters:
autoFetch- Iftrue, the data is fetched automatically. Iffalsea custom data fetch must be implemented, by calling thefetchData()method- Returns:
- The combobox component
-
isAutoFetchData
public boolean isAutoFetchData()Determines if the auto data fetch is enabled or not- Specified by:
isAutoFetchDatain interfaceFetchable<ComboboxItem>- Specified by:
isAutoFetchDatain interfaceFilterable<ComboboxItem>- Returns:
- If
true, it is enabled, otherwisefalse
-
afterDraw
public void afterDraw()Description copied from class:ComponentThe 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:
afterDrawin classFormItem<Object,ComboboxItem>
-
onShow
public void onShow()Description copied from class:ComponentThe 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:
onShowin classFormItem<Object,ComboboxItem>
-
isEnabled
public boolean isEnabled()Determines if the combobox is enabled on the interface or not.- Overrides:
isEnabledin classComponent<ComboboxItem>- Returns:
- If
true, it is enabled, otherwisefalse
-
isReadOnly
public boolean isReadOnly()Determines if the combobox is read only- Overrides:
isReadOnlyin classFormItem<Object,ComboboxItem> - Returns:
- If
true, the combobox is read only, otherwisefalse
-
setReadOnly
Sets the combobox to be read only for the user. By default, the user can modify the combobox.- Overrides:
setReadOnlyin classFormItem<Object,ComboboxItem> - Parameters:
readOnly- Iftrue, the combobox is read only, the user won't be able to modify the component's contents. Iffalse, the user can modify it- Returns:
- The combobox component
-
setEnabled
Sets the combobox to be enabled. By default, the combobox is enabled. If disabled, the user won't be able to use the combobox- Overrides:
setEnabledin classFormItem<Object,ComboboxItem> - Parameters:
enabled- Iftrue, the component is enabled and the user can use it. Iffalse, it is disabled- Returns:
- The combobox component
-
containsElement
Determines if the specified data value is among the combobox's values.- Parameters:
dataValue- The data value that is looked for- Returns:
- If
true, the specified value is in the combobox, otherwisefalse
-
close
Closes the combobox list- Returns:
- The combobox component
-
setExtendValues
If further data is to be stored in the relation table, it can be set using this parameter. Static values can be assigned to a relation table, by specifying the field name, then a "=" character, then the static value to be saved (Example: column=12 or column=ABC)
If the value is not static, a saved record's attribute can be used, by specifying the field name, followed by a "=" character, followed by the name of an attribute in the record: columnName=${recordAttributeName}. Values specified like this will be saved in every relation table. Multiple values can be specified, following the above mentioned formats, by separating the values with a "," character.- Specified by:
setExtendValuesin interfaceMultiValueFormItem<ComboboxItem>- Parameters:
extendValues- The extended values to be added to the table- Returns:
- The combobox component
-
getExtendValues
Gets the extended values from the relation table- Specified by:
getExtendValuesin interfaceMultiValueFormItem<ComboboxItem>- Returns:
- The values or
null, if not specified
-
setRequired
If set, the combobox has to be filled out by the user. This is recommended if the combobox is used on aFormcomponent If the combobox is not filled out, then the form will be invalid as it is not filled out properly. By default, the combobox is not required.- Overrides:
setRequiredin classFormItem<Object,ComboboxItem> - Parameters:
required- Iftrue, the combobox is required to be filled out.- Returns:
- The combobox component
-
getDataValues
Gets a list containing of the combobox's data values.- Returns:
- A list of the combobox's data values. If the combobox has none, then the list will be empty
-
setVisible
Sets if the component is visible on the interface. By default the component is visible.- Overrides:
setVisiblein classFormItem<Object,ComboboxItem> - Parameters:
visible- Iftrue, the combobox is visible. Iffalsethe combobox will be hidden, and the user cannot use it.- Returns:
- The combobox component
-
setValue
Sets the current value of the combobox.- Overrides:
setValuein classFormItem<Object,ComboboxItem> - Parameters:
value- Current value of the combobox- Returns:
- The combobox component
-
setCustomFetch
Sets a custom query. When calling the fetchData method, the specifiedFetchEventimplementation is called, then callback methods are run on records returned by theonFetchmethod.- 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:FetchableThis method implements actual data retrieval. TheFetchable.fetchData()function runs callback methods on the returned records.- Specified by:
fetchin interfaceFetchable<ComboboxItem>- 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
-