ca.odell.glazedlists.matchers
Class TextMatcherEditor<E>

java.lang.Object
  extended by ca.odell.glazedlists.matchers.AbstractMatcherEditor<E>
      extended by ca.odell.glazedlists.matchers.TextMatcherEditor<E>
All Implemented Interfaces:
MatcherEditor<E>
Direct Known Subclasses:
TextComponentMatcherEditor, TextWidgetMatcherEditor

public class TextMatcherEditor<E>
extends AbstractMatcherEditor<E>

A matcher editor that matches Objects that contain a filter text string. This TextMatcherEditor is not coupled with any UI component that allows the user to edit the filter text. That job is left to subclasses. This matcher editor is fully concrete, and may be used directly by headless applications.

The TextMatcherEditor requires that either a TextFilterator be specified in its constructor, or that every Object to be matched implements the TextFilterable interface. These are used to extract the searchable Strings for each Object.

TextMatcherEditor is able to operate in one of two modes.

Author:
James Lemieux, Jesse Wilson

Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.odell.glazedlists.matchers.MatcherEditor
MatcherEditor.Event<E>, MatcherEditor.Listener<E>
 
Field Summary
static int CONTAINS
          Matching mode where items are considered a match if at least one of the filter strings extracted from an object contains one of the given search strings.
static int STARTS_WITH
          Matching mode where items are considered a match if at least one of the filter strings extracted from an object starts with one of the given search strings.
 
Fields inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditor
currentMatcher
 
Constructor Summary
TextMatcherEditor()
          Creates a TextMatcherEditor whose Matchers can test only elements which implement the TextFilterable interface.
TextMatcherEditor(TextFilterator<E> filterator)
          Creates a TextMatcherEditor that matches Objects using the specified TextFilterator to get the Strings to search.
 
Method Summary
 TextFilterator getFilterator()
          Get the filterator used to extract Strings from the matched elements.
 int getMode()
          Returns the behaviour mode for this TextMatcherEditor.
 void setFilterText(String[] newFilters)
          Adjusts the filters of this TextMatcherEditor and fires a change to the Matcher.
 void setMode(int mode)
          Modify the behaviour of this TextMatcherEditor to one of the predefined modes.
 
Methods inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditor
addMatcherEditorListener, fireChanged, fireChangedMatcher, fireConstrained, fireMatchAll, fireMatchNone, fireRelaxed, getMatcher, removeMatcherEditorListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTAINS

public static final int CONTAINS
Matching mode where items are considered a match if at least one of the filter strings extracted from an object contains one of the given search strings.

See Also:
Constant Field Values

STARTS_WITH

public static final int STARTS_WITH
Matching mode where items are considered a match if at least one of the filter strings extracted from an object starts with one of the given search strings.

See Also:
Constant Field Values
Constructor Detail

TextMatcherEditor

public TextMatcherEditor()
Creates a TextMatcherEditor whose Matchers can test only elements which implement the TextFilterable interface.

The Matchers from this MatcherEditor will fire a ClassCastException when called with an Object that does not implement TextFilterable.


TextMatcherEditor

public TextMatcherEditor(TextFilterator<E> filterator)
Creates a TextMatcherEditor that matches Objects using the specified TextFilterator to get the Strings to search.

Parameters:
filterator - the object that will extract filter Strings from each object in the source; null indicates the list elements implement TextFilterable
Method Detail

getFilterator

public TextFilterator getFilterator()
Get the filterator used to extract Strings from the matched elements.


setMode

public void setMode(int mode)
Modify the behaviour of this TextMatcherEditor to one of the predefined modes.

Parameters:
mode - either CONTAINS or STARTS_WITH.

getMode

public int getMode()
Returns the behaviour mode for this TextMatcherEditor.

Returns:
one of CONTAINS (default) or STARTS_WITH

setFilterText

public void setFilterText(String[] newFilters)
Adjusts the filters of this TextMatcherEditor and fires a change to the Matcher.

Parameters:
newFilters - the Strings representing all of the filter values


Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by jessewilson at 2006-05-23 22:33