T
- The type of the elements in the List
.public static class SpinnerValueFactory.ListSpinnerValueFactory<T> extends SpinnerValueFactory<T>
SpinnerValueFactory
implementation designed to iterate through
a list of values.
Note that the default converter
is implemented
simply as shown below, which may be adequate in many cases, but it is important
for users to ensure that this suits their needs (and adjust when necessary):
setConverter(new StringConverter<T>() { @Override public String toString(T value) { if (value == null) { return ""; } return value.toString(); } @Override public T fromString(String string) { return (T) string; } });
Type | Property and Description |
---|---|
ObjectProperty<ObservableList<T>> |
items
The underlying data model for the ListView.
|
converter, value, wrapAround
SpinnerValueFactory.DoubleSpinnerValueFactory, SpinnerValueFactory.IntegerSpinnerValueFactory, SpinnerValueFactory.ListSpinnerValueFactory<T>
Constructor and Description |
---|
ListSpinnerValueFactory(ObservableList<T> items)
Creates a new instance of the ListSpinnerValueFactory with the given
list used as the list to step through.
|
Modifier and Type | Method and Description |
---|---|
void |
decrement(int steps)
Attempts to decrement the
value by the given
number of steps. |
ObservableList<T> |
getItems()
Returns an
ObservableList that contains the items currently able
to be iterated through by the user. |
void |
increment(int steps)
Attempts to omcrement the
value by the given
number of steps. |
ObjectProperty<ObservableList<T>> |
itemsProperty()
The underlying data model for the ListView.
|
void |
setItems(ObservableList<T> value)
Sets the underlying data model for the ListSpinnerValueFactory.
|
converterProperty, getConverter, getValue, isWrapAround, setConverter, setValue, setWrapAround, valueProperty, wrapAroundProperty
public final ObjectProperty<ObservableList<T>> itemsProperty
public ListSpinnerValueFactory(ObservableList<T> items)
items
- The list of items to step through with the Spinner.public final void setItems(ObservableList<T> value)
public final ObservableList<T> getItems()
ObservableList
that contains the items currently able
to be iterated through by the user. This may be null if
setItems(javafx.collections.ObservableList)
has previously been
called, however, by default it is an empty ObservableList.public final ObjectProperty<ObservableList<T>> itemsProperty()
public void decrement(int steps)
value
by the given
number of steps.decrement
in class SpinnerValueFactory<T>
steps
- The number of decrements that should be performed on the value.public void increment(int steps)
value
by the given
number of steps.increment
in class SpinnerValueFactory<T>
steps
- The number of increments that should be performed on the value.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.