ca.odell.glazedlists

Class FreezableList<E>

Implemented Interfaces:
EventListener, EventList<E>, List, ListEventListener<E>

public final class FreezableList<E>
extends TransformedList<S,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.

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:
Author:
Jesse Wilson

Field Summary

Fields inherited from class ca.odell.glazedlists.TransformedList<S,E>

source

Fields inherited from class ca.odell.glazedlists.AbstractEventList<E>

publisher, readWriteLock, updates

Constructor Summary

FreezableList(EventList 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)
boolean
isFrozen()
Gets whether this EventList is showing a previous state of the source EventList.
protected boolean
isWritable()
void
listChanged(ListEvent listChanges)
int
size()
void
thaw()
Unlocks this FreezableList to show the same contents of the source EventList.

Methods inherited from class ca.odell.glazedlists.TransformedList<S,E>

add, addAll, clear, dispose, get, getSourceIndex, isWritable, listChanged, remove, removeAll, retainAll, set, size

Methods inherited from class ca.odell.glazedlists.AbstractEventList<E>

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

Constructor Details

FreezableList

public FreezableList(EventList source)
Creates a FreezableList that can freeze the view of the specified source EventList.

Method Details

freeze

public void freeze()
Locks this 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.


get

public E get(int index)
Overrides:
get in interface TransformedList<S,E>

isFrozen

public boolean isFrozen()
Gets whether this EventList is showing a previous state of the source EventList.
Returns:
true if this list is showing a previous state of the source EventList or false if this is showing the current state of the source EventList.

isWritable

protected boolean isWritable()
Overrides:
isWritable in interface TransformedList<S,E>

listChanged

public void listChanged(ListEvent listChanges)
Specified by:
listChanged in interface ListEventListener<E>

size

public int size()
Overrides:
size in interface TransformedList<S,E>

thaw

public void thaw()
Unlocks this 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.


Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2007-12-21 23:49