|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.tools.swing.patternfilter.PatternEventPoster
PatternEventPoster is a tool for monitoring text changes in a javax.swing.Document, constructing a pattern from the text and then posting the pattern for use in filtering items by name. Most often this will be used to monitor a text field and generate a pattern filter based on the user's input. The pattern filter may be used to filter a JList or JTable or other list of named items in real time.
| Nested Class Summary | |
protected class |
PatternEventPoster.DocumentHandler
Internal class for monitoring a document's text and handling the events by updating the text which forces an update of the pattern filter. |
| Field Summary | |
protected javax.swing.text.Document |
_document
|
protected PatternEventPoster.DocumentHandler |
_documentHandler
|
protected MessageCenter |
_messageCenter
|
protected java.util.regex.Pattern |
_pattern
|
protected int |
_patternFlags
|
protected PatternGenerator |
_patternGenerator
|
protected PatternChangeListener |
_proxy
|
protected boolean |
_queueExists
|
protected java.lang.String |
_queueText
|
protected Lock |
PROCESS_LOCK
|
protected java.lang.Object |
QUEUE_LOCK
|
| Constructor Summary | |
PatternEventPoster(javax.swing.text.Document document)
Constructor which uses the pattern generator for checking if the matching text is contained in the items. |
|
PatternEventPoster(javax.swing.text.Document document,
boolean caseSensitive)
Constructor which uses the pattern generator for checking if the matching text is contained in the items. |
|
PatternEventPoster(javax.swing.text.Document document,
int patternFlags)
Constructor which uses the pattern generator for checking if the matching text is contained in the items. |
|
PatternEventPoster(javax.swing.text.Document document,
PatternGenerator patternGenerator,
boolean caseSensitive)
Constructor which uses the pattern generator for checking if the matching text is contained in the items. |
|
PatternEventPoster(javax.swing.text.Document document,
PatternGenerator patternGenerator,
int patternFlags)
Primary constructor |
|
| Method Summary | |
void |
addPatternChangeListener(PatternChangeListener listener)
Add a listener of pattern change events |
protected java.lang.String |
getDocumentText()
Get the text from the monitored document. |
java.util.regex.Pattern |
getPattern()
Get the pattern |
void |
removePatternChangeListener(PatternChangeListener listener)
Remove a listener of pattern change events |
protected void |
setDocument(javax.swing.text.Document document)
Set the document to monitor for the text that generates the pattern filters. |
protected void |
updatePattern()
Update the pattern based on the latest document text and post the pattern change event to the listeners. |
protected void |
updateText()
Update the text from the monitored document and then update the pattern accordingly |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected MessageCenter _messageCenter
protected PatternChangeListener _proxy
protected final java.lang.Object QUEUE_LOCK
protected final Lock PROCESS_LOCK
protected volatile java.lang.String _queueText
protected volatile boolean _queueExists
protected PatternEventPoster.DocumentHandler _documentHandler
protected javax.swing.text.Document _document
protected volatile java.util.regex.Pattern _pattern
protected PatternGenerator _patternGenerator
protected int _patternFlags
| Constructor Detail |
public PatternEventPoster(javax.swing.text.Document document,
PatternGenerator patternGenerator,
int patternFlags)
document - The document to monitor for text changespatternGenerator - the generator used to convert the document text to a patternpatternFlags - the pattern flags used to compile a pattern using Pattern.compile()Pattern
public PatternEventPoster(javax.swing.text.Document document,
int patternFlags)
document - The document to monitor for text changespatternFlags - the pattern flags used to compile a pattern using Pattern.compile()
public PatternEventPoster(javax.swing.text.Document document,
boolean caseSensitive)
document - The document to monitor for text changescaseSensitive - true to enforce case sensitive matching and false to ignore it
public PatternEventPoster(javax.swing.text.Document document,
PatternGenerator patternGenerator,
boolean caseSensitive)
document - The document to monitor for text changespatternGenerator - the generator used to convert the document text to a patterncaseSensitive - true to enforce case sensitive matching and false to ignore itpublic PatternEventPoster(javax.swing.text.Document document)
document - The document to monitor for text changes| Method Detail |
public void addPatternChangeListener(PatternChangeListener listener)
listener - the listener to add for receiving pattern change eventspublic void removePatternChangeListener(PatternChangeListener listener)
listener - the listener to remove from receiving pattern change eventspublic java.util.regex.Pattern getPattern()
protected void updatePattern()
protected void updateText()
protected java.lang.String getDocumentText()
protected void setDocument(javax.swing.text.Document document)
document - the new document to monitor for text patterns
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||