ca.odell.glazedlists.swt
Class TextWidgetMatcherEditor<E>

java.lang.Object
  extended by ca.odell.glazedlists.matchers.AbstractMatcherEditor<E>
      extended by ca.odell.glazedlists.matchers.TextMatcherEditor<E>
          extended by ca.odell.glazedlists.swt.TextWidgetMatcherEditor<E>
All Implemented Interfaces:
MatcherEditor<E>

public final class TextWidgetMatcherEditor<E>
extends TextMatcherEditor<E>

A MatcherEditor that matches elements that contain the filter text located within a Text field. This TextWidgetMatcherEditor is directly coupled with a Text and fires MatcherEditor events in response to ModifyEvents received from the Text. This matcher is fully concrete for use in SWT applications.

If this MatcherEditor must be garbage collected before the underlying Text, the listener can be unregistered by calling dispose().

Author:
Kevin Maltby

Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.odell.glazedlists.matchers.MatcherEditor
MatcherEditor.Event<E>, MatcherEditor.Listener<E>
 
Field Summary
 
Fields inherited from class ca.odell.glazedlists.matchers.TextMatcherEditor
CONTAINS, EXACT, IDENTICAL_STRATEGY, NORMALIZED_STRATEGY, REGULAR_EXPRESSION, STARTS_WITH
 
Fields inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditor
currentMatcher
 
Constructor Summary
TextWidgetMatcherEditor(Text text, TextFilterator<E> textFilterator)
          Creates a TextWidgetMatcherEditor bound to the provided Text with the given textFilterator.
TextWidgetMatcherEditor(Text text, TextFilterator<E> textFilterator, boolean live)
          Creates a TextWidgetMatcherEditor bound to the provided Text with the given textFilterator where filtering can be specified as "live" or to be based on another event such as the user pressing Enter or a button being clicked.
 
Method Summary
 void dispose()
          A cleanup method which stops this MatcherEditor from listening to changes on the Text component, thus freeing the MatcherEditor to be garbage collected.
 SelectionListener getFilterSelectionListener()
          Gets a SelectionListener that refilters the list when it is fired.
 boolean isLive()
          Whether filtering occurs by the keystroke or not.
 void setLive(boolean live)
          Toggle between filtering by the keystroke and not.
 
Methods inherited from class ca.odell.glazedlists.matchers.TextMatcherEditor
getCurrentTextMatcher, getFilterator, getMode, getStrategy, setFilterator, setFilterText, setMode, setStrategy, setTextMatcher
 
Methods inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditor
addMatcherEditorListener, fireChanged, fireChangedMatcher, fireConstrained, fireMatchAll, fireMatchNone, fireRelaxed, getMatcher, isCurrentlyMatchingAll, isCurrentlyMatchingNone, removeMatcherEditorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextWidgetMatcherEditor

public TextWidgetMatcherEditor(Text text,
                               TextFilterator<E> textFilterator)
Creates a TextWidgetMatcherEditor bound to the provided Text with the given textFilterator.

Parameters:
text - the Text widget that drives the text-filtering
textFilterator - an object capable of producing Strings from the objects being filtered. If textFilterator is null then all filtered objects are expected to implement TextFilterable.
See Also:
GlazedLists.textFilterator(String[])

TextWidgetMatcherEditor

public TextWidgetMatcherEditor(Text text,
                               TextFilterator<E> textFilterator,
                               boolean live)
Creates a TextWidgetMatcherEditor bound to the provided Text with the given textFilterator where filtering can be specified as "live" or to be based on another event such as the user pressing Enter or a button being clicked.

Parameters:
text - the Text widget that drives the text-filtering
textFilterator - an object capable of producing Strings from the objects being filtered. If textFilterator is null then all filtered objects are expected to implement TextFilterable.
live - true to filter by the keystroke or false to filter only when the ENTER key is pressed within the Text. Optionnally, you can use the SelectionListener provided via getFilterSelectionListener() to register a Button or other component to trigger filtering.
See Also:
GlazedLists.textFilterator(String[])
Method Detail

isLive

public boolean isLive()
Whether filtering occurs by the keystroke or not.


setLive

public void setLive(boolean live)
Toggle between filtering by the keystroke and not.

Parameters:
live - true to filter by the keystroke or false to filter only when Enter is pressed within the JTextField. Note that non-live filtering is only supported if textComponent is a JTextField.

getFilterSelectionListener

public SelectionListener getFilterSelectionListener()
Gets a SelectionListener that refilters the list when it is fired. This listener can be used to filter when the user presses a 'Search' button.


dispose

public void dispose()
A cleanup method which stops this MatcherEditor from listening to changes on the Text component, thus freeing the MatcherEditor to be garbage collected. Garbage collection could be blocked if you have registered the SelectionListener provided by getFilterSelectionListener() and not removed that listener (of disposed of the widget it was registered to).



Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by James Lemieux at 2009-01-25 18:40