@ExtensionPoint public abstract class Filter<T> extends Object
Filter
decides if some information matches what this
filter is designed to work with. The exact meaning of the
word "match" depends on the context this filter is applied.
String
filter that match for all the input containing
the word "test" would return true
for both "a test" or "testing",
but false
for the mispelled word "tesst". This example filter could
then be used to implement a search function, by testing various strings
and only showing the ones that match this filter.
Filter.FilterEvent
listeners and the Filter
implementation should notify of Filter.FilterEvent.FILTER_CHANGED
events.
String
filter. If such filter
was used in a search context, the filter could react to user input and
change the string to be used as matcher. At each matcher change, it should
notify its listeners that such change occurred in order to allow correct
re-processing of the filter.Modifier and Type | Class and Description |
---|---|
static class |
Filter.FilterEvent |
Constructor and Description |
---|
Filter() |
Modifier and Type | Method and Description |
---|---|
void |
addFilterEventListener(ActionListener<Filter.FilterEvent> listener) |
abstract boolean |
matches(T toMatch)
Return
true if this filter match the given input, false
otherwise. |
protected void |
notify(Filter.FilterEvent action)
Notify all the listeners that a change occurred in this filter.
|
void |
removeFilterEventListener(ActionListener<Filter.FilterEvent> listener) |
public abstract boolean matches(T toMatch)
true
if this filter match the given input, false
otherwise.public void addFilterEventListener(ActionListener<Filter.FilterEvent> listener)
public void removeFilterEventListener(ActionListener<Filter.FilterEvent> listener)
protected void notify(Filter.FilterEvent action)
Copyright © 2016. All rights reserved.