|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.grid.FilterItemSupport
public class FilterItemSupport
FilterableTableModel
is a table model which wraps another table model so that user can apply filters on
it.
addFilter(Filter)
. Or you can add filter to a particular column using addFilter(int, Filter)
.
By default, filters won't take effect immediately. You need to call setFiltersApplied(true)
to apply
those filters. If filtersApplied
flag is true already, you just need to call refresh(). We don't refresh
automatically because you might have several filters to add. You can add all of them, then only call refresh once.
setFiltersApplied(int)
will control all the filters. Each filter has its own enabled flag which will
control each individual filter.
Field Summary | |
---|---|
protected List<IFilterableTableModel.FilterItem> |
_allFilters
A list containing all the FilterItems. |
protected boolean |
_filtersApplied
A flag to turn on/off filters. |
Constructor Summary | |
---|---|
FilterItemSupport()
Creates a FilterableTableModel from any table model. |
Method Summary | |
---|---|
void |
addFilter(Filter filter)
Adds a filter to all columns. |
void |
addFilter(IFilterableTableModel.FilterItem filterItem)
Adds a FilterItem. |
void |
addFilter(int column,
Filter filter)
Adds a filter to the specified column. |
boolean |
clearFilters()
Removes all filters from all columns. |
List<IFilterableTableModel.FilterItem> |
getFilterItems()
Gets all the FilterItems added to this FilterableTableModel. |
Filter[] |
getFilters(int column)
Gets the filters for the specified column. |
boolean |
hasFilter()
Checks if the FilterableTableModel has any filters. |
boolean |
hasFilter(int columnIndex)
Checks if the FilterableTableModel has any filters on the specified column. |
boolean |
isAndMode()
Sets the logic of filters on the same column. |
boolean |
isFiltersApplied()
Checks if the filters are in effect. |
void |
removeAllFilters()
Removes all filters that are added using addFilter(Filter) . |
boolean |
removeAllFilters(int column)
Removes all filters from the specified column. |
boolean |
removeFilter(Filter filter)
Removes the filter from all columns. |
boolean |
removeFilter(IFilterableTableModel.FilterItem filterItem)
Removes the filter item. |
boolean |
removeFilter(int column,
Filter filter)
Removes the filter from the specified column. |
void |
setAndMode(boolean andMode)
Sets the logic among the filters. |
void |
setFiltersApplied(boolean apply)
Applies or unapplies the filters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<IFilterableTableModel.FilterItem> _allFilters
protected boolean _filtersApplied
setFiltersApplied(boolean)
with true will turn it on and setFiltersApplied(boolean)
with false will turn it off.
Constructor Detail |
---|
public FilterItemSupport()
Method Detail |
---|
public void addFilter(int column, Filter filter)
column
- the column index. It could also be two special values - IFilterableTableModel.ALL_COLUMNS
or IFilterableTableModel.ANY_COLUMNS
. If the value is IFilterableTableModel.ANY_COLUMNS
, this method will be the same as addFilter(Filter)
.filter
- the filter to be added.public void addFilter(IFilterableTableModel.FilterItem filterItem)
filterItem
- the FilterItempublic void addFilter(Filter filter)
You
can use AbstractFilter
to create new filter. If you need the row index or column index in order to decide
if the value should be filtered, you can use AbstractTableFilter
and use getRowIndex()
and getColumnInde() to find out current row or column index.
filter
- the filter to be added.public boolean removeFilter(int column, Filter filter)
addFilter(int, Filter)
.
Please note, removeFilter will not change the FilterableTableModel data right away. You still need to call
setFiltersApplied(true) to apply the filter. The reason is to give developers a chance to add/remove multiple
filters and only updates the data once at the end.
column
- the column index. It could also be two special values - IFilterableTableModel.ALL_COLUMNS
or IFilterableTableModel.ANY_COLUMNS
. If the value is IFilterableTableModel.ANY_COLUMNS
, this method will be the same as removeFilter(Filter)
.filter
- the filter to be removed.
public boolean removeFilter(IFilterableTableModel.FilterItem filterItem)
filterItem
- the FilterItem to be removed.
public boolean removeFilter(Filter filter)
addFilter(Filter)
.
Please note, removeFilter will not change the FilterableTableModel data right away. You still need to call
setFiltersApplied(true) to apply the filter. The reason is to give developers a chance to add/remove multiple
filters and only updates the data once at the end.
filter
- the filter to be removed.
public boolean removeAllFilters(int column)
addFilter(int, Filter)
.
Please note, removeAllFilters will not change the FilterableTableModel data right away. You still need to call
setFiltersApplied(true) to apply the filter. The reason is to give developers a chance to add/remove multiple
filters and only updates the data once at the end.
column
- the column index where all filters for that column should be removed.
public void removeAllFilters()
addFilter(Filter)
. If you want to remove all filters that
either added using addFilter(int, Filter)
or addFilter(Filter)
, you should use clearFilters()
.
Please note, removeAllFilters will not change the FilterableTableModel data right away. You still need to call
setFiltersApplied(true) to apply the filter. The reason is to give developers a chance to add/remove multiple
filters and only updates the data once at the end.
public boolean clearFilters()
public Filter[] getFilters(int column)
column
- the column index.
public List<IFilterableTableModel.FilterItem> getFilterItems()
public void setFiltersApplied(boolean apply)
apply
- true to apply the filters.public boolean isFiltersApplied()
public boolean hasFilter()
FilterableTableModel
has any filters.
public boolean hasFilter(int columnIndex)
FilterableTableModel
has any filters on the specified column.
columnIndex
- the column index to check if there is a filter on it.
public boolean isAndMode()
IFilterableTableModel.ALL_COLUMNS
and IFilterableTableModel.ANY_COLUMNS
.
public void setAndMode(boolean andMode)
FitlerableTableModel
. In order to do more complex
expression, you would need multiple FilterableTableModel
, one wraps the other. You make filters in
each FilterableTableModel
to be OR logic, then the logic among the pipe of
FilterableTableModel
s will always be AND logic.
andMode
- true or false.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |