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
CalendarDateinstances 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 newCalendarDateSpinnerDatabounded from1900-01-01to2099-12-31.CalendarDateSpinnerData(CalendarDate lowerBound, CalendarDate upperBound)Creates a newCalendarDateSpinnerDatabounded by the specified calendar dates (inclusive).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()ThrowsUnsupportedOperationException.CalendarDateget(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.intgetLength()Gets the number of entries in this list.ListenerList<ListListener<CalendarDate>>getListListeners()Returns the list listener list.intindexOf(CalendarDate item)Returns the index of an item in the sequence.booleanisEmpty()Tests the emptiness of the collection.java.util.Iterator<CalendarDate>iterator()voidsetComparator(java.util.Comparator<CalendarDate> comparator)ThrowsUnsupportedOperationExceptionbecause 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 newCalendarDateSpinnerDatabounded from1900-01-01to2099-12-31.
-
CalendarDateSpinnerData
public CalendarDateSpinnerData(CalendarDate lowerBound, CalendarDate upperBound)
Creates a newCalendarDateSpinnerDatabounded 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:
getin 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:SequenceReturns the index of an item in the sequence.- Specified by:
indexOfin 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:
clearin interfaceCollection<CalendarDate>- Specified by:
clearin interfaceList<CalendarDate>- See Also:
ListListener.itemsRemoved(List, int, Sequence)
-
isEmpty
public final boolean isEmpty()
Description copied from interface:CollectionTests the emptiness of the collection.- Specified by:
isEmptyin interfaceCollection<CalendarDate>- Returns:
trueif the collection contains no elements;false, otherwise.
-
getLength
public int getLength()
Gets the number of entries in this list.- Specified by:
getLengthin interfaceList<CalendarDate>- Specified by:
getLengthin 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:
getComparatorin interfaceCollection<CalendarDate>- Returns:
- The comparator used to order elements in the collection, or
nullif the sort order is undefined. - See Also:
Collection.setComparator(Comparator)
-
setComparator
@UnsupportedOperation public final void setComparator(java.util.Comparator<CalendarDate> comparator)
ThrowsUnsupportedOperationExceptionbecause the generated data is inherently in date order, thus sorting makes no sense.- Specified by:
setComparatorin interfaceCollection<CalendarDate>- Specified by:
setComparatorin 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:
iteratorin interfacejava.lang.Iterable<CalendarDate>
-
getListListeners
public final ListenerList<ListListener<CalendarDate>> getListListeners()
Description copied from interface:ListReturns the list listener list.- Specified by:
getListListenersin interfaceList<CalendarDate>- Returns:
- The list of listeners for this list.
-
-