Class PasswordItem

All Implemented Interfaces:
Animatable<PasswordItem>, CanDrop<PasswordItem>, Clickable<PasswordItem>, SupportAppend<PasswordItem>, SupportHelpIcon<PasswordItem>, SupportPlaceholder<PasswordItem>, Draggable<PasswordItem>, Editable<PasswordItem>, Focusable<PasswordItem>, HandleHotKey<PasswordItem>, HandleKeyboardEvents<PasswordItem>, HandleMouseEvents<PasswordItem>, Scrollable<PasswordItem>, Touchable<PasswordItem>

Password item

Special input field used to enter passwords. Instead of every entered character, a dot is shown on the screen.

Supported events:

AnimationStart AnimationEnd, Focus FocusOut FocusIn LosesFocus copy cut EnterPressed input paste Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, KeyPress, KeyUp, KeyDown, Scrollable TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd HotKey

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

    • PasswordItem

      public PasswordItem(String name, String label)
      Creates an password field with the specified name and label.
      Parameters:
      name - Input field name
      label - Input field label If null is set, the field has no label.
      Throws:
      NullPointerException - Thrown if the specified name for the field is null
    • PasswordItem

      public PasswordItem(String name, String label, String language)
      Creates a password input field with the specified name, label and language code.
      Parameters:
      name - Input field name
      label - Input field label If null is set, the field has no label.
      language - The language code used to create the field If not specified or set to null, the field is created using the default language of the framework. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      Throws:
      NullPointerException - Thrown if the specified name for the field is null
    • PasswordItem

      public PasswordItem(DataDescriptorColumn column)

      Create a password entry field according to the specified DataDescriptor column.

      The method creates and sets a password input field based on the parameter-specified DataDescriptor column.

      The following parameters of the DataDescriptor column are used:
      • DataDescriptorColumn.getLength() - Text length is equal to the DataDescriptor column length
      • DataDescriptorColumn.getTitle - The field label is the one specified for the DataDescriptor 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.MASK - The mask specified here is set for the password input field
      • MetaParamName.PLACEHOLDER - Placeholder text to be used in the password 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 - If true is 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 - If false is set, the field is 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 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 input 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 based on which the field is created
      Throws:
      NullPointerException - Thrown if the parameter’s specified column is set to null
    • PasswordItem

      public PasswordItem(DataDescriptorColumn column, String language)

      Creates a password input field from the specified DataDescriptor column and language code.

      The method creates and sets a password input field based on the parameter-specified DataDescriptor column.

      The following parameters of the DataDescriptor are used:
      • DataDescriptorColumn.getLength() - Text length is equal to the DataDescriptor column length
      • DataDescriptorColumn.getTitle - The field label is the one specified for the DataDescriptor 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.MASK - The mask specified here is set for the password input field
      • MetaParamName.PLACEHOLDER - Placeholder text to be used in the password 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 - If true is 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 - If false is set, the field is 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 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 based on which the field is created
      language - The language code used to create the field * If not specified or set to null, the field is created using the default language of the framework. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
      Throws:
      NullPointerException - Thrown if the parameter’s specified column is set to null
  • Method Details

    • 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<String,PasswordItem>
      Parameters:
      writer - The HTML string writer class instance; write here the HTML code for the input field
    • setDefaultValue

      public PasswordItem setDefaultValue(Object defaultValue)
      Sets the default value of the field
      Specified by:
      setDefaultValue in class FormItem<String,PasswordItem>
      Parameters:
      defaultValue - The default value of the field
      Returns:
      Form item component