Class StaticTextItem

All Implemented Interfaces:
Animatable<StaticTextItem>, CanDrop<StaticTextItem>, Clickable<StaticTextItem>, StaticFormItem, SupportHelpIcon<StaticTextItem>, Draggable<StaticTextItem>, Focusable<StaticTextItem>, HandleHotKey<StaticTextItem>, HandleMouseEvents<StaticTextItem>, Touchable<StaticTextItem>

Static text form item component

The static text item is a special form item, that cannot have its value changed by the user. It looks like standard text on the interface, but it has every attribute of a form item. The Form component handles this static text item component completely.

Supported events:

AnimationStart AnimationEnd, Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd HotKey

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

    • StaticTextItem

      public StaticTextItem(String name, String label)
      Creates a static text form item, with the specified name and label
      Parameters:
      name - The form item name
      label - The form item label. If null, the item won't have one.
      Throws:
      NullPointerException - If the name is null
    • StaticTextItem

      public StaticTextItem(String name, String label, String language)
      Creates a static text form item, with the specified name and label, with the specified language code.
      Parameters:
      name - The form item name
      label - The form item label. If null, the item won't have one.
      language - The language code, that the form item will use. If not specified, or null, the framework will use the default language. The default language can be set with the JBStrapParamType.DEFAULT_LANGUAGE JBStrap parameter.
      Throws:
      NullPointerException - If the name is null
    • StaticTextItem

      public StaticTextItem(DataDescriptorColumn column)

      Creates a form item, based on the specified DataDescriptor column.

      The method creates and sets the static form item, based on the DataDescriptor column, specified in the parameters. The following parameters from the DataDescriptor column are used:

      • DataDescriptorColumn.getTitle - The title set in the DataDescriptor column will be used by the input field as its label.
      • DataDescriptorColumn.isNullable() - If the field can a null value, the field will be marked as not mandatory. If it cannot have a null value, the field will be marked as mandatory.
      • MetaParamName.SIZE - The value specified here defines the size of the input field. (Applicable values: SMALL, MEDIUM, LARGE)
      • MetaParamName.STATE - The value specified here defines the state of the input field. (Applicable values: DEFAULT, ERROR, WARNING, SUCCESS, INFO)
      • MetaParamName.DEFAULT_VALUE - The value specified here defines the field's default value. The value must have the type of field, in this case, it must be a text value.
      • MetaParamName.ENABLED - If false, the field will be disabled (it will be created in an unusable state.) Otherwise, the field will be enabled when created.
      • MetaParamName.HELP - If the parameter is specified, an icon will be displayed next to the field. If the user moves over the icon, the text specified here will be displayed, as a help text.
      • MetaParamName.HELP_ICON - If the icon name is specified (from the Icon enum), then this icon will replace the default "?" icon.
      • MetaParamName.DESCRIPTION - The text specified here will appear below the field, in a smaller, italic font.

      Parameters:
      column - The DataDescriptor column, that will be used as a basis for the form item.
      Throws:
      NullPointerException - If the column was specified as null
    • StaticTextItem

      public StaticTextItem(DataDescriptorColumn column, String language)

      Creates a form item, based on the specified DataDescriptor column and using the specified language code.

      The method creates and sets the static form item, based on the DataDescriptor column, specified in the parameters. The following parameters from the DataDescriptor column are used:

      • DataDescriptorColumn.getTitle - The title set in the DataDescriptor column will be used by the input field as its label.
      • DataDescriptorColumn.isNullable() - If the field can a null value, the field will be marked as not mandatory. If it cannot have a null value, the field will be marked as mandatory.
      • MetaParamName.SIZE - The value specified here defines the size of the input field. (Applicable values: SMALL, MEDIUM, LARGE)
      • MetaParamName.STATE - The value specified here defines the state of the input field. (Applicable values: DEFAULT, ERROR, WARNING, SUCCESS, INFO)
      • MetaParamName.DEFAULT_VALUE - The value specified here defines the field's default value. The value must have the type of field, in this case, it must be a text value.
      • MetaParamName.ENABLED - If false, the field will be disabled (it will be created in an unusable state.) Otherwise, the field will be enabled when created.
      • MetaParamName.HELP - If the parameter is specified, an icon will be displayed next to the field. If the user moves over the icon, the text specified here will be displayed, as a help text.
      • MetaParamName.HELP_ICON - If the icon name is specified (from the Icon enum), then this icon will replace the default "?" icon.
      • MetaParamName.DESCRIPTION - The text specified here will appear below the field, in a smaller, italic font.

      Parameters:
      column - The DataDescriptor column, that will be used as a basis for the form item.
      language - The language code, that the form item will use. If not specified, or null, the framework will use the default language. The default language can be set with the JBStrapParamType.DEFAULT_LANGUAGE JBStrap parameter.
      Throws:
      NullPointerException - If the column was specified as null
  • Method Details

    • setValue

      public StaticTextItem setValue(Object value)
      Sets the value of the form item. The value set here will be displayed on the component as a text value
      Overrides:
      setValue in class FormItem<Object,StaticTextItem>
      Parameters:
      value - The component value
      Returns:
      The static text item
    • drawEditor

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

      Draws the editor component.

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

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

      public StaticTextItem setDefaultValue(Object defaultValue)
      Sets the default value of the static text item.
      Specified by:
      setDefaultValue in class FormItem<Object,StaticTextItem>
      Parameters:
      defaultValue - The default value of the static text item.
      Returns:
      The static text component