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
 
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
BidiElementName, ContentElementName, ElementNameAttribute, 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.
 java.lang.String getFilteredProperty()
          Get the property on the canidate objects that will be filtered based on the user text input.
 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
getDefaultRootElement, getParagraphElement, insertString
 
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

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.