Class FormItem<T,E extends Component<?>>
- All Implemented Interfaces:
Focusable<E>
- Direct Known Subclasses:
CheckboxItem
,ColorPicker
,ComboboxItem
,DatePicker
,DateRangePicker
,DualListBox
,FileItem
,HiddenItem
,IntegerItem
,NumberItem
,NumberRangeFilter
,PasswordItem
,RadioButtonItem
,SelectorItem
,StaticTextItem
,SwitchItem
,TextItem
Ancestor class for data modifier form items in the Form
component.
All classes used for data modification must extend this class.
The data modifiers in this class can only modify data for only one component at a time.
Form items are standalone components to be used as input fields or as part of a Form
to modify an entire record.
The form item modifies only one item of the record. Separate form item components are created for each record attribute.
This ancestor class ensures the basic data management methods and events.
Supported events:
Focus
FocusOut
FocusIn
LosesFocus
ValueChanged
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected DataDescriptorColumn
protected FormItemState
protected T
protected String
protected FormItemSize
protected com.jbstrap.ui.components.form.FormItemHelp
protected String
protected FormItemLabelPosition
protected Map<ScreenSize,
Integer> protected boolean
protected T
protected Parameters
protected boolean
protected boolean
protected FormItemState
protected int
protected T
protected boolean
Fields inherited from class com.jbstrap.ui.Component
animation, attributes, backgroundColor, borderColor, color, defaultHotKeyHandler, handlers, hotKeys, styleClasses, textAlign, toolTip, toolTipPosition
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected E
_addComponent
(Component<?> component) protected E
_setReverseShow
(boolean reverseShow) Invert display of input fieldprotected E
_setState
(FormItemState state) addComponent
(Component<?> component) You cannot add further components to the form element component.final E
addRecalcOnChangeColumn
(String columnName) Specifies a field.final E
addRecalcOnChangeColumns
(String... columnNames) Specifies one or several fields.final E
addRecalcOnChangeColumns
(List<String> columnNames) Specifies one or several fields.final E
addValueChangeHandler
(ValueChangedHandler handler) Adds an event handler to the form item’s current value eventvoid
The operations to be executed after the drawing of the componentDeletes the form item value.protected String
protected String
convertValueToJavaScript
(Object value) protected String
drawComponent
(Component<?> component) protected abstract void
drawEditor
(StringWriter writer) Draws the editor component.protected void
enableClearButton
(boolean enable) final void
eraseValue
(BaseJBStrapEvent event) final CalculateColumnValue
Gets the form item value calculation code.Gets the DataDescriptor column name used to build the form item.Gets every previously added subcomponentprotected JSDataType
protected FormItemState
Gets the form element description.Gets form item sizefinal String
getLabel()
Gets the form element label text.final FormItemLabelPosition
Sets the position of the form element label relative to the input field position.getLabelSize
(ScreenSize screenSize) final String
getName()
Gets the form element name.Gets the form item’s original value.final Object
Reads the parameter value from the form element component.final Boolean
getParamAsBoolean
(String name) Reads the specified parameter value as Boolean.final Date
getParamAsDate
(String name) Reads the specified parameter value as Date.final Date
getParamAsDate
(String name, String format) Reads the specified parameter value as Date.final Double
getParamAsDouble
(String name) Reads the specified parameter’s value as Double.final Integer
getParamAsInteger
(String name) Reads the specified parameter’s value as Integer.final Long
getParamAsLong
(String name) Reads the specified parameter’s value as Long.final Number
getParamAsNumber
(String name) Reads the specified parameter’s value as Number.final String
getParamAsString
(String name) Reads the specified parameter’s value as String.Gets the names of all fields whose value change trigger a from item recalculation.final FormItemState
getState()
Gets the form element state.int
Gets the form element tab index.getValue()
Gets the form item’s current value.Gets the form item’s current value as Boolean.Gets the form item’s current value as Date.Gets the form item’s current value as Double.Gets the form item’s current value as Float.Gets the form item’s current value as Integer.Gets the form item’s current value as Long.Gets the form item’s current value as String.void
init()
The component initialization method.boolean
isAssignable
(Object obj) Checks if the specified parameter value can be set as a form item value.final boolean
Checks if the form item value is automatically calculated.boolean
Checks if the form item value was modified.boolean
Checks if the form item is in read-only mode.final boolean
Checks if the form item value is mandatory.protected boolean
final boolean
boolean
Checks if the form element is visible.void
protected void
onHotKeyEventHandler
(HotKeyEvent event) void
onShow()
The operations to be executed after the component is displayed on the clientredraw()
Redraws the component.final E
removeParam
(String name) Removes a parameter from the form element.protected E
protected final void
runAfterDrawOnAddon
(Component<?> addon) protected final void
runOnHideOnAddon
(Component<?> addon) protected final void
runOnShowOnAddon
(Component<?> addon) final E
setCalculateValue
(CalculateColumnValue calculateMethod) Adds form item calculation code to the component.protected void
setDataType
(Class<?> type) protected void
setDataType
(Object dataElement) abstract E
setDefaultValue
(Object defaultValue) Sets the form item’s default value.final E
setDescription
(String descriptionText) Sets the form element description.setEnabled
(boolean enabled) Sets the component to be enabled.setFocus()
Sets the input focus to the form item.final E
setFormItemSize
(FormItemSize formItemSize) Sets the form item size.final E
Sets the form element label text.final E
setLabelPosition
(FormItemLabelPosition labelPosition) Sets the position of the form element label relative to the input field position.setLabelSize
(int labelSize) setLabelSize
(ScreenSize screenSize, int labelSize) Component margin settings.protected E
setModified
(boolean modified) setObjectValue
(Object value) Sets the form item’s current value using the object in the parameter.setOriginalObjectValue
(Object value) Sets the form item’s original value using the object in the parameter.setOriginalValue
(T originalValue) Sets the form item’s original value to the specified value.setPadding
(Padding... paddings) Sets the component padding.final E
Sets a parameter on the form element.final E
setParams
(Parameters params) Sets or overwrites all parameters of the form element with the specified values.setReadOnly
(boolean readOnly) Sets the form item to read-only mode.setRequired
(boolean required) Sets if it is mandatory to specify the form item value.final E
setShowLabel
(boolean showLabel) Sets if the form element label is displayed.setState
(FormItemState formItemState) Sets the form element state.setTabIndex
(int tabIndex) Sets the form element tab index.Sets the form item’s current value.setVisible
(boolean visible) Sets the visibility of the form element.protected E
boolean
writeHTML
(StringWriter writer) Creates the component's HTML equivalentMethods 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, isEnabled, 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.Focusable
addFocusHandler, addFocusInHandler, addFocusOutHandler, addLosesFocusHandler
-
Field Details
-
value
-
defaultValue
-
originalValue
-
column
-
modified
protected boolean modified -
params
-
label
-
clearButton
protected boolean clearButton -
description
-
helpIcon
protected com.jbstrap.ui.components.form.FormItemHelp helpIcon -
state
-
defaultState
-
visible
protected boolean visible -
tabIndex
protected int tabIndex -
formItemSize
-
labelPosition
-
required
protected boolean required -
prepends
-
appends
-
showLabel
protected boolean showLabel -
labelSizes
-
-
Constructor Details
-
FormItem
Creates a form item.- Parameters:
name
- Unique form item namelabel
- Form item labellanguage
- Language code used to display the form item 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
-
FormItem
Builds a form item using the specified DataDescriptor column.
The method creates and sets the component from the parameter-specified DataDescriptor column. The following parameters of the DataDescriptor column are used:
DataDescriptorColumn.getTitle
- Input field label set using the DataDescriptore 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.PLACEHOLDER
- Placeholder text to be used in 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: SMALL, MEDIUM, LARGE)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, 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 instance used to build the form itemlanguage
- Language code used to display the form item 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 DataDescriptor column is set tonull
-
-
Method Details
-
drawComponent
-
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 classComponent<E extends Component<?>>
- Throws:
JavaScriptLoadError
- If there was a JavaScript error during the initialization.
-
setLabel
Sets the form element label text.- Parameters:
label
- Form element label text- Returns:
- Form element component
-
getLabel
Gets the form element label text.- Returns:
- The form element label text or
null
if there is no label text defined for the form element
-
setLabelPosition
Sets the position of the form element label relative to the input field position. By default, the label is displayed before (FormItemLabelPosition.LEFT
) the input field.- Parameters:
labelPosition
- Displayed label position Available positions are listed in the enumFormItemLabelPosition
.- Returns:
- Form element component
-
getLabelPosition
Sets the position of the form element label relative to the input field position.- Returns:
- Displayed label position
-
enableClearButton
protected void enableClearButton(boolean enable) - Parameters:
enable
- Iftrue
, the value clear button is enabled and show, otherwise not enabled
-
setDataType
- Parameters:
type
- The type of data edited in the component Specify a Java class that is listed in the enumJSDataType
.- Throws:
NullPointerException
- Thrown if the specified type isnull
-
setDataType
- Parameters:
dataElement
- The form item data element
-
getDataType
- Returns:
- The type of the edited data or
null
if the edited data type is not specified
-
getValue
Gets the form item’s current value.- Returns:
- Current value of the form item
-
getValueAsString
Gets the form item’s current value as String.- Returns:
- Current value of the form item in String format
-
getValueAsDouble
Gets the form item’s current value as Double.- Returns:
- The current value of the form item in Double format or
null
if the data edited is not aNumber
-
getValueAsInteger
Gets the form item’s current value as Integer.- Returns:
- The current value of the form item in Integer format or
null
if the data edited is not aNumber
-
getValueAsLong
Gets the form item’s current value as Long.- Returns:
- The current value of the form item in Long format or
null
if the data edited is not aNumber
-
getValueAsFloat
Gets the form item’s current value as Float.- Returns:
- The current value of the form item in Float format or
null
if the data edited is not aNumber
-
getValueAsDate
Gets the form item’s current value as Date.- Returns:
- The current value of the form item as Date or
null
if the data edited is not aDate
-
getValueAsBoolean
Gets the form item’s current value as Boolean.- Returns:
- The current value of the form item as Boolean or
null
if the data edited is notBoolean
-
setValue
Sets the form item’s current value.- Parameters:
value
- Current value of the form item- Returns:
- Form item component
-
triggerFormChange
- Returns:
- Form item component
-
convertValueToJavaScript
- Returns:
- The form item’s current value converted to a JavaScript value as String
-
convertValueToJavaScript
- Parameters:
value
- The original value- Returns:
- The value converted to a JavaScript value as String
-
setOriginalValue
Sets the form item’s original value to the specified value.- Parameters:
originalValue
- The form item’s original value- Returns:
- Form item component
-
getOriginalValue
Gets the form item’s original value.- Returns:
- The form item’s original value
-
addValueChangeHandler
Adds an event handler to the form item’s current value event- Parameters:
handler
- Event handler for the form item’s current value event- Returns:
- Form item component
- See Also:
-
getColumn
Gets the DataDescriptor column name used to build the form item.- Returns:
- The DataDescriptor column instance used to build the form item or
null
if the form item was built not using a DataDescriptor column
-
setFormItemSize
Sets the form item size. By default, the form item is displayed in a default size (FormItemSize.DEFAULT
).- Parameters:
formItemSize
- Form item size Available sizes are listed in the enumFormItemSize
.- Returns:
- Form item component
-
getFormItemSize
Gets form item size- Returns:
- The form item size
-
setDefaultValue
Sets the form item’s default value. By default, the form item does not have a default value.- Parameters:
defaultValue
- Form item default value- Returns:
- Form item component
-
clearValue
Deletes the form item value. If the form item value is deleted, the form item’s current value is reset to default. If the form item has no default value, the current value becomesnull
. The displayed value on the interface is also updated to the current value.- Returns:
- Form item component
-
eraseValue
- Parameters:
event
- The event object
-
isModified
public boolean isModified()Checks if the form item value was modified. If the form item value modification was made on the interface, the value is designated as “modified”. If the form item value is deleted, the value is designated as “not modified”.- Returns:
- If
true
, the form item value has been modified by the user. Otherwise,false
is set.
-
setModified
- Parameters:
modified
- Iftrue
is set, the form item value is designated as “modified”, otherwise it is not considered modified- Returns:
- Form item component
-
writeHTML
Description copied from class:Component
Creates the component's HTML equivalentThis method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (
StringWriter
class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return withfalse
. Otherwise, it must return withtrue
. -
isAssignable
Checks if the specified parameter value can be set as a form item value.- Parameters:
obj
- The value to be checked- Returns:
- If
true
, the value can be passed to the form item If @param obj is nottrue
, the value cannot be passed to the form item. If you pass the value to the form item, an error occurs.
-
setObjectValue
Sets the form item’s current value using the object in the parameter.- Parameters:
value
- The object whose value is passed to the form item- Returns:
- Form item component
- Throws:
ClassCastException
- Thrown if the specified object cannot be cast to the current editor type
-
setOriginalObjectValue
Sets the form item’s original value using the object in the parameter.- Parameters:
value
- The object whose value is passed to the form item as an original value- Returns:
- Form item component
- Throws:
ClassCastException
- Thrown if the specified object cannot be cast to the current editor type
-
onFormItemValueChanged
- Parameters:
event
- Form item value change event handler
-
drawEditor
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.
- Parameters:
writer
- The HTML string writer class instance; write here the HTML code for the input field
-
setCalculateValue
Adds form item calculation code to the component.
If a calculation method is added to the form item, the result of the calculation is automatically set as the component’s current value. You are able to recalculate the value for an other field as well. To do this, add a single or multiple field names to the form item. These fields are assigned to the form item by using the
addRecalcOnChangeColumn(String)
method. Value recalculation is automatically performed by the framework if the current form item and the form item whose value is to be recalculated are both placed inside theForm
.If the form item is not placed inside the
Form
or a field not on the form is specified, the automatic recalculation is not performed.- Parameters:
calculateMethod
- Implementation of the form item value calculation- Returns:
- Form item component
-
getCalculateValue
Gets the form item value calculation code.- Returns:
- Form item value calculation or
null
if not set
-
addRecalcOnChangeColumn
Specifies a field. If the field value changes, the form item value must be recalculated.
Use this method only if a calculation method was set for the form item using the
setCalculateValue(CalculateColumnValue)
method. If no calculation method is set, the current setting does not work.If the input field in the parameter is not displayed using the current form item component, the current form item value is recalculated. If the specified input field is not on the form of the current form item, or the form item is not in the
Form
component, the setting takes no effect and no recalculation is performed.- Parameters:
columnName
- Field name; when the field value changes, the form item value must be recalculated- Returns:
- Form item component
-
addRecalcOnChangeColumns
Specifies one or several fields. Form item values must be recalculated upon field value change.
Use this method only if a calculation method was set for the form item using the
setCalculateValue(CalculateColumnValue)
method. If no calculation method is defined, the current setting will not work.If the field specified in the parameter is displayed on the current form item component, the current form item is recalculated upon any field change. If the specified input field is not on the form of the current form item, or the form item is not in the
Form
component, the setting takes no effect and no recalculation is performed.- Parameters:
columnNames
- An enumeration of all field names whose change trigger a recalculation of the current form item- Returns:
- Form item component
-
addRecalcOnChangeColumns
Specifies one or several fields. Form item values must be recalculated upon field value change.
Use this method only if a calculation method was set for the form item using the
setCalculateValue(CalculateColumnValue)
method. If there is no calculation method set for the form item, the current setting will not work.If the field in the parameter is displayed by the current form item on the form, the form item is recalculated upon any value change. If the specified input field is not on the form of the current form item, or the form item is not in the
Form
component, the setting takes no effect and no recalculation is performed.- Parameters:
columnNames
- An enumeration of all field names whose change trigger a recalculation of the current form item- Returns:
- Form item component
-
getRecalcOnChangeColumnsList
Gets the names of all fields whose value change trigger a from item recalculation.- Returns:
- A list of all fields which trigger a form item recalculation. If no such field is passed to the form item, the returned list is empty.
-
isAutoCalculate
public final boolean isAutoCalculate()Checks if the form item value is automatically calculated.- Returns:
- If
true
is set, the form item value is calculated, otherwisefalse
is set
-
setFocus
Sets the input focus to the form item. If the form item is not drawn on the interface, the method does nothing. -
setReadOnly
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.- 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
-
setEnabled
Description copied from class:Component
Sets the component to be enabled. Defaults totrue
- Overrides:
setEnabled
in classComponent<E extends Component<?>>
- Parameters:
enabled
-true
, the component is enabled, otherwise it's disabled- Returns:
- The component
-
isReadOnly
public boolean isReadOnly()Checks if the form item is in read-only mode.- Returns:
- If
true
is set, the form item is in read-only mode and the user cannot modify its content. Otherwisefalse
.
-
setRequired
Sets if it is mandatory to specify the form item value. By default, it is not mandatory to specify the form item value. By setting it mandatory to specify a value, an asterisk is displayed on the form item label. This means that it is mandatory to specify a value. If the form item is in theForm
component, theForm.isValid()
method checks if the form item value isnull
. Ifnull
is set, the form state is not valid.- Parameters:
required
- Iftrue
is set, it is mandatory to specify the form item.- Returns:
- Form item component
-
isRequired
public final boolean isRequired()Checks if the form item value is mandatory.- Returns:
- If
true
, the form item is set as mandatory. Otherwisefalse
.
-
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.
-
onHotKeyEventHandler
- Overrides:
onHotKeyEventHandler
in classComponent<E extends Component<?>>
- Parameters:
event
- The event object
-
setShowLabel
Sets if the form element label is displayed. By default, form element labels are displayed.- Parameters:
showLabel
- Iftrue
, the form element label is displayed Otherwise, the label is not displayed.- Returns:
- Form element component
-
isShowLabel
public final boolean isShowLabel() -
setState
Sets the form element state. By default, the form element is displayed in theFormItemState.DEFAULT
state.- Parameters:
formItemState
- Form item state Available states are listed in the enumFormItemState
.- Returns:
- Form element component
-
_setState
- Parameters:
state
- The new form item state- Returns:
- The element component
-
resetState
- Returns:
- The element component
-
getDefaultState
- Returns:
- The element component
-
setTabIndex
Sets the form element tab index.- Parameters:
tabIndex
- Form element tab index- Returns:
- Form element component
-
setDescription
Sets the form element description. By default, the form item does not have a description. If a description is set, it is displayed below the input field.- Parameters:
descriptionText
- Form element description You can use any HTML tags in the text. Ifnull
is set, the description is removed from the form element.- Returns:
- Form element component
-
setParams
Sets or overwrites all parameters of the form element with the specified values.- Parameters:
params
- TheParameters
instance containing the parameters to be specified Previous parameters of the form element are overwritten with values specified here. Ifnull
is set, all form element parameters are deleted.- Returns:
- Form element component
-
setParam
Sets a parameter on the form element.- Parameters:
name
- The name of the parameter to be setvalue
- The value passed to the parameter- Returns:
- Form element component
- Throws:
NullPointerException
- Thrown if the specified parameter name isnull
-
removeParam
Removes a parameter from the form element.- Parameters:
name
- The name of the parameter to be removed from the form element- Returns:
- Form element component
- Throws:
NullPointerException
- Thrown if the specified parameter name isnull
-
getParam
Reads the parameter value from the form element component.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value or
null
if there is no parameter on the form element by that name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
-
getParamAsString
Reads the specified parameter’s value as String.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value as String or
null
if there is no parameter in the form element by the specified name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
-
getParamAsNumber
Reads the specified parameter’s value as Number.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value in Number format or
null
if there is no parameter in the form element by that name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
ParseException
- Thrown if the specified text cannot be parsed
-
getParamAsLong
Reads the specified parameter’s value as Long.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value as Long or
null
if there is no parameter in the form element by that name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
ParseException
- Thrown if the specified text cannot be parsed
-
getParamAsInteger
Reads the specified parameter’s value as Integer.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value in Integer format or
null
if there is no parameter in the form element by the specified name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
ParseException
- Thrown if the specified text cannot be parsed
-
getParamAsDouble
Reads the specified parameter’s value as Double.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value as Double or
null
if there is no parameter in the form element by the specified name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
ParseException
- Thrown if the specified text cannot be parsed
-
getParamAsDate
Reads the specified parameter value as Date. If the specified parameter is not of theDate
type, the framework attempts to convert it to Date using the following format: "yyyy-MM-dd HH:mm:ss”.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value in Date format or
null
if there is no parameter in the form element by the specified name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
ParseException
- Thrown if the specified text cannot be parsed
-
getParamAsDate
Reads the specified parameter value as Date. If the specified parameter is not of theDate
type, the framework attempts to convert it to Date using the following format: "yyyy-MM-dd HH:mm:ss”.- Parameters:
name
- The name of the parameter whose value is read from the form elementformat
- The format to be used- Returns:
- The specified parameter’s value as Date or
null
if there is no parameter in the form element by the specified name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
ParseException
- Thrown if the specified text cannot be parsed
-
getParamAsBoolean
Reads the specified parameter value as Boolean. If a parameter is notBoolean
, the framework attempts to convert it to boolean. The conversion yieldstrue
only if the specified parameter text is “true”. The match is case sensitive.- Parameters:
name
- The name of the parameter whose value is read from the form element- Returns:
- The specified parameter’s value as boolean or
null
if there is no parameter in the form element by the specified name - Throws:
NullPointerException
- Thrown if the specified parameter name isnull
-
setVisible
Sets the visibility of the form element. By default, the form element is visible.- Overrides:
setVisible
in classComponent<E extends Component<?>>
- Parameters:
visible
- Iftrue
is set, the form element is displayed; if code>false is created, but not visible to the user- Returns:
- Form element component
-
getName
Gets the form element name. -
getState
Gets the form element state.- Returns:
- Form element state
-
isVisible
public boolean isVisible()Checks if the form element is visible. -
getDescription
Gets the form element description.- Returns:
- The form element description or
null
if there is no description defined for the form element
-
getTabIndex
public int getTabIndex()Gets the form element tab index.- Returns:
- Form element tab index If no tab index has been assigned to the form element, 0 is returned.
-
addComponent
You cannot add further components to the form element component.- Overrides:
addComponent
in classComponent<E extends Component<?>>
- Parameters:
component
- The component to be added- Returns:
- The component
- Throws:
UnsupportedOperationException
- Thrown every time the method is called
-
_addComponent
- Parameters:
component
- The component to be added- Returns:
- The form element component
-
runAfterDrawOnAddon
-
runOnShowOnAddon
-
runOnHideOnAddon
-
getComponents
Description copied from class:Component
Gets every previously added subcomponent- Overrides:
getComponents
in classComponent<E extends Component<?>>
- Returns:
- A collection of every subcomponent that was added to the component. If there are none, the collection will be empty
-
setMargin
Description copied from class:Component
Component margin settings. The specified margin has the same type for all screens. -
setPadding
Description copied from class:Component
Sets the component padding.- Overrides:
setPadding
in classComponent<E extends Component<?>>
- Parameters:
paddings
- A list of paddings to be added Available padding types are listed in the enumPadding
.- Returns:
- Component
-
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.
-
setLabelSize
-
getLabelSize
-
setLabelSize
-
getLabelSize
-
_setReverseShow
Invert display of input field- Parameters:
reverseShow
- Iftrue
show reverse, otherwise show normal order- Returns:
- The form item
-
isReverseShow
protected boolean isReverseShow() -
redraw
Description copied from class:Component
Redraws the component.All changes on the components, (even after drawing) are applied automatically. So for this reason, the components don't have to be redrawn. However, sometimes it is necessary to redraw the entire component. If this method is used, the component and all of its subcomponents will be re-sent to the client-side and the components will be re-initialized, a process that can take a significant amount of time, not to mention burden the communication channels. The use of this method for these reasons is not recommended.
-