ca.odell.glazedlists.migrationkit.swing
Class TextFilterList

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

Deprecated. This class uses inheritance when composition is preferrable. Instead of TextFilterList, use FilterList and TextComponentMatcherEditor.

public class TextFilterList
extends TransformedList

An EventList that shows only elements that contain a filter text string. The TextFilterList uses a JTextField to allow the user to edit the filter text. As this filter text is edited, the contents of the TextFilterList are changed to reflect the elements that match the text.

The TextFilterList either requires that a TextFilterator be specified in its constructor, or that every object in the source list implements the TextFilterable interface. These are used to specify the Strings to search for each element.

The TextFilterList initially refilters the list after each change in the JTextField. If this live filtering does not have adequate performance, it can be turned off. In this case, the list will refiltered by pressing ENTER in the JTextField and on every action to the ActionListener. This ActionListener will be returned from the method getFilterActionListener() and can be used to refilter in response to a button click.

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:O(N)
Unit Tests:N/A
Issues:N/A

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
TextFilterList(EventList source)
          Deprecated. Creates a TextFilterList that filters the specified EventList of elements that implement the TextFilterable interface.
TextFilterList(EventList source, String[] propertyNames)
          Deprecated. Creates a TextFilterList that filters the specified EventList of elements using the JavaBeans property names specified to get the Strings to search.
TextFilterList(EventList source, String[] propertyNames, JTextField filterEdit)
          Deprecated. Creates a TextFilterList that filters the specified EventList of elements using the JavaBeans property names specified to get the Strings to search.
TextFilterList(EventList source, TextFilterator filterator)
          Deprecated. Creates a TextFilterList that filters the specified EventList of elements using the specified TextFilterator to get the Strings to search.
TextFilterList(EventList source, TextFilterator filterator, JTextField filterEdit)
          Deprecated. Creates a TextFilterList that filters the specified EventList of elements using the specified TextFilterator to get the Strings to search.
 
Method Summary
 void dispose()
          Deprecated. Releases the resources consumed by this TransformedList so that it may eventually be garbage collected.
 ActionListener getFilterActionListener()
          Deprecated. Gets an ActionListener that refilters the list when it is fired.
 JTextField getFilterEdit()
          Deprecated. Gets the JTextField used to edit the filter search String.
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.

 void setFilterEdit(JTextField filterEdit)
          Deprecated. Sets the JTextField used to edit the filter search String.
 void setLive(boolean live)
          Deprecated. Directs this filter to respond to changes to the JTextField as they are made.
 
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

TextFilterList

public TextFilterList(EventList source)
Deprecated. 
Creates a TextFilterList that filters the specified EventList of elements that implement the TextFilterable interface.


TextFilterList

public TextFilterList(EventList source,
                      TextFilterator filterator)
Deprecated. 
Creates a TextFilterList that filters the specified EventList of elements using the specified TextFilterator to get the Strings to search.


TextFilterList

public TextFilterList(EventList source,
                      String[] propertyNames)
Deprecated. 
Creates a TextFilterList that filters the specified EventList of elements using the JavaBeans property names specified to get the Strings to search.

Note that the classes which will be obfuscated may not work with reflection. In this case, implement a TextFilterator manually.

Parameters:
propertyNames - an array of property names in the JavaBeans format. For example, if your list contains Objects with the methods getFirstName(), setFirstName(String), getAge(), setAge(Integer), then this array should contain the two strings "firstName" and "age". This format is specified by the JavaBeans PropertyDescriptor.

TextFilterList

public TextFilterList(EventList source,
                      String[] propertyNames,
                      JTextField filterEdit)
Deprecated. 
Creates a TextFilterList that filters the specified EventList of elements using the JavaBeans property names specified to get the Strings to search.

Note that the classes which will be obfuscated may not work with reflection. In this case, implement a TextFilterator manually.

Parameters:
propertyNames - an array of property names in the JavaBeans format. For example, if your list contains Objects with the methods getFirstName(), setFirstName(String), getAge(), setAge(Integer), then this array should contain the two strings "firstName" and "age". This format is specified by the JavaBeans PropertyDescriptor.
filterEdit - a text field for typing in the filter text.

TextFilterList

public TextFilterList(EventList source,
                      TextFilterator filterator,
                      JTextField filterEdit)
Deprecated. 
Creates a TextFilterList that filters the specified EventList of elements using the specified TextFilterator to get the Strings to search.

Parameters:
filterEdit - a text field for typing in the filter text.
Method Detail

getFilterEdit

public JTextField getFilterEdit()
Deprecated. 
Gets the JTextField used to edit the filter search String.


setFilterEdit

public void setFilterEdit(JTextField filterEdit)
Deprecated. 
Sets the JTextField used to edit the filter search String.


setLive

public void setLive(boolean live)
Deprecated. 
Directs this filter to respond to changes to the JTextField as they are made. This uses a DocumentListener and every time the JTextField is modified, the list is refiltered.

To avoid the processing overhead of filtering for each keystroke, use a not-live filter edit and trigger the ActionListener using a button or by pressing ENTER in the JTextField.


getFilterActionListener

public ActionListener getFilterActionListener()
Deprecated. 
Gets an ActionListener that refilters the list when it is fired. This listener can be used to filter when the user presses a button.


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