Module MaterialFX

Class AbstractSpinnerModel<T>

java.lang.Object
io.github.palexdev.materialfx.controls.models.spinner.AbstractSpinnerModel<T>
All Implemented Interfaces:
SpinnerModel<T>
Direct Known Subclasses:
ListSpinnerModel, LocalDateSpinnerModel, NumberSpinnerModel

public abstract class AbstractSpinnerModel<T> extends Object implements SpinnerModel<T>
Base implementation for SpinnerModel.

This is still not enough to use with a spinner but it's a good base to implement new models. Defines all the specification from the SpinnerModel interface and adds a new property, defaultValueProperty(), which is the spinner's value when calling reset().

  • Property Details

  • Field Details

    • value

      protected final ObjectProperty<T> value
    • defaultValue

      protected final ObjectProperty<T> defaultValue
    • wrapAround

      protected boolean wrapAround
  • Constructor Details

    • AbstractSpinnerModel

      public AbstractSpinnerModel()
  • Method Details

    • reset

      public void reset()
      Sets the spinner's value to the value specified by defaultValueProperty().
      Specified by:
      reset in interface SpinnerModel<T>
    • getValue

      public T getValue()
      Gets the value of the value property.
      Specified by:
      getValue in interface SpinnerModel<T>
      Property description:
      Returns:
      the value of the value property
      See Also:
    • valueProperty

      public ObjectProperty<T> valueProperty()
      Description copied from interface: SpinnerModel
      Specifies the spinner's value.
      Specified by:
      valueProperty in interface SpinnerModel<T>
      Returns:
      the value property
      See Also:
    • setValue

      public void setValue(T value)
      Sets the value of the value property.
      Specified by:
      setValue in interface SpinnerModel<T>
      Property description:
      Parameters:
      value - the value for the value property
      See Also:
    • isWrapAround

      public boolean isWrapAround()
      Specified by:
      isWrapAround in interface SpinnerModel<T>
      Returns:
      whether the spinner can cycle through the values when reaching the last/first value
    • setWrapAround

      public void setWrapAround(boolean wrapAround)
      Description copied from interface: SpinnerModel
      Sets whether the spinner can cycle through the values when reaching the last/first value
      Specified by:
      setWrapAround in interface SpinnerModel<T>
    • getDefaultValue

      public T getDefaultValue()
      Gets the value of the defaultValue property.
      Property description:
      Specifies the default value of the spinner.

      Note that this may not be the spinner's initial value, and usually this is used when calling the reset() method (depends on the implementation).
      Returns:
      the value of the defaultValue property
      See Also:
    • defaultValueProperty

      public ObjectProperty<T> defaultValueProperty()
      Specifies the default value of the spinner.

      Note that this may not be the spinner's initial value, and usually this is used when calling the reset() method (depends on the implementation).
      Returns:
      the defaultValue property
      See Also:
    • setDefaultValue

      public void setDefaultValue(T defaultValue)
      Sets the value of the defaultValue property.
      Property description:
      Specifies the default value of the spinner.

      Note that this may not be the spinner's initial value, and usually this is used when calling the reset() method (depends on the implementation).
      Parameters:
      defaultValue - the value for the defaultValue property
      See Also: