TextMatcherEditor filters by all or any filter strings?

View: New views
2 Messages — Rating Filter:   Alert me  

TextMatcherEditor filters by all or any filter strings?

by SimonB2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list

I'm trying to filter a table using a TextMatcherEditor. Specifically I want the table to show rows that contain any of the terms in the array of strings I pass through to #setFilterText(String[] newFilters). The documentation suggests this should work:

CONTAINS will produce Matcher objects that test if at least one searchable string for an Object contains one of the filter strings anywhere within itself.

However the behaviour I see is that the rows that are displayed are those that contain all of the terms. Should the documentation read "... contains all of the filter strings ..." or am I missing something?

Thanks
Simon

Re: TextMatcherEditor filters by all or any filter strings?

by James Lemieux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Simon,

   Yeah, that is poorly worded documentation and should be updated; my apologies. All TextMatcher modes assume that *each* of the filter terms must be matched in some way for a given table row. The behaviour you are looking for doesn't exist in the GL core, though it can easily be manufactured out of its parts.

Subclass TextComponentMatcherEditor and override setFilterText() to build a Matcher from the String[] differently. You will probably want to make a TextMatcher for each of the newFilters and then "or" them together using Matchers.or(...);

As a start you can then start by calling fireChanged(newOrMatcher);

If performance is a concern you can start doing the tricky logic to determine when to call fireConstrained() or fireRelaxed() instead of fireChanged().

Hope this helps,

James

On Sun, May 10, 2009 at 8:38 PM, SimonB2 <simon@...> wrote:

Hi list

I'm trying to filter a table using a TextMatcherEditor. Specifically I want
the table to show rows that contain any of the terms in the array of strings
I pass through to #setFilterText(String[] newFilters). The documentation
suggests this should work:

CONTAINS will produce Matcher objects that test if at least one searchable
string for an Object contains one of the filter strings anywhere within
itself.

However the behaviour I see is that the rows that are displayed are those
that contain all of the terms. Should the documentation read "... contains
all of the filter strings ..." or am I missing something?

Thanks
Simon

--
View this message in context: http://www.nabble.com/TextMatcherEditor-filters-by-all-or-any-filter-strings--tp23476700p23476700.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...