SpinnerValueFactory (JavaFX 17)

Module javafx.controls
Package javafx.scene.control

## Class SpinnerValueFactory<T>

- java.lang.Object
- - javafx.scene.control.SpinnerValueFactory<T>

- Type Parameters:
    `T` - The type of the data this value factory deals with, which must coincide with the type of the Spinner that the value factory is set on.
  Direct Known Subclasses:
    `SpinnerValueFactory.DoubleSpinnerValueFactory`, `SpinnerValueFactory.IntegerSpinnerValueFactory`, `SpinnerValueFactory.ListSpinnerValueFactory`

      public abstract class SpinnerValueFactory<T>
      extends Object

  The SpinnerValueFactory is the model behind the JavaFX `Spinner control` - without a value factory installed a Spinner is unusable. It is the role of the value factory to handle almost all aspects of the Spinner, including:
  - Representing the current state of the `value`,
  - `Incrementing` and `decrementing` the value, with one or more steps per call,
  - `Converting` text input from the user (via the Spinner `editor`,
  - Converting `objects to user-readable strings` for display on screen

  SpinnerValueFactory classes for some common types are provided with JavaFX, including:

  - `SpinnerValueFactory.IntegerSpinnerValueFactory`
  - `SpinnerValueFactory.DoubleSpinnerValueFactory`
  - `SpinnerValueFactory.ListSpinnerValueFactory`
  Since:
    JavaFX 8u40
  See Also:
    `Spinner`, `SpinnerValueFactory.IntegerSpinnerValueFactory`, `SpinnerValueFactory.DoubleSpinnerValueFactory`, `SpinnerValueFactory.ListSpinnerValueFactory`

- - ### Property Summary

    Properties
    Type | Property | Description
    --- | --- | ---
    `ObjectProperty<StringConverter<T>>` | `converter` | Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
    `ObjectProperty<T>` | `value` | Represents the current value of the SpinnerValueFactory, or null if no value has been set.
    `BooleanProperty` | `wrapAround` | The wrapAround property is used to specify whether the value factory should be circular.

  - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SpinnerValueFactory.DoubleSpinnerValueFactory` | A `SpinnerValueFactory` implementation designed to iterate through double values.
    `static class` | `SpinnerValueFactory.IntegerSpinnerValueFactory` | A `SpinnerValueFactory` implementation designed to iterate through integer values.
    `static class` | `SpinnerValueFactory.ListSpinnerValueFactory<T>` | A `SpinnerValueFactory` implementation designed to iterate through a list of values.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SpinnerValueFactory()` | Creates a default SpinnerValueFactory.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ObjectProperty<StringConverter<T>>` | `converterProperty()` | Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
    `abstract void` | `decrement​(int steps)` | Attempts to decrement the `value` by the given number of steps.
    `StringConverter<T>` | `getConverter()` | Gets the value of the property converter.
    `T` | `getValue()` | Gets the value of the property value.
    `abstract void` | `increment​(int steps)` | Attempts to omcrement the `value` by the given number of steps.
    `boolean` | `isWrapAround()` | Gets the value of the property wrapAround.
    `void` | `setConverter​(StringConverter<T> newValue)` | Sets the value of the property converter.
    `void` | `setValue​(T newValue)` | Sets the value of the property value.
    `void` | `setWrapAround​(boolean value)` | Sets the value of the property wrapAround.
    `ObjectProperty<T>` | `valueProperty()` | Represents the current value of the SpinnerValueFactory, or null if no value has been set.
    `BooleanProperty` | `wrapAroundProperty()` | The wrapAround property is used to specify whether the value factory should be circular.

    - ### Methods declared in class java.lang.Object

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

- - ### Property Detail

    - #### value

          public final ObjectProperty<T> valueProperty

      Represents the current value of the SpinnerValueFactory, or null if no value has been set.
      See Also:
        `getValue()`, `setValue(T)`

    - #### converter

          public final ObjectProperty<StringConverter<T>> converterProperty

      Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
      See Also:
        `getConverter()`, `setConverter(StringConverter)`

    - #### wrapAround

          public final BooleanProperty wrapAroundProperty

      The wrapAround property is used to specify whether the value factory should be circular. For example, should an integer-based value model increment from the maximum value back to the minimum value (and vice versa).
      See Also:
        `isWrapAround()`, `setWrapAround(boolean)`

  - ### Constructor Detail

    - #### SpinnerValueFactory

          public SpinnerValueFactory()

      Creates a default SpinnerValueFactory.

  - ### Method Detail

    - #### decrement

          public abstract void decrement​(int steps)

      Attempts to decrement the `value` by the given number of steps.
      Parameters:
        `steps` - The number of decrements that should be performed on the value.

    - #### increment

          public abstract void increment​(int steps)

      Attempts to omcrement the `value` by the given number of steps.
      Parameters:
        `steps` - The number of increments that should be performed on the value.

    - #### getValue

          public final T getValue()

      Gets the value of the property value.
      Property description:
        Represents the current value of the SpinnerValueFactory, or null if no value has been set.

    - #### setValue

          public final void setValue​(T newValue)

      Sets the value of the property value.
      Property description:
        Represents the current value of the SpinnerValueFactory, or null if no value has been set.

    - #### valueProperty

          public final ObjectProperty<T> valueProperty()

      Represents the current value of the SpinnerValueFactory, or null if no value has been set.
      See Also:
        `getValue()`, `setValue(T)`

    - #### getConverter

          public final StringConverter<T> getConverter()

      Gets the value of the property converter.
      Property description:
        Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.

    - #### setConverter

          public final void setConverter​(StringConverter<T> newValue)

      Sets the value of the property converter.
      Property description:
        Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.

    - #### converterProperty

          public final ObjectProperty<StringConverter<T>> converterProperty()

      Converts the user-typed input (when the Spinner is `editable`) to an object of type T, such that the input may be retrieved via the `value` property.
      See Also:
        `getConverter()`, `setConverter(StringConverter)`

    - #### setWrapAround

          public final void setWrapAround​(boolean value)

      Sets the value of the property wrapAround.
      Property description:
        The wrapAround property is used to specify whether the value factory should be circular. For example, should an integer-based value model increment from the maximum value back to the minimum value (and vice versa).

    - #### isWrapAround

          public final boolean isWrapAround()

      Gets the value of the property wrapAround.
      Property description:
        The wrapAround property is used to specify whether the value factory should be circular. For example, should an integer-based value model increment from the maximum value back to the minimum value (and vice versa).

    - #### wrapAroundProperty

          public final BooleanProperty wrapAroundProperty()

      The wrapAround property is used to specify whether the value factory should be circular. For example, should an integer-based value model increment from the maximum value back to the minimum value (and vice versa).
      See Also:
        `isWrapAround()`, `setWrapAround(boolean)`