Package ca.odell.glazedlists.matchers
Class SearchEngineTextMatcherEditor<E>
- java.lang.Object
-
- ca.odell.glazedlists.matchers.AbstractMatcherEditorListenerSupport<E>
-
- ca.odell.glazedlists.matchers.AbstractMatcherEditor<E>
-
- ca.odell.glazedlists.matchers.TextMatcherEditor<E>
-
- ca.odell.glazedlists.matchers.SearchEngineTextMatcherEditor<E>
-
- All Implemented Interfaces:
MatcherEditor<E>
- Direct Known Subclasses:
SearchEngineTextFieldMatcherEditor
public class SearchEngineTextMatcherEditor<E> extends TextMatcherEditor<E>
A MatcherEditor that matches Objects against search text in a format similiar to search engines. It supports fielded data and search terms (city:Toronto
), phrases (city:"New York"
), the "+" or required operator as well as the "-" or prohibit operator.This MatcherEditor is fully concrete, but GUI toolkit agnostic, as the search text is passed into the
refilter
method.Subclasses for Swing and SWT applications are provided that present a text filtering interface similar to that of Google and other search engines.
- Author:
- James Lemieux, Holger Brands
- See Also:
refilter(String)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchEngineTextMatcherEditor.Field<E>
A Field object contains information specific to a given field found within the Objects being text matched.-
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
-
-
Constructor Summary
Constructors Constructor Description SearchEngineTextMatcherEditor()
Creates a SearchEngineTextMatcherEditor whose Matchers can test only elements which implement theTextFilterable
interface.SearchEngineTextMatcherEditor(TextFilterator<? super E> textFilterator)
Creates a SearchEngineTextMatcherEditor with the giventextFilterator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<SearchEngineTextMatcherEditor.Field<E>>
getFields()
void
refilter(java.lang.String inputText)
Creates and applies a newTextMatcher
based on the given input text.void
setFields(java.util.Set<SearchEngineTextMatcherEditor.Field<E>> fields)
Replaces the current set of search fields.-
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
fireChanged, fireConstrained, fireMatchAll, fireMatchNone, fireRelaxed, getMatcher, isCurrentlyMatchingAll, isCurrentlyMatchingNone
-
Methods inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditorListenerSupport
addMatcherEditorListener, createChangedEvent, createConstrainedEvent, createMatchAllEvent, createMatchNoneEvent, createRelaxedEvent, fireChangedMatcher, removeMatcherEditorListener
-
-
-
-
Constructor Detail
-
SearchEngineTextMatcherEditor
public SearchEngineTextMatcherEditor()
Creates a SearchEngineTextMatcherEditor whose Matchers can test only elements which implement theTextFilterable
interface.
-
SearchEngineTextMatcherEditor
public SearchEngineTextMatcherEditor(TextFilterator<? super E> textFilterator)
Creates a SearchEngineTextMatcherEditor with the giventextFilterator
.- Parameters:
textFilterator
- an object capable of producing Strings from the objects being filtered. IftextFilterator
isnull
then all filtered objects are expected to implementTextFilterable
.
-
-
Method Detail
-
setFields
public void setFields(java.util.Set<SearchEngineTextMatcherEditor.Field<E>> fields)
Replaces the current set of search fields. This method does not trigger a refilter.- Parameters:
fields
- the new search fields to use- See Also:
refilter(String)
-
getFields
public java.util.Set<SearchEngineTextMatcherEditor.Field<E>> getFields()
- Returns:
- a copy of the defined search fields
-
refilter
public void refilter(java.lang.String inputText)
Creates and applies a newTextMatcher
based on the given input text.- Parameters:
inputText
- input text (notnull
) that is parsed into search terms for the new text matcher
-
-