ca.odell.glazedlists
Class ObservableElementList<E>
- EventListener, EventList<E>, List, ListEventListener<E>
public class ObservableElementList<E>
A list that fires update events whenever elements are modified in place.
Changes to list elements are detected by registering an appropriate listener
on every list element. Listeners are registered as elements are added to
this list and unregistered as elements are removed from this list. Users
must specify an implementation of a
ObservableElementList.Connector
in the constructor
which contains the necessary logic for registering and unregistering a
listener capable of detecting modifications to an observable list element.
EventList Overview |
Writable: | yes |
Concurrency: | thread ready, not thread safe; elementChanged(), however, is thread ready |
Performance: | inserts: O(1), deletes: O(1), updates: O(1), elementChanged: O(n) |
Memory: | 8 bytes per element |
Unit Tests: | ObservableElementListTest |
Issues: | N/A |
GlazedLists.beanConnector(Class)
, GlazedLists.beanConnector(Class, String, String)
, RFE 157
ObservableElementList(EventList source, Connector elementConnector) - Constructs an
ObservableElementList which wraps the given
source and uses the given elementConnector to
register/unregister change listeners on elements of the
source .
|
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 |
ObservableElementList
public ObservableElementList(EventList source,
Connector elementConnector)
Constructs an ObservableElementList
which wraps the given
source
and uses the given elementConnector
to
register/unregister change listeners on elements of the
source
.
source
- the EventList
to transformelementConnector
- the ObservableElementList.Connector
to consult when list
elements are added or removed and thus element listeners must be
registered or unregistered. Note that this constructor attachs
this list to the given elementConnector
by calling
Connector.setObservableElementList(ObservableElementList)
.
dispose
public void dispose()
Releases the resources consumed by this
TransformedList
so that
it may eventually be garbage collected.
In this case of this
TransformedList
, it uses the
ObservableElementList.Connector
to remove all listeners from their associated list
elements and finally removes the reference to this list from the
Connector by calling
Connector.setObservableElementList(ObservableElementList)
with a
null
argument.
Warning: It is an error
to call any method on a
TransformedList
after it has been disposed.
- dispose in interface TransformedList<S,E>
elementChanged
public void elementChanged(E listElement)
Handle a listener being fired for the specified
listElement
.
This method causes a ListEvent to be fired from this EventList indicating
an update occurred at all locations of the given
listElement
.
Note that listElement must be the exact object located within this list
(i.e.
listElement == get(i) for some i >= 0
).
This method acquires the write lock for this list before locating the
listElement
and broadcasting its update. It is assumed that
this method may be called on any Thread, so to decrease the burdens of
the caller in achieving multi-threaded correctness, this method is
Thread ready.
listElement
- the list element which has been modified
Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2007-12-21 23:49