net.sf.okapi.common.uidescription

## Class TextInputPart

- java.lang.Object
- - net.sf.okapi.common.uidescription.AbstractPart
  - - net.sf.okapi.common.uidescription.TextInputPart

- All Implemented Interfaces:
    IParameterDescriptor

      public class TextInputPart
      extends AbstractPart

  UI part descriptor for a text input field. This UI part supports the following types: Integer and String.

  Use `setAllowEmpty(boolean)` to specify if the text can be empty. by default empty text is not allowed.

  Use `setPassword(boolean)` to specify if the text should be treated as a password text (e.g. hidden on input). By default the text is not treated as a password.

  Use `setHeight(int)` to specify a height for the field (-1 sets the default).

- - ### Field Summary

    - ### Fields inherited from class net.sf.okapi.common.uidescription.AbstractPart

      `container, enabledOnSelection, labelFlushed, labelNextToInput, masterPart, paramDescriptor, vertical, withLabel`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextInputPart(ParameterDescriptor paramDescriptor)` Creates a new TextInputPart object with a given parameter descriptor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkType()` Checks the types supported by this UI part.
    `int` | `getHeight()` Gets the suggested height of this part (-1 for default)
    `int` | `getMaximumValue()` Gets the maximum value allowed (for integer input).
    `int` | `getMinimumValue()` Gets the minimum value allowed (for integer input).
    `boolean` | `isAllowEmpty()` Indicates if the input text can be empty.
    `boolean` | `isPassword()` Indicates if the input text should be treated like a password.
    `void` | `setAllowEmpty(boolean allowEmpty)` Sets the flag indicating if the input text can be empty.
    `void` | `setHeight(int height)` Sets the suggested height of this part (-1 for default)
    `void` | `setPassword(boolean password)` Sets the flag indicating if the input text should be treated like a password.
    `void` | `setRange(int minimumValue, int maximumValue)` Sets the minimum and maximum values allowed (for integer input).

    - ### Methods inherited from class net.sf.okapi.common.uidescription.AbstractPart

      `getContainer, getDisplayName, getMasterPart, getName, getParent, getReadMethod, getShortDescription, getType, getWriteMethod, isEnabledOnSelection, isLabelFlushed, isLabelNextToInput, isVertical, isWithLabel, setContainer, setDisplayName, setLabelFlushed, setLabelNextToInput, setMasterPart, setShortDescription, setVertical, setWithLabel`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TextInputPart

          public TextInputPart(ParameterDescriptor paramDescriptor)

      Creates a new TextInputPart object with a given parameter descriptor.
      Parameters:
        `paramDescriptor` - the parameter descriptor for this UI part.

  - ### Method Detail

    - #### checkType

          protected void checkType()

      Description copied from class: `AbstractPart`
      Checks the types supported by this UI part.
      Overrides:
        `checkType` in class `AbstractPart`

    - #### isAllowEmpty

          public boolean isAllowEmpty()

      Indicates if the input text can be empty.
      Returns:
        true if the input text can be empty, false otherwise.

    - #### setAllowEmpty

          public void setAllowEmpty(boolean allowEmpty)

      Sets the flag indicating if the input text can be empty.
      Parameters:
        `allowEmpty` - true if the input text can be empty, false otherwise.

    - #### isPassword

          public boolean isPassword()

      Indicates if the input text should be treated like a password.
      Returns:
        true if the input text can be should be treated like a password.

    - #### setPassword

          public void setPassword(boolean password)

      Sets the flag indicating if the input text should be treated like a password.
      Parameters:
        `password` - true if the input text should be treated like a password, false otherwise.

    - #### getMinimumValue

          public int getMinimumValue()

      Gets the minimum value allowed (for integer input).
      Returns:
        the minimum value allowed.

    - #### getMaximumValue

          public int getMaximumValue()

      Gets the maximum value allowed (for integer input).
      Returns:
        the maximum value allowed.

    - #### setRange

          public void setRange(int minimumValue,
                      int maximumValue)

      Sets the minimum and maximum values allowed (for integer input). If the values are lesser or greater than the minimum and maximum values allowed by an Integer, they are reset to those values. If the maximum is less than the minimum it is reset to the minimum.
      Parameters:
        `minimumValue` - the minimum value allowed.
        `maximumValue` - the maximum value allowed.

    - #### getHeight

          public int getHeight()

      Gets the suggested height of this part (-1 for default)
      Returns:
        the suggested height of this part or -1 for default.

    - #### setHeight

          public void setHeight(int height)

      Sets the suggested height of this part (-1 for default)
      Parameters:
        `height` - the suggested height of this part (use -1 for default)