Package docking.widgets.values

# Class IntValue

java.lang.Object
docking.widgets.values.AbstractValue<Integer>
docking.widgets.values.IntValue

public class IntValue extends AbstractValue<Integer>
Value class for `Integer` Value with an option for display the value as decimal or hex. The editor component uses an `IntegerTextField` for display and editing the value. This value supports the concept of no value which is represented by the text field being empty. If the text field is not empty, then the field only allows valid numeric values.

This class and other subclasses of `AbstractValue` are part of a subsystem for easily defining a set of values that can be displayed in an input dialog (`ValuesMapDialog`). Typically, these values are created indirectly using a `GValuesMap` which is then given to the constructor of the dialog. However, an alternate approach is to create the dialog without a ValuesMap and then use its `ValuesMapDialog.addValue(AbstractValue)` method directly.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IntValue(String name)`
  Constructs an IntValue that displays it value in decimal
  `IntValue(String name, int defaultValue)`
  Constructs an IntValue with a default value that displays it value in decimal
  `IntValue(String name, Integer defaultValue, boolean displayAsHex)`
  Constructs an IntValue with a default value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Integer`
  `fromString(String valueString)`
  Parses the given string into a value of type T
  `JComponent`
  `getComponent()`
  Returns a JComponent for entering or editing a value of this type.
  `String`
  `toString(Integer v)`
  `protected void`
  `updateComponentFromValue()`
  Updates the JComponent returned from `AbstractValue.getComponent()` to represent the current value of this object.
  `protected void`
  `updateValueFromComponent()`
  Causes the stored value for this object to be updated based on the state of the JComponent returned from `AbstractValue.getComponent()`

  ### Methods inherited from class docking.widgets.values.AbstractValue

  `copyValue, getAsText, getName, getValue, hasValue, reset, setAsText, setValue`

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

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

- ## Constructor Details

  - ### IntValue

    public IntValue(String name)
    Constructs an IntValue that displays it value in decimal
    Parameters:
      `name` - the name of the value

  - ### IntValue

    public IntValue(String name, int defaultValue)
    Constructs an IntValue with a default value that displays it value in decimal
    Parameters:
      `name` - the name of the value
      `defaultValue` - the default value

  - ### IntValue

    public IntValue(String name, Integer defaultValue, boolean displayAsHex)
    Constructs an IntValue with a default value.
    Parameters:
      `name` - the name of the value
      `defaultValue` - the default value
      `displayAsHex` - if true, the value will be displayed as hex, otherwise it will display as decimal.

- ## Method Details

  - ### getComponent

    public JComponent getComponent()
    Description copied from class: `AbstractValue`
    Returns a JComponent for entering or editing a value of this type.
    Specified by:
      `getComponent` in class `AbstractValue<Integer>`
    Returns:
      a JComponent for entering or editing a value of this type.

  - ### updateValueFromComponent

    protected void updateValueFromComponent()
    Description copied from class: `AbstractValue`
    Causes the stored value for this object to be updated based on the state of the JComponent returned from `AbstractValue.getComponent()`
    Specified by:
      `updateValueFromComponent` in class `AbstractValue<Integer>`

  - ### updateComponentFromValue

    protected void updateComponentFromValue()
    Description copied from class: `AbstractValue`
    Updates the JComponent returned from `AbstractValue.getComponent()` to represent the current value of this object.
    Specified by:
      `updateComponentFromValue` in class `AbstractValue<Integer>`

  - ### fromString

    public Integer fromString(String valueString)
    Description copied from class: `AbstractValue`
    Parses the given string into a value of type T
    Specified by:
      `fromString` in class `AbstractValue<Integer>`
    Parameters:
      `valueString` - the string to parse
    Returns:
      a value of type T

  - ### toString

    public String toString(Integer v)
    Overrides:
      `toString` in class `AbstractValue<Integer>`