Package org.apache.pivot.wtk.content
Class CalendarDateSpinnerData
- java.lang.Object
-
- org.apache.pivot.collections.ReadOnlySequence<CalendarDate>
-
- org.apache.pivot.wtk.content.CalendarDateSpinnerData
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<CalendarDate>
,Collection<CalendarDate>
,List<CalendarDate>
,Sequence<CalendarDate>
public class CalendarDateSpinnerData extends ReadOnlySequence<CalendarDate> implements List<CalendarDate>
Spinner data model that presents a bounded list of calendar dates.This is a lightweight class that spoofs the actual list data by using an internal calendar instance from which
CalendarDate
instances are created on demand.- 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 CalendarDateSpinnerData()
Creates a newCalendarDateSpinnerData
bounded from1900-01-01
to2099-12-31
.CalendarDateSpinnerData(CalendarDate lowerBound, CalendarDate upperBound)
Creates a newCalendarDateSpinnerData
bounded by the specified calendar dates (inclusive).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
ThrowsUnsupportedOperationException
.CalendarDate
get(int index)
Gets the calendar date at the specified index.java.util.Comparator<CalendarDate>
getComparator()
Gets the comparator for this list, which is guaranteed to always benull
.int
getLength()
Gets the number of entries in this list.ListenerList<ListListener<CalendarDate>>
getListListeners()
Returns the list listener list.int
indexOf(CalendarDate item)
Returns the index of an item in the sequence.boolean
isEmpty()
Tests the emptiness of the collection.java.util.Iterator<CalendarDate>
iterator()
void
setComparator(java.util.Comparator<CalendarDate> comparator)
ThrowsUnsupportedOperationException
because the generated data is inherently in date order, thus sorting makes no sense.-
Methods inherited from class org.apache.pivot.collections.ReadOnlySequence
add, defaultException, insert, remove, remove, update
-
-
-
-
Constructor Detail
-
CalendarDateSpinnerData
public CalendarDateSpinnerData()
Creates a newCalendarDateSpinnerData
bounded from1900-01-01
to2099-12-31
.
-
CalendarDateSpinnerData
public CalendarDateSpinnerData(CalendarDate lowerBound, CalendarDate upperBound)
Creates a newCalendarDateSpinnerData
bounded by the specified calendar dates (inclusive).- Parameters:
lowerBound
- The earliest date to include in this spinner data.upperBound
- The latest date to include in this spinner data.
-
-
Method Detail
-
get
public final CalendarDate get(int index)
Gets the calendar date at the specified index.- Specified by:
get
in interfaceSequence<CalendarDate>
- Parameters:
index
- The index of the calendar date to retrieve.- Returns:
- The item at this index in the sequence.
-
indexOf
public final int indexOf(CalendarDate item)
Description copied from interface:Sequence
Returns the index of an item in the sequence.- Specified by:
indexOf
in interfaceSequence<CalendarDate>
- Parameters:
item
- The item to locate.- Returns:
- The index of first occurrence of the item if it exists in the
sequence;
-1
, otherwise.
-
clear
@UnsupportedOperation public void clear()
ThrowsUnsupportedOperationException
.- Specified by:
clear
in interfaceCollection<CalendarDate>
- Specified by:
clear
in interfaceList<CalendarDate>
- See Also:
ListListener.itemsRemoved(List, int, Sequence)
-
isEmpty
public final boolean isEmpty()
Description copied from interface:Collection
Tests the emptiness of the collection.- Specified by:
isEmpty
in interfaceCollection<CalendarDate>
- Returns:
true
if the collection contains no elements;false
, otherwise.
-
getLength
public int getLength()
Gets the number of entries in this list.- Specified by:
getLength
in interfaceList<CalendarDate>
- Specified by:
getLength
in interfaceSequence<CalendarDate>
- Returns:
- The number of calendar dates in this list.
-
getComparator
public java.util.Comparator<CalendarDate> getComparator()
Gets the comparator for this list, which is guaranteed to always benull
. The generated data is inherently in date order, thus sorting doesn't make sense.- Specified by:
getComparator
in interfaceCollection<CalendarDate>
- Returns:
- The comparator used to order elements in the collection, or
null
if the sort order is undefined. - See Also:
Collection.setComparator(Comparator)
-
setComparator
@UnsupportedOperation public final void setComparator(java.util.Comparator<CalendarDate> comparator)
ThrowsUnsupportedOperationException
because the generated data is inherently in date order, thus sorting makes no sense.- Specified by:
setComparator
in interfaceCollection<CalendarDate>
- Specified by:
setComparator
in interfaceList<CalendarDate>
- Parameters:
comparator
- The comparator used to order elements in the collection, or null if the collection is unsorted.- See Also:
ListListener.comparatorChanged(List, Comparator)
-
iterator
public final java.util.Iterator<CalendarDate> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<CalendarDate>
-
getListListeners
public final ListenerList<ListListener<CalendarDate>> getListListeners()
Description copied from interface:List
Returns the list listener list.- Specified by:
getListListeners
in interfaceList<CalendarDate>
- Returns:
- The list of listeners for this list.
-
-