Class HiddenItem

All Implemented Interfaces:
Focusable<HiddenItem>

public class HiddenItem extends FormItem<String,HiddenItem>

Hidden item

A hidden item is a special form item, that does not appear for the user, thus the user cannot modify it, but it is placed on the form. Hidden items are used if the form is sent in a POST request to an external servlet or there is a servlet in the application which is able to receive data this way. The value of the hidden item can be set through code.

If the form is saved to the database with the framework, the use of the hidden item is redundant.

The component supports no events.

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • HiddenItem

      public HiddenItem(String name)
      Creates an empty hidden item, with the specified name.
      Parameters:
      name - The name of the field
      Throws:
      NullPointerException - If the name is null
    • HiddenItem

      public HiddenItem(String name, String value)
      Creates a hidden item, with the specified name and value.
      Parameters:
      name - The name of the field
      value - The value of the item
      Throws:
      NullPointerException - If the name is null
    • HiddenItem

      public HiddenItem(DataDescriptorColumn column)
      Creates a hidden item, based on the specified DataDescriptor column.
      Parameters:
      column - The DataDescriptor column, that will be used for the operation
      Throws:
      NullPointerException - If the column is null
    • HiddenItem

      public HiddenItem(DataDescriptorColumn column, String value)
      Creates a hidden item, based on the specified DataDescriptor column, with the specified value
      Parameters:
      column - The DataDescriptor column, that will be used for the operation
      value - The hidden item value
      Throws:
      NullPointerException - If the column is 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,HiddenItem>
      Parameters:
      writer - The HTML string writer class instance; write here the HTML code for the input field
    • setDefaultValue

      public HiddenItem setDefaultValue(Object defaultValue)
      Sets the default value of the item
      Specified by:
      setDefaultValue in class FormItem<String,HiddenItem>
      Parameters:
      defaultValue - The default value
      Returns:
      The hidden item component
    • setVisible

      public HiddenItem setVisible(boolean visible)
      This method does nothing, since the item is not visible on the interface
      Overrides:
      setVisible in class FormItem<String,HiddenItem>
      Parameters:
      visible - If true is set, the form element is displayed; if code>false is created, but not visible to the user
      Returns:
      The hidden item component