|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.coderazzi.filters.parser.FilterTextParser
public class FilterTextParser
Basic implementation of a IFilterTextParser
, supporting only simple operators referring
to the content of a single column.
The supporter operators include:
Format
or Comparator
is defined for the given type.
For example, specifying the text ">= 4" implies, for a column with integer
types, that a direct comparison between integers will be performed. These operators are:
Format
is defined for the given type. The comparison is
performed using the equals method. These operators are:
Format
instance). Only two wildcard characters are
defined: * and ?
Constructor Summary | |
---|---|
FilterTextParser()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilterTextParser()
Method Detail |
---|
public void addPropertyChangeListener(PropertyChangeListener listener)
IFilterTextParser
PropertyChangeListener
. Any property change will be transmitted as an event
addPropertyChangeListener
in interface IFilterTextParser
public void removePropertyChangeListener(PropertyChangeListener listener)
IFilterTextParser
PropertyChangeListener
removePropertyChangeListener
in interface IFilterTextParser
public void setTableModel(TableModel model)
IFilterTextParser
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.
setTableModel
in interface IFilterTextParser
public String getDefaultOperator()
IFilterTextParser
getDefaultOperator
in interface IFilterTextParser
public void setDefaultOperator(String s)
IFilterTextParser
setDefaultOperator
in interface IFilterTextParser
public Format getFormat(Class<?> c)
IFilterTextParser
Format
for a given class
getFormat
in interface IFilterTextParser
public void setFormat(Class<?> c, Format format)
IFilterTextParser
Format
to build non basic types. If a table model defines some
column without specified format, only string operations will apply.
setFormat
in interface IFilterTextParser
public void setComparator(Class<?> c, Comparator<?> cmp)
IFilterTextParser
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.
setComparator
in interface IFilterTextParser
public Comparator<?> getComparator(Class<?> c)
IFilterTextParser
getComparator
in interface IFilterTextParser
public void setIgnoreCase(boolean ignore)
IFilterTextParser
setIgnoreCase
in interface IFilterTextParser
public boolean isIgnoreCase()
IFilterTextParser
isIgnoreCase
in interface IFilterTextParser
public RowFilter parseText(String expression, int modelPosition) throws ParseException
IFilterTextParser
parseText
in interface IFilterTextParser
expression
- the text to parsemodelPosition
- the position on the table model.
ParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |