|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.base.glazedlists.AbstractEventList<E> com.levigo.util.base.glazedlists.TransformedList<E,E> com.levigo.util.base.glazedlists.FreezableList<E>
public final class FreezableList<E>
An EventList
that shows the current contents of its source EventList
.
When this EventList
is frozen, changes to its source EventList
will not be
reflected. Instead, the FreezableList
will continue to show the state of its source
EventList
at the time it was frozen.
When this EventList
is thawed, changes to its source EventList
will be
reflected.
Warning: This class is thread ready but not thread
safe. See EventList
for an example of thread safe code.
EventList Overview | |
Writable: | writable when thawed (default), not writable when frozen |
Concurrency: | thread ready, not thread safe |
Performance: | reads: O(1), writes O(1), freezes O(N) |
Memory: | frozen: 4 bytes per element, thawed: 0 bytes per element |
Unit Tests: | N/A |
Issues: | N/A |
Issues: |
Field Summary |
---|
Fields inherited from class com.levigo.util.base.glazedlists.TransformedList |
---|
source |
Fields inherited from class com.levigo.util.base.glazedlists.AbstractEventList |
---|
publisher, readWriteLock, updates |
Constructor Summary | |
---|---|
FreezableList(EventList<E> source)
Creates a FreezableList that can freeze the view of the specified
source EventList . |
Method Summary | |
---|---|
void |
freeze()
Locks this FreezableList on the current state of the source
EventList . |
E |
get(int index)
Returns the element at the specified position in this list. |
boolean |
isFrozen()
Gets whether this EventList is showing a previous state of the source
EventList . |
protected boolean |
isWritable()
Gets whether the source EventList is writable via this API. |
void |
listChanged(ListEvent<E> listChanges)
When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary. |
int |
size()
Returns the number of elements in this list. |
void |
thaw()
Unlocks this FreezableList to show the same contents of the source
EventList . |
Methods inherited from class com.levigo.util.base.glazedlists.TransformedList |
---|
add, addAll, clear, dispose, getSourceIndex, remove, removeAll, retainAll, set |
Methods inherited from class com.levigo.util.base.glazedlists.AbstractEventList |
---|
add, addAll, addListEventListener, contains, containsAll, equals, getPublisher, getReadWriteLock, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeListEventListener, subList, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FreezableList(EventList<E> source)
FreezableList
that can freeze the view of the specified
source EventList
.
Method Detail |
---|
public E get(int index)
get
in interface List<E>
get
in class TransformedList<E,E>
index
- index of element to return.
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class TransformedList<E,E>
protected boolean isWritable()
EventList
is writable via this API.
Extending classes must override this method in order to make themselves writable.
isWritable
in class TransformedList<E,E>
public boolean isFrozen()
EventList
is showing a previous state of the source
EventList
.
EventList
or false if this is showing the current state
of the source EventList
.public void freeze()
FreezableList
on the current state of the source
EventList
. While frozen, changes to the source EventList
will not be reflected by this list.
Warning: This method is
thread ready but not thread safe. See EventList
for an example
of thread safe code.
public void thaw()
FreezableList
to show the same contents of the source
EventList
. When thawed, changes to the source EventList
will be reflected by this list.
Warning: This method is
thread ready but not thread safe. See EventList
for an example
of thread safe code.
public void listChanged(ListEvent<E> listChanges)
It is mandatory that the calling thread has obtained the write lock on the source list. This is because the calling thread will have written to the source list to cause this event. This condition guarantees that no writes can occur while the listener is handling this event. It is an error to write to the source list while processing an event.
listChanged
in interface ListEventListener<E>
listChanged
in class TransformedList<E,E>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |