|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.wtk.content.NumericSpinnerData
public class NumericSpinnerData
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, a ConcurrentModificationException will be thrown.
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 | |
---|---|
NumericSpinnerData()
Creates a new NumericSpinnerData instance bounded from Short.MIN_VALUE to Short.MAX_VALUE and an increment of one. |
|
NumericSpinnerData(int lowerBound,
int upperBound)
Creates a new NumericSpinnerData with the specified bounded range and an increment of one. |
|
NumericSpinnerData(int lowerBound,
int upperBound,
int increment)
Creates a new NumericSpinnerData with the specified bounded range and increment. |
Method Summary | |
---|---|
int |
add(Integer item)
Adds an item to the list. |
void |
clear()
Removes all elements from the collection. |
Integer |
get(int index)
Retrieves the item at the given index. |
Comparator<Integer> |
getComparator()
Returns the collection's sort order. |
int |
getIncrement()
|
int |
getLength()
Returns the length of the list. |
ListenerList<ListListener<Integer>> |
getListListeners()
Returns the list listener list. |
int |
getLowerBound()
|
int |
getUpperBound()
|
int |
indexOf(Integer item)
Returns the index of an item in the sequence. |
void |
insert(Integer item,
int index)
Inserts an item into the list. |
boolean |
isEmpty()
Tests the emptiness of the collection. |
Iterator<Integer> |
iterator()
|
int |
remove(Integer item)
Removes the first occurrence of the given item from the sequence. |
Sequence<Integer> |
remove(int index,
int count)
Removes one or more items from the sequence. |
void |
setComparator(Comparator<Integer> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
void |
setIncrement(int increment)
|
void |
setLowerBound(int lowerBound)
|
void |
setUpperBound(int upperBound)
|
Integer |
update(int index,
Integer item)
Updates the item at the given index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumericSpinnerData()
public NumericSpinnerData(int lowerBound, int upperBound)
public NumericSpinnerData(int lowerBound, int upperBound, int increment)
Method Detail |
---|
public int getLowerBound()
public void setLowerBound(int lowerBound)
public int getUpperBound()
public void setUpperBound(int upperBound)
public int getIncrement()
public void setIncrement(int increment)
public int add(Integer item)
List
add
in interface List<Integer>
add
in interface Sequence<Integer>
item
- The item to be added to the sequence.
ListListener.itemInserted(List, int)
public void insert(Integer item, int index)
List
insert
in interface List<Integer>
insert
in interface Sequence<Integer>
item
- The item to be added to the list.index
- The index at which the item should be inserted. Must be a value between
0 and getLength().ListListener.itemInserted(List, int)
public Integer update(int index, Integer item)
List
update
in interface List<Integer>
update
in interface Sequence<Integer>
index
- The index of the item to update.item
- The item that will replace any existing value at the given index.
ListListener.itemUpdated(List, int, Object)
public int remove(Integer item)
Sequence
remove
in interface Sequence<Integer>
item
- The item to remove.
Sequence.remove(int, int)
public Sequence<Integer> remove(int index, int count)
Sequence
remove
in interface List<Integer>
remove
in interface Sequence<Integer>
index
- The starting index to remove.count
- The number of items to remove, beginning with index.
ListListener.itemsRemoved(List, int, Sequence)
public Integer get(int index)
Sequence
get
in interface Sequence<Integer>
index
- The index of the item to retrieve.public int indexOf(Integer item)
Sequence
indexOf
in interface Sequence<Integer>
item
- The item to locate.
public void clear()
Collection
clear
in interface Collection<Integer>
clear
in interface List<Integer>
ListListener.itemsRemoved(List, int, Sequence)
public boolean isEmpty()
Collection
isEmpty
in interface Collection<Integer>
public int getLength()
List
getLength
in interface List<Integer>
getLength
in interface Sequence<Integer>
public Comparator<Integer> getComparator()
Collection
getComparator
in interface Collection<Integer>
Collection.setComparator(Comparator)
public void setComparator(Comparator<Integer> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<Integer>
setComparator
in interface List<Integer>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.ListListener.comparatorChanged(List, Comparator)
public Iterator<Integer> iterator()
iterator
in interface Iterable<Integer>
public ListenerList<ListListener<Integer>> getListListeners()
List
getListListeners
in interface List<Integer>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |