ca.odell.glazedlists.migrationkit
Class AbstractFilterList

java.lang.Object
  extended by ca.odell.glazedlists.AbstractEventList<E>
      extended by ca.odell.glazedlists.TransformedList
          extended by ca.odell.glazedlists.migrationkit.AbstractFilterList
All Implemented Interfaces:
ListEventListener, EventList, Iterable, Collection, EventListener, List

Deprecated. This class uses inheritance when composition is preferrable. By replacing the overriding method filterMatches(Object) with a Matcher or MatcherEditor, logic can be reused. That approach is far more flexible and powerful than the static filtering required by AbstractFilterList.

public abstract class AbstractFilterList
extends TransformedList

An EventList that shows a subset of the elements of a source EventList. This subset is composed of all elements of the source EventList that match the filter.

The filter can be static or dynamic. Changing the behaviour of the filter will change which elements of the source list are included.

Extending classes define the filter by implementing the method filterMatches(Object).

Extending classes must call handleFilterChanged() when the filter has changed in order to update the subset of included elements. This method must also be called at the end of the extending class's constructor.

Warning: This class breaks the contract required by List. See EventList for an example.

EventList Overview
Writable:yes
Concurrency:thread ready, not thread safe
Performance:reads: O(log N), writes O(log N), filter changes O(N)
Memory:0 to 26 bytes per element
Unit Tests:N/A
Issues:N/A

Since:
2004
Author:
Jesse Wilson

Field Summary
 
Fields inherited from class ca.odell.glazedlists.TransformedList
source
 
Fields inherited from class ca.odell.glazedlists.AbstractEventList
publisher, readWriteLock, updates
 
Constructor Summary
protected AbstractFilterList(EventList source)
          Deprecated. Creates a AbstractFilterList that includes a subset of the specified source EventList.
 
Method Summary
 void dispose()
          Deprecated. Releases the resources consumed by this TransformedList so that it may eventually be garbage collected.
abstract  boolean filterMatches(Object element)
          Deprecated. Tests if the specified item from the source EventList is matched by the current filter.
protected  void handleFilterChanged()
          Deprecated. Handles changes to the behavior of the filter.
protected  void handleFilterCleared()
          Deprecated. Handles a clearing of the filter.
protected  void handleFilterConstrained()
          Deprecated. Handles a constraining or narrowing of the filter.
protected  void handleFilterRelaxed()
          Deprecated. Handles a relaxing or widening of the filter.
protected  boolean isWritable()
          Deprecated. Gets whether the source EventList is writable via this API.
 void listChanged(ListEvent listChanges)
          Deprecated. When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.

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.

 
Methods inherited from class ca.odell.glazedlists.TransformedList
add, addAll, clear, get, getSourceIndex, remove, removeAll, retainAll, set, size
 
Methods inherited from class ca.odell.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

AbstractFilterList

protected AbstractFilterList(EventList source)
Deprecated. 
Creates a AbstractFilterList that includes a subset of the specified source EventList.

Extending classes must call handleFilterChanged().

Method Detail

handleFilterCleared

protected void handleFilterCleared()
Deprecated. 
Handles a clearing of the filter. That is, the filter list will act as a passthrough and not discriminate any of the elements of the wrapped source list.


handleFilterRelaxed

protected final void handleFilterRelaxed()
Deprecated. 
Handles a relaxing or widening of the filter. This may change the contents of this EventList as filtered elements are unfiltered due to the relaxation of the filter.

Warning: This method is thread ready but not thread safe. See EventList for an example of thread safe code.


handleFilterConstrained

protected final void handleFilterConstrained()
Deprecated. 
Handles a constraining or narrowing of the filter. This may change the contents of this EventList as elements are further filtered due to the constraining of the filter.

Warning: This method is thread ready but not thread safe. See EventList for an example of thread safe code.


handleFilterChanged

protected final void handleFilterChanged()
Deprecated. 
Handles changes to the behavior of the filter. This may change the contents of this EventList as elements are filtered and unfiltered.

Warning: This method is thread ready but not thread safe. See EventList for an example of thread safe code.


filterMatches

public abstract boolean filterMatches(Object element)
Deprecated. 
Tests if the specified item from the source EventList is matched by the current filter.

Returns:
true for elements that match the filter and shall be included in this EventList or false for elements that shall not be included in this EventList.

listChanged

public void listChanged(ListEvent listChanges)
Deprecated. 
When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.

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.

Specified by:
listChanged in interface ListEventListener
Specified by:
listChanged in class TransformedList

isWritable

protected boolean isWritable()
Deprecated. 
Gets whether the source EventList is writable via this API.

Extending classes must override this method in order to make themselves writable.

Overrides:
isWritable in class TransformedList

dispose

public void dispose()
Deprecated. 
Releases the resources consumed by this TransformedList so that it may eventually be garbage collected.

A TransformedList will be garbage collected without a call to TransformedList.dispose(), but not before its source EventList is garbage collected. By calling TransformedList.dispose(), you allow the TransformedList to be garbage collected before its source EventList. This is necessary for situations where a TransformedList is short-lived but its source EventList is long-lived.

Warning: It is an error to call any method on a TransformedList after it has been disposed.

Overrides:
dispose in class TransformedList


Glazed Lists 1.5.0, Copyright © 2003-2005 publicobject.com, O'Dell Engineering.
Documentation build by James Lemieux at 2005-12-21 23:25