|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.odell.glazedlists.matchers.AbstractMatcherEditor<E>
ca.odell.glazedlists.matchers.TextMatcherEditor<E>
ca.odell.glazedlists.swing.TextComponentMatcherEditor<E>
public class TextComponentMatcherEditor<E>
A MatcherEditor that matches Objects that contain the filter text located
within a Document
. This TextMatcherEditor
is directly
coupled with a Document and fires MatcherEditor changes in response to
Document changes. This matcher is fully concrete and is expected to be used
by Swing applications.
The TextComponentMatcherEditor
constructors require that either a
Document
or a JTextComponent
(from which a Document
is extracted) be specified.
The MatcherEditor registers itself as a DocumentListener
on the
given Document, or ActionListener
on the JTextComponent
for
non-live filtering. If a JTextComponent
is given on construction, it
is also watched for changes of its Document and the Document used by this
MatcherEditor is updated to reflect the latest Document behind the text
component.
If this MatcherEditor must be garbage collected before the underlying
Document, or JTextComponent, the listeners can be unregistered by calling
dispose()
.
Nested Class Summary |
---|
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 |
Fields inherited from class ca.odell.glazedlists.matchers.AbstractMatcherEditor |
---|
currentMatcher |
Constructor Summary | |
---|---|
TextComponentMatcherEditor(Document document,
TextFilterator<? super E> textFilterator)
Creates a TextMatcherEditor bound to the given document
with the given textFilterator . |
|
TextComponentMatcherEditor(JTextComponent textComponent,
TextFilterator<? super E> textFilterator,
boolean live)
Creates a TextMatcherEditor bound to the Document backing the
given textComponent with the given
textFilterator . |
|
TextComponentMatcherEditor(JTextComponent textComponent,
TextFilterator<E> textFilterator)
Creates a TextMatcherEditor bound to the Document backing the
given textComponent with the given
textFilterator . |
Method Summary | |
---|---|
void |
dispose()
A cleanup method which stops this MatcherEditor from listening to changes on the underlying Document , thus freeing the
MatcherEditor or Document to be garbage collected. |
boolean |
isLive()
Whether filtering occurs by the keystroke or not. |
void |
setLive(boolean live)
Toggle between filtering by the keystroke and not. |
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 |
---|
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 |
---|
public TextComponentMatcherEditor(JTextComponent textComponent, TextFilterator<E> textFilterator)
Document
backing the
given textComponent
with the given
textFilterator
.
textComponent
- the text component backed by the Document
that is the source of text filter valuestextFilterator
- an object capable of producing Strings from the
objects being filtered. If textFilterator
is
null
then all filtered objects are expected to
implement TextFilterable
.public TextComponentMatcherEditor(JTextComponent textComponent, TextFilterator<? super E> textFilterator, boolean live)
Document
backing the
given textComponent
with the given
textFilterator
.
textComponent
- the text component backed by the Document
that is the source of text filter valuestextFilterator
- an object capable of producing Strings from the
objects being filtered. If textFilterator
is
null
then all filtered objects are expected to
implement TextFilterable
.live
- true
to filter by the keystroke or false
to filter only when Enter
is pressed
within the JTextComponent
. Note that non-live filtering is only
supported if textComponent
is a JTextField
.
IllegalArgumentException
- if the textComponent
is not a JTextField
and non-live filtering is specified.public TextComponentMatcherEditor(Document document, TextFilterator<? super E> textFilterator)
document
with the given textFilterator
.
document
- the Document
that is the source of text filter
valuestextFilterator
- 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 |
---|
public boolean isLive()
public void setLive(boolean live)
live
- true
to filter by the keystroke or false
to filter only when Enter
is pressed
within the JTextComponent
. Note that non-live filtering is only
supported if textComponent
is a JTextField
.public void dispose()
Document
, thus freeing the
MatcherEditor or Document to be garbage collected.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |