|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cmu.survey.data.Filter<T>
public class Filter<T>
Show only rows matching certain criteria.
Used in DataTableModel for finding certain rows.
This is similar to a chunk of a "where" clause in SQL, or a find/search for a small chunk -- it "filters" the results down to a smaller subset, where a column matches or doesn't match criteria.
Some examples on how to use Filter:
new Filter(columnName="id", Filter.EQUALS, "10") -- show only rows in the table where the "id" column equals "10".
new Filter(columnName="startDate", Filter.GREATER_THAN_OR_EQUAL_TO, "2004-10-12") -- show only rows in the table where the "startDate" column (here we assume this is a date) is on 10/12/2004 or later.
for more information about the comarators you can set and what's valid.
Field Summary | |
---|---|
static java.lang.String |
EQUALS
|
static java.lang.String |
GREATER_THAN
|
static java.lang.String |
GREATER_THAN_OR_EQUAL_TO
|
static java.lang.String |
LESS_THAN
|
static java.lang.String |
LESS_THAN_OR_EQUAL_TO
|
static java.lang.String |
NOT_EQUAL
|
static java.lang.String[] |
POSSIBLE_COMPARATOR_STRINGS
|
Constructor Summary | |
---|---|
Filter(StringDataBit columnName,
StringDataBit comparator,
DataBit<T> value,
java.lang.Integer id)
|
|
Filter(java.lang.String columnName,
java.lang.String comparator,
java.util.Date value)
|
|
Filter(java.lang.String columnName,
java.lang.String comparator,
java.lang.Double value)
|
|
Filter(java.lang.String columnName,
java.lang.String comparator,
int value)
|
|
Filter(java.lang.String columnName,
java.lang.String comparator,
java.lang.Integer value)
|
|
Filter(java.lang.String columnName,
java.lang.String comparator,
java.lang.String value)
|
|
Filter(java.lang.String columnName,
java.lang.String comparator,
java.lang.String value,
java.lang.Integer id)
|
Method Summary | |
---|---|
void |
addFilterChangeListener(FilterChangedListener listener)
|
java.lang.String |
getColumnName()
|
java.lang.String |
getComparator()
|
boolean |
getHasBeenModified()
|
java.lang.Integer |
getID()
Optional Unique ID for loading/saving the filter. |
T |
getValue()
|
DataBit<T> |
getValueDataBit()
|
void |
removeFilterChangeListener(FilterChangedListener listener)
|
void |
setColumnName(java.lang.String string)
|
boolean |
setComparator(java.lang.String compString)
Set the way to filter, the comparison technique. |
void |
setID(java.lang.Integer uniqueID)
Optional Unique ID for loading/saving the filter. |
void |
setJustLoaded()
call right after being loaded, when everything should be registered as fresh and not modified. |
void |
setValue(java.lang.String newValue)
|
void |
setValue(T newValue)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EQUALS
public static final java.lang.String NOT_EQUAL
public static final java.lang.String LESS_THAN
public static final java.lang.String GREATER_THAN
public static final java.lang.String LESS_THAN_OR_EQUAL_TO
public static final java.lang.String GREATER_THAN_OR_EQUAL_TO
public static final java.lang.String[] POSSIBLE_COMPARATOR_STRINGS
Constructor Detail |
---|
public Filter(java.lang.String columnName, java.lang.String comparator, java.lang.String value) throws java.lang.IllegalArgumentException
columnName
- the name of the column to filter, as determined by DataTableModel.getColumnName(), etc.comparator
- @see setComparatorvalue
-
java.lang.IllegalArgumentException
public Filter(java.lang.String columnName, java.lang.String comparator, java.lang.Integer value) throws java.lang.IllegalArgumentException
columnName
- the name of the column to filter, as determined by DataTableModel.getColumnName(), etc.comparator
- @see setComparatorvalue
-
java.lang.IllegalArgumentException
public Filter(java.lang.String columnName, java.lang.String comparator, java.util.Date value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public Filter(java.lang.String columnName, java.lang.String comparator, java.lang.Double value) throws java.lang.IllegalArgumentException
columnName
- the name of the column to filter, as determined by DataTableModel.getColumnName(), etc.comparator
- @see setComparatorvalue
-
java.lang.IllegalArgumentException
public Filter(java.lang.String columnName, java.lang.String comparator, int value) throws java.lang.IllegalArgumentException
columnName
- the name of the column to filter, as determined by DataTableModel.getColumnName(), etc.comparator
- @see setComparatorvalue
-
java.lang.IllegalArgumentException
public Filter(java.lang.String columnName, java.lang.String comparator, java.lang.String value, java.lang.Integer id) throws java.lang.IllegalArgumentException
columnName
- comparator
- @see setComparatorvalue
- id
- the ID of this filter. This is extra, non-used info, for filters that need unique ids for loading/saving them. Only use this if you need it for unique identification of this filter.
java.lang.IllegalArgumentException
public Filter(StringDataBit columnName, StringDataBit comparator, DataBit<T> value, java.lang.Integer id)
columnName
- comparator
- value
- id
- the ID of this filter. This is extra, non-used info, for filters that need unique ids for loading/saving them. Only use this if you need it for unique identification of this filter.Method Detail |
---|
public java.lang.String getColumnName()
public T getValue()
public DataBit<T> getValueDataBit()
public void setColumnName(java.lang.String string)
public void setValue(T newValue)
public void setValue(java.lang.String newValue)
public void addFilterChangeListener(FilterChangedListener listener)
public void removeFilterChangeListener(FilterChangedListener listener)
public boolean setComparator(java.lang.String compString) throws java.lang.IllegalArgumentException
comparator
- as a string
java.lang.IllegalArgumentException
- if the compString is not one of the Filter.* comparators (all options are listed in Filter.POSSIBLE_COMPARATOR_STRINGSpublic java.lang.String getComparator()
public java.lang.Integer getID()
getID
in interface HasID
public void setID(java.lang.Integer uniqueID)
uniqueID
- The uniqueID to set.public void setJustLoaded()
public boolean getHasBeenModified()
getHasBeenModified
in interface HasBeenModified
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |