A simple implementation of SpinnerModel whose values are defined by an array or a List. For example to create a model defined by an array of the names of the days of the week:
String[] days = new DateFormatSymbols().getWeekdays(); SpinnerModel model = new SpinnerListModel(Arrays.asList(days).subList(1, 8)); This class only stores a reference to the array or List so if an element of the underlying sequence changes, it's up to the application to notify the ChangeListeners by calling fireStateChanged.
This model inherits a ChangeListener. The ChangeListeners are notified whenever the model's value or list properties changes.
A simple implementation of SpinnerModel whose values are defined by an array or a List. For example to create a model defined by an array of the names of the days of the week: String[] days = new DateFormatSymbols().getWeekdays(); SpinnerModel model = new SpinnerListModel(Arrays.asList(days).subList(1, 8)); This class only stores a reference to the array or List so if an element of the underlying sequence changes, it's up to the application to notify the ChangeListeners by calling fireStateChanged. This model inherits a ChangeListener. The ChangeListeners are notified whenever the model's value or list properties changes.
(->spinner-list-model)
(->spinner-list-model values)
Constructor.
Constructs a SpinnerModel whose sequence of values is defined by the specified List. The initial value (current element) of the model will be values.get(0). If values is null or has zero size, an IllegalArugmentException is thrown.
values - the sequence this model represents - java.util.List
throws: java.lang.IllegalArgumentException - if values is null or zero size
Constructor. Constructs a SpinnerModel whose sequence of values is defined by the specified List. The initial value (current element) of the model will be values.get(0). If values is null or has zero size, an IllegalArugmentException is thrown. values - the sequence this model represents - `java.util.List` throws: java.lang.IllegalArgumentException - if values is null or zero size
(get-list this)
Returns the List that defines the sequence for this model.
returns: the value of the list property - java.util.List<?>
Returns the List that defines the sequence for this model. returns: the value of the list property - `java.util.List<?>`
(get-next-value this)
Returns the next legal value of the underlying sequence or null if value is already the last element.
returns: the next legal value of the underlying sequence or
null if value is already the last element - java.lang.Object
Returns the next legal value of the underlying sequence or null if value is already the last element. returns: the next legal value of the underlying sequence or null if value is already the last element - `java.lang.Object`
(get-previous-value this)
Returns the previous element of the underlying sequence or null if value is already the first element.
returns: the previous element of the underlying sequence or
null if value is already the first element - java.lang.Object
Returns the previous element of the underlying sequence or null if value is already the first element. returns: the previous element of the underlying sequence or null if value is already the first element - `java.lang.Object`
(get-value this)
Returns the current element of the sequence.
returns: the value property - java.lang.Object
Returns the current element of the sequence. returns: the value property - `java.lang.Object`
(set-list this list)
Changes the list that defines this sequence and resets the index of the models value to zero. Note that list is not copied, the model just stores a reference to it.
This method fires a ChangeEvent if list is not equal to the current list.
list - the sequence that this model represents - java.util.List
throws: java.lang.IllegalArgumentException - if list is null or zero length
Changes the list that defines this sequence and resets the index of the models value to zero. Note that list is not copied, the model just stores a reference to it. This method fires a ChangeEvent if list is not equal to the current list. list - the sequence that this model represents - `java.util.List` throws: java.lang.IllegalArgumentException - if list is null or zero length
(set-value this elt)
Changes the current element of the sequence and notifies ChangeListeners. If the specified value is not equal to an element of the underlying sequence then an IllegalArgumentException is thrown. In the following example the setValue call would cause an exception to be thrown:
String[] values = {"one", "two", "free", "four"}; SpinnerModel model = new SpinnerListModel(values); model.setValue("TWO");
elt - the sequence element that will be model's current value - java.lang.Object
throws: java.lang.IllegalArgumentException - if the specified value isn't allowed
Changes the current element of the sequence and notifies ChangeListeners. If the specified value is not equal to an element of the underlying sequence then an IllegalArgumentException is thrown. In the following example the setValue call would cause an exception to be thrown: String[] values = {"one", "two", "free", "four"}; SpinnerModel model = new SpinnerListModel(values); model.setValue("TWO"); elt - the sequence element that will be model's current value - `java.lang.Object` throws: java.lang.IllegalArgumentException - if the specified value isn't allowed
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close