ca.odell.glazedlists
Class CollectionList<S,E>
- EventListener, EventList<E>, List, ListEventListener<E>
public class CollectionList<S,E>
A list that acts like a tree in that it contains child elements to nodes
contained in another list. An example usage would be to wrap a parent list
containing albums and use the CollectionList to display the songs on the
album.
The actual mapping from the parent list to the child list (album to
songs in the above example) is done by a
CollectionList.Model
that
is provided to the constructor.
Note that any
EventList
s returned by the
CollectionList.Model
must use the same
ListEventPublisher
and
ReadWriteLock
as this
CollectionList
. This is necessary in order for CollectionList to
operate correctly under mult-threaded conditions. An
IllegalArgumentException
will be raised if this invariant is violated.
Warning: This class is
thread ready but not thread safe. See
EventList
for an example
of thread safe code.
EventList Overview |
Writable: | only set(int,Object) and remove(int) |
Concurrency: | thread ready, not thread safe |
Performance: | reads: O(log N), writes O(log N) |
Memory: | 96 bytes per element |
Unit Tests: | N/A |
Issues: |
96
162
257
265
|
int | childEndingIndex(int parentIndex) - Return the index of the last child in the CollectionList for the given
parent index.
|
int | childStartingIndex(int parentIndex) - Return the index of the first child in the CollectionList for the given
parent index.
|
void | dispose()
|
E | get(int index) -
|
protected boolean | isWritable()
|
void | listChanged(ListEvent listChanges) - Handle changes in the parent list.
|
E | remove(int index) -
|
E | set(int index, E value) -
|
int | size() -
|
add , addAll , clear , dispose , get , getSourceIndex , isWritable , listChanged , remove , removeAll , retainAll , set , size |
T[] toArray , add , add , addAll , addAll , addListEventListener , clear , contains , containsAll , equals , get , getPublisher , getReadWriteLock , hashCode , indexOf , isEmpty , iterator , lastIndexOf , listIterator , listIterator , remove , remove , removeAll , removeListEventListener , retainAll , set , size , subList , toArray , toString |
CollectionList
public CollectionList(EventList source,
Model model)
source
- an EventList of Objects from each of which the
model
can extract child elementsmodel
- the logic for extracting children from each
source
element
childEndingIndex
public int childEndingIndex(int parentIndex)
Return the index of the last child in the CollectionList for the given
parent index. This can be very useful for things like selecting the
children in a CollectionList when the parent is selected in another list.
childStartingIndex
public int childStartingIndex(int parentIndex)
Return the index of the first child in the CollectionList for the given
parent index. This can be very useful for things like selecting the
children in a CollectionList when the parent is selected in another list.
listChanged
public void listChanged(ListEvent listChanges)
Handle changes in the parent list. We'll need to update our node list
sizes.
- listChanged in interface TransformedList<S,E>
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2009-07-14 22:05