Module MaterialFX

Class ListSpinnerModel<T>

java.lang.Object
io.github.palexdev.materialfx.controls.models.spinner.AbstractSpinnerModel<T>
io.github.palexdev.materialfx.controls.models.spinner.ListSpinnerModel<T>
All Implemented Interfaces:
SpinnerModel<T>

public class ListSpinnerModel<T> extends AbstractSpinnerModel<T>
Concrete implementation of AbstractSpinnerModel to work with lists of any type.

ListSpinnerModel adds the converterProperty() (since we know the kind of data the model will deal with), and three new properties, itemsProperty(), getCurrentIndex(), incrementProperty().

The model works by keeping the current value's index in the list and updating that index, even when the list is modified, see updateCurrentIndex(ListChangeListener.Change).

The constructor initializes the model with these values:

- The converter uses toString(T) on the value or empty string if the value is null

- The default value is an empty ObservableList

- The increment is 1

- The initial value is the first element of the list (if not empty)