Package org.apache.pivot.wtk.content
Class NumericSpinnerData
- java.lang.Object
-
- org.apache.pivot.collections.ReadOnlySequence<java.lang.Integer>
-
- org.apache.pivot.wtk.content.NumericSpinnerData
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<java.lang.Integer>,Collection<java.lang.Integer>,List<java.lang.Integer>,Sequence<java.lang.Integer>
public class NumericSpinnerData extends ReadOnlySequence<java.lang.Integer> implements List<java.lang.Integer>
Spinner data model that presents a bounded list of integers. This is a lightweight class that spoofs the actual list data (no data is stored in the list).The iterator returned by this class's
iteratormethod is fail-fast: if the bounds of the enclosing spinner data change during iteration, aConcurrentModificationExceptionwill be thrown.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.List
List.ItemIterator<T>, List.ListListenerList<T>
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
-
-
Constructor Summary
Constructors Constructor Description NumericSpinnerData()Creates a newNumericSpinnerDatainstance bounded fromShort.MIN_VALUEtoShort.MAX_VALUEand an increment of one.NumericSpinnerData(int lowerBound, int upperBound)Creates a newNumericSpinnerDatawith the specified bounded range and an increment of one.NumericSpinnerData(int lowerBound, int upperBound, int increment)Creates a newNumericSpinnerDatawith the specified bounded range and increment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Not supported in this class.java.lang.Integerget(int index)Retrieves the item at the given index.java.util.Comparator<java.lang.Integer>getComparator()Not supported in this class.intgetIncrement()intgetLength()Returns the length of the list.ListenerList<ListListener<java.lang.Integer>>getListListeners()Returns the list listener list.intgetLowerBound()intgetUpperBound()intindexOf(java.lang.Integer item)Returns the index of an item in the sequence.booleanisEmpty()Tests the emptiness of the collection.java.util.Iterator<java.lang.Integer>iterator()voidsetComparator(java.util.Comparator<java.lang.Integer> comparator)Not supported in this class.voidsetIncrement(int increment)voidsetLowerBound(int lowerBound)voidsetUpperBound(int upperBound)-
Methods inherited from class org.apache.pivot.collections.ReadOnlySequence
add, defaultException, insert, remove, remove, update
-
-
-
-
Constructor Detail
-
NumericSpinnerData
public NumericSpinnerData()
Creates a newNumericSpinnerDatainstance bounded fromShort.MIN_VALUEtoShort.MAX_VALUEand an increment of one.
-
NumericSpinnerData
public NumericSpinnerData(int lowerBound, int upperBound)Creates a newNumericSpinnerDatawith the specified bounded range and an increment of one.- Parameters:
lowerBound- The lower bound for the data.upperBound- The upper bound for the data.
-
NumericSpinnerData
public NumericSpinnerData(int lowerBound, int upperBound, int increment)Creates a newNumericSpinnerDatawith the specified bounded range and increment.- Parameters:
lowerBound- The lower bound for the data.upperBound- The upper bound for the data.increment- The increment between values.
-
-
Method Detail
-
getLowerBound
public int getLowerBound()
-
setLowerBound
public void setLowerBound(int lowerBound)
-
getUpperBound
public int getUpperBound()
-
setUpperBound
public void setUpperBound(int upperBound)
-
getIncrement
public int getIncrement()
-
setIncrement
public void setIncrement(int increment)
-
get
public java.lang.Integer get(int index)
Description copied from interface:SequenceRetrieves the item at the given index.
-
indexOf
public int indexOf(java.lang.Integer item)
Description copied from interface:SequenceReturns the index of an item in the sequence.
-
clear
@UnsupportedOperation public void clear()
Not supported in this class.- Specified by:
clearin interfaceCollection<java.lang.Integer>- Specified by:
clearin interfaceList<java.lang.Integer>- Throws:
java.lang.UnsupportedOperationException- always.- See Also:
ListListener.itemsRemoved(List, int, Sequence)
-
isEmpty
public boolean isEmpty()
Description copied from interface:CollectionTests the emptiness of the collection.- Specified by:
isEmptyin interfaceCollection<java.lang.Integer>- Returns:
trueif the collection contains no elements;false, otherwise.
-
getLength
public int getLength()
Description copied from interface:ListReturns the length of the list.
-
getComparator
public java.util.Comparator<java.lang.Integer> getComparator()
Not supported in this class.- Specified by:
getComparatorin interfaceCollection<java.lang.Integer>- Returns:
nullalways (comparators are not supported)- See Also:
Collection.setComparator(Comparator)
-
setComparator
@UnsupportedOperation public void setComparator(java.util.Comparator<java.lang.Integer> comparator)
Not supported in this class.- Specified by:
setComparatorin interfaceCollection<java.lang.Integer>- Specified by:
setComparatorin interfaceList<java.lang.Integer>- Parameters:
comparator- The comparator used to order elements in the collection, or null if the collection is unsorted.- Throws:
java.lang.UnsupportedOperationException- always.- See Also:
ListListener.comparatorChanged(List, Comparator)
-
iterator
public java.util.Iterator<java.lang.Integer> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Integer>
-
getListListeners
public ListenerList<ListListener<java.lang.Integer>> getListListeners()
Description copied from interface:ListReturns the list listener list.- Specified by:
getListListenersin interfaceList<java.lang.Integer>- Returns:
- The list of listeners for this list.
-
-