Package  Use  Tree  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

 

jve.generated
Class SwingPropertyFilter

java.lang.Object
  extended byjavax.swing.text.AbstractDocument
      extended byjavax.swing.text.PlainDocument
          extended byjve.generated.SwingPropertyFilter

All Implemented Interfaces:
javax.swing.text.Document, IFilterBinder, java.io.Serializable


public class SwingPropertyFilter
extends javax.swing.text.PlainDocument
implements IFilterBinder

This filter acts as a Document for a JTextComponent. The value of the text field will be used to filter an object based on a given property. The filter is a simple string contains test.

For example entering "Jon" would accept both "Jonathan Brown" and "Don Jones."

Override the accept() method to change the filtering behavior. The case sensitivity of the filter can be changed via the caseSensitive property. The default behavior ignores case.

To setup this filter, set the input text field as the filter's visualTextComponent, set the filter as the document of the text field, and set the filteredProperty that will be filtered.

See Also:
Serialized Form


Nested Class Summary
 

Nested classes inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
 

Nested classes inherited from class jve.generated.IFilterBinder
IFilterBinder.FilterChangeEvent, IFilterBinder.FilterChangeListener
 

Field Summary
protected  boolean caseSensitive
           
protected  java.lang.String filteredProperty
           
protected  java.util.List filterListeners
           
protected  java.lang.String lcValue
           
protected  java.lang.String value
           
protected  javax.swing.text.JTextComponent visualTextComponent
           
 

Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 

Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 

Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 

Constructor Summary
SwingPropertyFilter()
          Construct a SwingPropertyFilter.
 

Method Summary
 boolean accept(java.lang.Object o)
          This is the default filter that is a simple Object's string contains the filtered string.
 void addDocumentListener(javax.swing.event.DocumentListener listener)
           
 void addFilterChangeListener(IFilterBinder.FilterChangeListener l)
          Add a new filter change listener to the listener list.
protected  void contentChanged()
          Respond to a change of the text field's contents.
protected  void fireFilterChanged(java.lang.Object src, java.lang.Object oldO, java.lang.Object newO)
          Notify all the registered FilterChangeListeners that the value of the filter has changed.
 java.lang.String getFilteredProperty()
          Get the property on the canidate objects that will be filtered based on the user text input.
protected  java.lang.String getValue()
          Get the current text value that will be the used to filter the object.
 javax.swing.text.JTextComponent getVisualTextComponent()
           
 boolean isCaseSensitive()
          Get whether the filter accept mechanism is sensitive to String case.
 void removeFilterChangeListener(IFilterBinder.FilterChangeListener l)
          Remove an existing filter change listener from the listener list.
 void setCaseSensitive(boolean cs)
          Sets whether the filter should be sensitive to case while filtering.
 void setFilteredProperty(java.lang.String filteredProperty)
          Set the property that the canidate objects will be based on.
 void setVisualTextComponent(javax.swing.text.JTextComponent srcTextComponent)
          Set the visual text component that will be used as input for the filter.
 java.lang.String toString()
           
 

Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertString, insertUpdate, removeUpdate
 

Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

 

Field Detail

 

 

filteredProperty

protected java.lang.String filteredProperty


 

 

visualTextComponent

protected javax.swing.text.JTextComponent visualTextComponent


 

 

value

protected java.lang.String value


 

 

lcValue

protected java.lang.String lcValue


 

 

caseSensitive

protected boolean caseSensitive


 

 

filterListeners

protected java.util.List filterListeners

Constructor Detail

 

 

SwingPropertyFilter

public SwingPropertyFilter()

Construct a SwingPropertyFilter. The filter will reject all canidate objects until the filteredProperty is set.

Method Detail

 

 

accept

public boolean accept(java.lang.Object o)

This is the default filter that is a simple Object's string contains the filtered string.

If the filteredProperty does not exist on the given object, the object will be accepted by default.

Specified by:
accept in interface IFilterBinder

Parameters:
o - The object to filter upon
Returns:
true if the object is accepted by the filter, false otherwise.


 

 

addFilterChangeListener

public void addFilterChangeListener(IFilterBinder.FilterChangeListener l)

Description copied from interface: IFilterBinder
Add a new filter change listener to the listener list.

Specified by:
addFilterChangeListener in interface IFilterBinder

Parameters:
l - the new listener.


 

 

removeFilterChangeListener

public void removeFilterChangeListener(IFilterBinder.FilterChangeListener l)

Description copied from interface: IFilterBinder
Remove an existing filter change listener from the listener list.

Specified by:
removeFilterChangeListener in interface IFilterBinder

Parameters:
l - the listener to be removed.


 

 

getFilteredProperty

public java.lang.String getFilteredProperty()

Get the property on the canidate objects that will be filtered based on the user text input.

Returns:
the filter property


 

 

setFilteredProperty

public void setFilteredProperty(java.lang.String filteredProperty)

Set the property that the canidate objects will be based on. If the given property isn't valid on the canidate object, the object will be accepted by default.

Parameters:
filteredProperty - the property to set


 

 

getValue

protected java.lang.String getValue()

Get the current text value that will be the used to filter the object.

Returns:
the filter value


 

 

fireFilterChanged

protected void fireFilterChanged(java.lang.Object src,
                                 java.lang.Object oldO,
                                 java.lang.Object newO)

Notify all the registered FilterChangeListeners that the value of the filter has changed. In most cases, the listeners should respond by calling accept on their list of objects.

Parameters:
src - the source filter
oldO - the old value of the filter
newO - the new value of the filter


 

 

contentChanged

protected void contentChanged()

Respond to a change of the text field's contents. This will fire a filter changed event on the registered FilterChangeListeners.


 

 

toString

public java.lang.String toString()


 

 

addDocumentListener

public void addDocumentListener(javax.swing.event.DocumentListener listener)

Specified by:
addDocumentListener in interface javax.swing.text.Document


 

 

isCaseSensitive

public boolean isCaseSensitive()

Get whether the filter accept mechanism is sensitive to String case.

Returns:
true if the filter is case sensitive, false otherwise.


 

 

setCaseSensitive

public void setCaseSensitive(boolean cs)

Sets whether the filter should be sensitive to case while filtering.

Parameters:
cs - true to enable caseSensitivity, false otherwise.


 

 

getVisualTextComponent

public javax.swing.text.JTextComponent getVisualTextComponent()

Returns:
Returns the visual text component used by this filter.


 

 

setVisualTextComponent

public void setVisualTextComponent(javax.swing.text.JTextComponent srcTextComponent)

Set the visual text component that will be used as input for the filter.

Parameters:
srcTextComponent - The srcTextComponent to set.


Package  Use  Tree  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD