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

public abstract class FormItem<T,E extends Component<?>> extends Component<E> implements Focusable<E>

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 Details

    • value

      protected T value
    • defaultValue

      protected T defaultValue
    • originalValue

      protected T originalValue
    • column

      protected DataDescriptorColumn column
    • modified

      protected boolean modified
    • params

      protected Parameters params
    • label

      protected String label
    • clearButton

      protected boolean clearButton
    • description

      protected String description
    • helpIcon

      protected com.jbstrap.ui.components.form.FormItemHelp helpIcon
    • state

      protected FormItemState state
    • defaultState

      protected FormItemState defaultState
    • visible

      protected boolean visible
    • tabIndex

      protected int tabIndex
    • formItemSize

      protected FormItemSize formItemSize
    • labelPosition

      protected FormItemLabelPosition labelPosition
    • required

      protected boolean required
    • prepends

      protected final List<Object> prepends
    • appends

      protected final List<Object> appends
    • showLabel

      protected boolean showLabel
    • labelSizes

      protected Map<ScreenSize,Integer> labelSizes
  • Constructor Details

    • FormItem

      public FormItem(String name, String label, String language)
      Creates a form item.
      Parameters:
      name - Unique form item name
      label - Form item label
      language - Language code used to display the form item If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      Throws:
      NullPointerException - Thrown if the specified name is null
    • FormItem

      public FormItem(DataDescriptorColumn column, String language)

      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 column
      • DataDescriptorColumn.isNullable() - If the field gets a value of null, it is not designated as mandatory. If the field value is not set to null, it is designated as a mandatory field.
      • MetaParamName.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 - If true is set, the field is created as a read-only field. Otherwise, the field is created as writable and the user can freely modify its content.
      • MetaParamName.ENABLED - If false is specified, the field is created as disabled. Otherwise, the field is created as enabled.
      • MetaParamName.HELP - If this parameter is specified, an icon is displayed next to the input field and the text specified here appears as a help text if the user moves the mouse over it
      • MetaParamName.HELP_ICON - If an icon name is specified in the parameter, also listed in the enum Icon, the default help icon is changed to the icon.
      • MetaParamName.DESCRIPTION - The text specified here will appear below the field, in a smaller, italic font.
      • MetaParamName.TAB_INDEX - The value specified here determines the order of the input focus (when the user presses the Tab key). The smaller the value, 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 item
      language - Language code used to display the form item If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      Throws:
      NullPointerException - Thrown if the specified DataDescriptor column is set to null
  • Method Details

    • drawComponent

      protected String drawComponent(Component<?> component)
    • init

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

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

      Overrides:
      init in class Component<E extends Component<?>>
      Throws:
      JavaScriptLoadError - If there was a JavaScript error during the initialization.
    • setLabel

      public final E setLabel(String label)
      Sets the form element label text.
      Parameters:
      label - Form element label text
      Returns:
      Form element component
    • getLabel

      public final String 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

      public final E setLabelPosition(FormItemLabelPosition labelPosition)
      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 enum FormItemLabelPosition.
      Returns:
      Form element component
    • getLabelPosition

      public final FormItemLabelPosition 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 - If true, the value clear button is enabled and show, otherwise not enabled
    • setDataType

      protected void setDataType(Class<?> type)
      Parameters:
      type - The type of data edited in the component Specify a Java class that is listed in the enum JSDataType.
      Throws:
      NullPointerException - Thrown if the specified type is null
    • setDataType

      protected void setDataType(Object dataElement)
      Parameters:
      dataElement - The form item data element
    • getDataType

      protected JSDataType getDataType()
      Returns:
      The type of the edited data or null if the edited data type is not specified
    • getValue

      public T getValue()
      Gets the form item’s current value.
      Returns:
      Current value of the form item
    • getValueAsString

      public String getValueAsString()
      Gets the form item’s current value as String.
      Returns:
      Current value of the form item in String format
    • getValueAsDouble

      public Double 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 a Number
    • getValueAsInteger

      public Integer 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 a Number
    • getValueAsLong

      public Long 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 a Number
    • getValueAsFloat

      public Float 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 a Number
    • getValueAsDate

      public Date 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 a Date
    • getValueAsBoolean

      public Boolean 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 not Boolean
    • setValue

      public E setValue(T value)
      Sets the form item’s current value.
      Parameters:
      value - Current value of the form item
      Returns:
      Form item component
    • triggerFormChange

      protected E triggerFormChange()
      Returns:
      Form item component
    • convertValueToJavaScript

      protected String convertValueToJavaScript()
      Returns:
      The form item’s current value converted to a JavaScript value as String
    • convertValueToJavaScript

      protected String convertValueToJavaScript(Object value)
      Parameters:
      value - The original value
      Returns:
      The value converted to a JavaScript value as String
    • setOriginalValue

      public E setOriginalValue(T originalValue)
      Sets the form item’s original value to the specified value.
      Parameters:
      originalValue - The form item’s original value
      Returns:
      Form item component
    • getOriginalValue

      public T getOriginalValue()
      Gets the form item’s original value.
      Returns:
      The form item’s original value
    • addValueChangeHandler

      public final E addValueChangeHandler(ValueChangedHandler handler)
      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

      public DataDescriptorColumn 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

      public final E setFormItemSize(FormItemSize formItemSize)
      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 enum FormItemSize.
      Returns:
      Form item component
    • getFormItemSize

      public FormItemSize getFormItemSize()
      Gets form item size
      Returns:
      The form item size
    • setDefaultValue

      public abstract E setDefaultValue(Object defaultValue)
      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

      public E 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 becomes null. The displayed value on the interface is also updated to the current value.
      Returns:
      Form item component
    • eraseValue

      public final void eraseValue(BaseJBStrapEvent event)
      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

      protected E setModified(boolean modified)
      Parameters:
      modified - If true is set, the form item value is designated as “modified”, otherwise it is not considered modified
      Returns:
      Form item component
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This 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 with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<E extends Component<?>>
      Returns:
      If the componentwas drawn, true, otherwise false
    • isAssignable

      public boolean isAssignable(Object obj)
      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 not true, the value cannot be passed to the form item. If you pass the value to the form item, an error occurs.
    • setObjectValue

      public E setObjectValue(Object value)
      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

      public E setOriginalObjectValue(Object value)
      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

      public void onFormItemValueChanged(FormItemChangeEvent event)
      Parameters:
      event - Form item value change event handler
    • drawEditor

      protected abstract void drawEditor(StringWriter writer)

      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

      public final E setCalculateValue(CalculateColumnValue calculateMethod)

      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 the Form.

      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

      public final CalculateColumnValue getCalculateValue()
      Gets the form item value calculation code.
      Returns:
      Form item value calculation or null if not set
    • addRecalcOnChangeColumn

      public final E addRecalcOnChangeColumn(String columnName)

      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

      public final E addRecalcOnChangeColumns(String... columnNames)

      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

      public final E addRecalcOnChangeColumns(List<String> columnNames)

      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

      public final List<String> 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, otherwise false is set
    • setFocus

      public E setFocus()
      Sets the input focus to the form item. If the form item is not drawn on the interface, the method does nothing.
      Specified by:
      setFocus in interface Focusable<T>
      Returns:
      Form item component
    • setReadOnly

      public E setReadOnly(boolean readOnly)
      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 - If true is set, the form item is switched to read-only mode and the user is unable to modify the value. If false is set, the form item is switched to writable mode and the user is able to modify form item value.
      Returns:
      Form item component
    • setEnabled

      public E setEnabled(boolean enabled)
      Description copied from class: Component
      Sets the component to be enabled. Defaults to true
      Overrides:
      setEnabled in class Component<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. Otherwise false.
    • setRequired

      public E setRequired(boolean required)
      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 the Form component, the Form.isValid() method checks if the form item value is null. If null is set, the form state is not valid.
      Parameters:
      required - If true 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. Otherwise false.
    • afterDraw

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

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

      Overrides:
      afterDraw in class Component<E extends Component<?>>
    • onHotKeyEventHandler

      protected void onHotKeyEventHandler(HotKeyEvent event)
      Overrides:
      onHotKeyEventHandler in class Component<E extends Component<?>>
      Parameters:
      event - The event object
    • setShowLabel

      public final E setShowLabel(boolean showLabel)
      Sets if the form element label is displayed. By default, form element labels are displayed.
      Parameters:
      showLabel - If true, the form element label is displayed Otherwise, the label is not displayed.
      Returns:
      Form element component
    • isShowLabel

      public final boolean isShowLabel()
    • setState

      public E setState(FormItemState formItemState)
      Sets the form element state. By default, the form element is displayed in the FormItemState.DEFAULT state.
      Parameters:
      formItemState - Form item state Available states are listed in the enum FormItemState.
      Returns:
      Form element component
    • _setState

      protected E _setState(FormItemState state)
      Parameters:
      state - The new form item state
      Returns:
      The element component
    • resetState

      protected E resetState()
      Returns:
      The element component
    • getDefaultState

      protected FormItemState getDefaultState()
      Returns:
      The element component
    • setTabIndex

      public E setTabIndex(int tabIndex)
      Sets the form element tab index.
      Parameters:
      tabIndex - Form element tab index
      Returns:
      Form element component
    • setDescription

      public final E setDescription(String descriptionText)
      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. If null is set, the description is removed from the form element.
      Returns:
      Form element component
    • setParams

      public final E setParams(Parameters params)
      Sets or overwrites all parameters of the form element with the specified values.
      Parameters:
      params - The Parameters instance containing the parameters to be specified Previous parameters of the form element are overwritten with values specified here. If null is set, all form element parameters are deleted.
      Returns:
      Form element component
    • setParam

      public final E setParam(String name, Object value)
      Sets a parameter on the form element.
      Parameters:
      name - The name of the parameter to be set
      value - The value passed to the parameter
      Returns:
      Form element component
      Throws:
      NullPointerException - Thrown if the specified parameter name is null
    • removeParam

      public final E removeParam(String name)
      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 is null
    • getParam

      public final Object getParam(String name)
      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 is null
    • getParamAsString

      public final String getParamAsString(String name)
      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 is null
    • getParamAsNumber

      public final Number getParamAsNumber(String name)
      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 is null
      ParseException - Thrown if the specified text cannot be parsed
    • getParamAsLong

      public final Long getParamAsLong(String name)
      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 is null
      ParseException - Thrown if the specified text cannot be parsed
    • getParamAsInteger

      public final Integer getParamAsInteger(String name)
      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 is null
      ParseException - Thrown if the specified text cannot be parsed
    • getParamAsDouble

      public final Double getParamAsDouble(String name)
      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 is null
      ParseException - Thrown if the specified text cannot be parsed
    • getParamAsDate

      public final Date getParamAsDate(String name)
      Reads the specified parameter value as Date. If the specified parameter is not of the Date 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 is null
      ParseException - Thrown if the specified text cannot be parsed
    • getParamAsDate

      public final Date getParamAsDate(String name, String format)
      Reads the specified parameter value as Date. If the specified parameter is not of the Date 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
      format - 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 is null
      ParseException - Thrown if the specified text cannot be parsed
    • getParamAsBoolean

      public final Boolean getParamAsBoolean(String name)
      Reads the specified parameter value as Boolean. If a parameter is not Boolean, the framework attempts to convert it to boolean. The conversion yields true 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 is null
    • setVisible

      public E setVisible(boolean visible)
      Sets the visibility of the form element. By default, the form element is visible.
      Overrides:
      setVisible in class Component<E extends Component<?>>
      Parameters:
      visible - If true is set, the form element is displayed; if code>false is created, but not visible to the user
      Returns:
      Form element component
    • getName

      public final String getName()
      Gets the form element name.
      Overrides:
      getName in class Component<E extends Component<?>>
      Returns:
      Form element name
    • getState

      public final FormItemState getState()
      Gets the form element state.
      Returns:
      Form element state
    • isVisible

      public boolean isVisible()
      Checks if the form element is visible.
      Overrides:
      isVisible in class Component<E extends Component<?>>
      Returns:
      If true, the form element is visible, otherwise false
    • getDescription

      public String 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

      public E addComponent(Component<?> component)
      You cannot add further components to the form element component.
      Overrides:
      addComponent in class Component<E extends Component<?>>
      Parameters:
      component - The component to be added
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Thrown every time the method is called
    • _addComponent

      protected E _addComponent(Component<?> component)
      Parameters:
      component - The component to be added
      Returns:
      The form element component
    • runAfterDrawOnAddon

      protected final void runAfterDrawOnAddon(Component<?> addon)
    • runOnShowOnAddon

      protected final void runOnShowOnAddon(Component<?> addon)
    • runOnHideOnAddon

      protected final void runOnHideOnAddon(Component<?> addon)
    • getComponents

      public List<Component<?>> getComponents()
      Description copied from class: Component
      Gets every previously added subcomponent
      Overrides:
      getComponents in class Component<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

      public E setMargin(Margin... margins)
      Description copied from class: Component
      Component margin settings. The specified margin has the same type for all screens.
      Overrides:
      setMargin in class Component<E extends Component<?>>
      Parameters:
      margins - A list of component margins Available margins are listed in the Margin class.
      Returns:
      Component
    • setPadding

      public E setPadding(Padding... paddings)
      Description copied from class: Component
      Sets the component padding.
      Overrides:
      setPadding in class Component<E extends Component<?>>
      Parameters:
      paddings - A list of paddings to be added Available padding types are listed in the enum Padding.
      Returns:
      Component
    • onShow

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

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

      Overrides:
      onShow in class Component<E extends Component<?>>
    • setLabelSize

      public E setLabelSize(ScreenSize screenSize, int labelSize)
    • getLabelSize

      public Integer getLabelSize(ScreenSize screenSize)
    • setLabelSize

      public E setLabelSize(int labelSize)
    • getLabelSize

      public Integer getLabelSize()
    • _setReverseShow

      protected E _setReverseShow(boolean reverseShow)
      Invert display of input field
      Parameters:
      reverseShow - If true show reverse, otherwise show normal order
      Returns:
      The form item
    • isReverseShow

      protected boolean isReverseShow()
    • redraw

      public E 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.

      Overrides:
      redraw in class Component<E extends Component<?>>
      Returns:
      The component