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
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, Incrementinganddecrementingthe value, with one or more steps per call,Convertingtext input from the user (via the Spinnereditor,- Converting
objects to user-readable stringsfor display on screen
SpinnerValueFactory classes for some common types are provided with JavaFX, including:
- Since:
- JavaFX 8u40
- See Also:
-
Property Summary
PropertiesTypePropertyDescriptionfinal ObjectProperty<StringConverter<T>> final ObjectProperty<T> Represents the current value of the SpinnerValueFactory, or null if no value has been set.final BooleanPropertyThe wrapAround property is used to specify whether the value factory should be circular. -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classASpinnerValueFactoryimplementation designed to iterate through double values.static classASpinnerValueFactoryimplementation designed to iterate through integer values.static classASpinnerValueFactoryimplementation designed to iterate through a list of values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty<StringConverter<T>> abstract voiddecrement(int steps) Attempts to decrement thevalueby the given number of steps.final StringConverter<T> Gets the value of theconverterproperty.final TgetValue()Gets the value of thevalueproperty.abstract voidincrement(int steps) Attempts to omcrement thevalueby the given number of steps.final booleanGets the value of thewrapAroundproperty.final voidsetConverter(StringConverter<T> newValue) Sets the value of theconverterproperty.final voidSets the value of thevalueproperty.final voidsetWrapAround(boolean value) Sets the value of thewrapAroundproperty.final ObjectProperty<T> Represents the current value of the SpinnerValueFactory, or null if no value has been set.final BooleanPropertyThe wrapAround property is used to specify whether the value factory should be circular.
-
Property Details
-
value
Represents the current value of the SpinnerValueFactory, or null if no value has been set.- See Also:
-
converter
Converts the user-typed input (when the Spinner iseditable) to an object of type T, such that the input may be retrieved via thevalueproperty.- See Also:
-
wrapAround
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:
-
-
Constructor Details
-
SpinnerValueFactory
public SpinnerValueFactory()Creates a default SpinnerValueFactory.
-
-
Method Details
-
decrement
public abstract void decrement(int steps) Attempts to decrement thevalueby 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 thevalueby the given number of steps.- Parameters:
steps- The number of increments that should be performed on the value.
-
getValue
Gets the value of thevalueproperty.- Property description:
- Represents the current value of the SpinnerValueFactory, or null if no value has been set.
- Returns:
- the value of the
valueproperty - See Also:
-
setValue
Sets the value of thevalueproperty.- Property description:
- Represents the current value of the SpinnerValueFactory, or null if no value has been set.
- Parameters:
newValue- the value for thevalueproperty- See Also:
-
valueProperty
Represents the current value of the SpinnerValueFactory, or null if no value has been set.- Returns:
- the
valueproperty - See Also:
-
getConverter
Gets the value of theconverterproperty. -
setConverter
Sets the value of theconverterproperty. -
converterProperty
Converts the user-typed input (when the Spinner iseditable) to an object of type T, such that the input may be retrieved via thevalueproperty.- Returns:
- the
converterproperty - See Also:
-
setWrapAround
public final void setWrapAround(boolean value) Sets the value of thewrapAroundproperty.- 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).
- Parameters:
value- the value for thewrapAroundproperty- See Also:
-
isWrapAround
public final boolean isWrapAround()Gets the value of thewrapAroundproperty.- 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).
- Returns:
- the value of the
wrapAroundproperty - See Also:
-
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).- Returns:
- the
wrapAroundproperty - See Also:
-