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
iterator
method is fail-fast: if the bounds of the enclosing spinner data change during iteration, aConcurrentModificationException
will 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 newNumericSpinnerData
instance bounded fromShort.MIN_VALUE
toShort.MAX_VALUE
and an increment of one.NumericSpinnerData(int lowerBound, int upperBound)
Creates a newNumericSpinnerData
with the specified bounded range and an increment of one.NumericSpinnerData(int lowerBound, int upperBound, int increment)
Creates a newNumericSpinnerData
with the specified bounded range and increment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Not supported in this class.java.lang.Integer
get(int index)
Retrieves the item at the given index.java.util.Comparator<java.lang.Integer>
getComparator()
Not supported in this class.int
getIncrement()
int
getLength()
Returns the length of the list.ListenerList<ListListener<java.lang.Integer>>
getListListeners()
Returns the list listener list.int
getLowerBound()
int
getUpperBound()
int
indexOf(java.lang.Integer item)
Returns the index of an item in the sequence.boolean
isEmpty()
Tests the emptiness of the collection.java.util.Iterator<java.lang.Integer>
iterator()
void
setComparator(java.util.Comparator<java.lang.Integer> comparator)
Not supported in this class.void
setIncrement(int increment)
void
setLowerBound(int lowerBound)
void
setUpperBound(int upperBound)
-
Methods inherited from class org.apache.pivot.collections.ReadOnlySequence
add, defaultException, insert, remove, remove, update
-
-
-
-
Constructor Detail
-
NumericSpinnerData
public NumericSpinnerData()
Creates a newNumericSpinnerData
instance bounded fromShort.MIN_VALUE
toShort.MAX_VALUE
and an increment of one.
-
NumericSpinnerData
public NumericSpinnerData(int lowerBound, int upperBound)
Creates a newNumericSpinnerData
with 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 newNumericSpinnerData
with 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:Sequence
Retrieves the item at the given index.
-
indexOf
public int indexOf(java.lang.Integer item)
Description copied from interface:Sequence
Returns the index of an item in the sequence.
-
clear
@UnsupportedOperation public void clear()
Not supported in this class.- Specified by:
clear
in interfaceCollection<java.lang.Integer>
- Specified by:
clear
in interfaceList<java.lang.Integer>
- Throws:
java.lang.UnsupportedOperationException
- always.- See Also:
ListListener.itemsRemoved(List, int, Sequence)
-
isEmpty
public boolean isEmpty()
Description copied from interface:Collection
Tests the emptiness of the collection.- Specified by:
isEmpty
in interfaceCollection<java.lang.Integer>
- Returns:
true
if the collection contains no elements;false
, otherwise.
-
getLength
public int getLength()
Description copied from interface:List
Returns the length of the list.
-
getComparator
public java.util.Comparator<java.lang.Integer> getComparator()
Not supported in this class.- Specified by:
getComparator
in interfaceCollection<java.lang.Integer>
- Returns:
null
always (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:
setComparator
in interfaceCollection<java.lang.Integer>
- Specified by:
setComparator
in 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:
iterator
in interfacejava.lang.Iterable<java.lang.Integer>
-
getListListeners
public ListenerList<ListListener<java.lang.Integer>> getListListeners()
Description copied from interface:List
Returns the list listener list.- Specified by:
getListListeners
in interfaceList<java.lang.Integer>
- Returns:
- The list of listeners for this list.
-
-