net.coderazzi.filters
Interface IFilterTextParser

All Known Implementing Classes:
FilterTextParser

public interface IFilterTextParser

Interface defining the requirements on text parsing for filter expressions.

Author:
Luis M Pena - lu@coderazzi.net

Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 Comparator<?> getComparator(Class<?> c)
          Returns the comparator provided for the given class
 String getDefaultOperator()
          Returns the default operand
 Format getFormat(Class<?> c)
          Returns the Format for a given class
 boolean isIgnoreCase()
          Returns true if it ignores case
 RowFilter parseText(String expression, int modelPosition)
          Parses the text, corresponding to a column in the table model
It returns a filter that can be applied to the table sorter.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes an existing PropertyChangeListener
 void setComparator(Class<?> c, Comparator<?> cmp)
          Sets a specific comparator for a given class, that should override the default Compare algorithm for the given class.
 void setDefaultOperator(String s)
          Defines the default operator when the user specifies none
 void setFormat(Class<?> c, Format format)
          Provides the Format to build non basic types.
 void setIgnoreCase(boolean ignore)
          Ignores case -if the operator is string based-
 void setTableModel(TableModel model)
          Associates a TableModel to the parser.
 

Method Detail

setTableModel

void setTableModel(TableModel model)
Associates a TableModel to the parser. The parser can use it to extract the type associated to a given column, or to define variables -the name of the column-. The usage is specific to the final implementation.


parseText

RowFilter parseText(String expression,
                    int modelPosition)
                    throws ParseException
Parses the text, corresponding to a column in the table model
It returns a filter that can be applied to the table sorter.

Parameters:
expression - the text to parse
modelPosition - the position on the table model.
Throws:
ParseException

setIgnoreCase

void setIgnoreCase(boolean ignore)
Ignores case -if the operator is string based-


isIgnoreCase

boolean isIgnoreCase()
Returns true if it ignores case


setDefaultOperator

void setDefaultOperator(String s)
Defines the default operator when the user specifies none


getDefaultOperator

String getDefaultOperator()
Returns the default operand


setComparator

void setComparator(Class<?> c,
                   Comparator<?> cmp)

Sets a specific comparator for a given class, that should override the default Compare algorithm for the given class.

If the class is not Comparable, this method should be invoked to support any comparison operator, or any operation will be invoked on the string representation of the instance.


getComparator

Comparator<?> getComparator(Class<?> c)
Returns the comparator provided for the given class


setFormat

void setFormat(Class<?> c,
               Format format)
Provides the Format to build non basic types. If a table model defines some column without specified format, only string operations will apply.
Please note that every IFilterTextParser can define its own set of predefined Formats


getFormat

Format getFormat(Class<?> c)
Returns the Format for a given class


addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener. Any property change will be transmitted as an event


removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Removes an existing PropertyChangeListener