com.levigo.util.base.glazedlists.matchers
Class SearchEngineTextMatcherEditor<E>

java.lang.Object
  extended by com.levigo.util.base.glazedlists.matchers.AbstractMatcherEditor<E>
      extended by com.levigo.util.base.glazedlists.matchers.TextMatcherEditor<E>
          extended by com.levigo.util.base.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
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 com.levigo.util.base.glazedlists.matchers.MatcherEditor
MatcherEditor.Event<E>, MatcherEditor.Listener<E>
 
Field Summary
 
Fields inherited from class com.levigo.util.base.glazedlists.matchers.TextMatcherEditor
CONTAINS, EXACT, IDENTICAL_STRATEGY, NORMALIZED_STRATEGY, REGULAR_EXPRESSION, STARTS_WITH
 
Fields inherited from class com.levigo.util.base.glazedlists.matchers.AbstractMatcherEditor
currentMatcher
 
Constructor Summary
SearchEngineTextMatcherEditor()
          Creates a SearchEngineTextMatcherEditor whose Matchers can test only elements which implement the TextFilterable interface.
SearchEngineTextMatcherEditor(TextFilterator<? super E> textFilterator)
          Creates a SearchEngineTextMatcherEditor with the given textFilterator.
 
Method Summary
 Set<SearchEngineTextMatcherEditor.Field<E>> getFields()
           
 void refilter(String inputText)
          Creates and applies a new TextMatcher based on the given input text.
 void setFields(Set<SearchEngineTextMatcherEditor.Field<E>> fields)
          Replaces the current set of search fields.
 
Methods inherited from class com.levigo.util.base.glazedlists.matchers.TextMatcherEditor
getCurrentTextMatcher, getFilterator, getMode, getStrategy, setFilterator, setFilterText, setMode, setStrategy, setTextMatcher
 
Methods inherited from class com.levigo.util.base.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

SearchEngineTextMatcherEditor

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


SearchEngineTextMatcherEditor

public SearchEngineTextMatcherEditor(TextFilterator<? super E> textFilterator)
Creates a SearchEngineTextMatcherEditor with the given textFilterator.

Parameters:
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.
Method Detail

setFields

public void setFields(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 Set<SearchEngineTextMatcherEditor.Field<E>> getFields()
Returns:
a copy of the defined search fields

refilter

public void refilter(String inputText)
Creates and applies a new TextMatcher based on the given input text.

Parameters:
inputText - input text (not null) that is parsed into search terms for the new text matcher


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.