|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sciapp.filter.FilterHeaderModel
public abstract class FilterHeaderModel
FilterHeaderModel is used to provide real-time row filtering via a component that is installed on the table header.
The methods that need to be implemented deal with the component that is added on each filtering column.
Field Summary | |
---|---|
static int |
ALL_VALUES_MODE
Defines the filter mode for showing all objects under a certain column |
protected boolean |
autoCreateAllFilters
A flag that if true will automatically install a filter for each column added to the table. |
protected int |
columnShowing
the column of the header that is currently showing available filter expressions. |
protected HashMap |
defaultFiltersByColumnClass
A table that contains filters indexed by class. |
protected FilterTableHeader |
filterHeader
The header that is installed on the table. |
protected int |
filterMode
The mode that is being employed to populate the available filter expressions. |
protected FilterModel |
filterModel
The filtermodel that will be used to propagate the filter events. |
static int |
ORDERED_MODE
Defines the filter mode for showing objects depending on the order the filters were installed. |
static int |
PROGRESSIVE_MODE
Defines the filter mode for showing objects depending on all the filters currently installed. |
protected boolean |
removeOnInvisible
flag to indicate that the filter should be removed once the column is no longer shown in the table. |
protected FilterListModel |
tableModel
The filterlistmodel that will be used to process the filter events. |
Constructor Summary | |
---|---|
FilterHeaderModel()
Constructs a FilterHeaderModel. |
Method Summary | |
---|---|
void |
addFilterInColumn(TableColumn aColumn)
Installs a filter on the supplied column. |
void |
addFilterInColumns()
Installs filters on all columns. |
void |
attachToTable(JTable table)
Installs this FilterHeaderModel instance to a table. |
void |
attachToTable(JTable table,
FilterListModel ftm)
Installs this FilterHeaderModel instance to a table, by explicitly specifying the FilterListModel object that will process filter events. |
protected void |
createDefaultFilters()
Creates default filters for objects, strings, numbers and boolean values. |
protected FilterTableHeader |
createTableHeader()
Returns a new instance of the header that will be installed on the table. |
Iterator |
filterIterator()
Returns an iterator of the table filters that are installed, in the order they first appeared on the header. |
boolean |
getAutoCreateAllFilters()
Returns the autoCreateAllFilters property value. |
int |
getColumnShowing()
Returns the column that is currently showing available filter expressions. |
Filter |
getDefaultFilter(Class columnClass)
Returns the filter to use for the class defined by columnClass. |
protected Filter |
getFilter(int index)
Returns a filter object for the column with model index index . |
int |
getFilterMode()
Returns the mode that is being employed to populate the available filter expressions. |
FilterModel |
getFilterModel()
Returns the filter model that is used to propagate the filter events. |
int |
getFilterOrder(int c)
Returns the order in which the filter expression was selected. |
Object |
getFilterValue(int c)
Returns the object that is used as the filter expression for the column at c . |
Collection |
getFilterValues(int c,
Collection list)
Returns a collection filled with the objects that will be available to be selected as filter expressions for the specified column and the current filter mode. |
Collection |
getFilterValues(int c,
Collection list,
int mode)
Returns a collection filled with the objects that will be available to be selected as filter expressions for the specified column and mode. |
Collection |
getFilterValuesFromModel(int modelIndex,
Collection list)
Returns a collection filled with the objects that will be available to be selected as filter expressions for the specified column and the current filter mode. |
Collection |
getFilterValuesFromModel(int modelIndex,
Collection list,
int mode)
Returns a collection filled with the objects that will be available to be selected as filter expressions for the specified column and mode. |
Object |
getListValue(int c)
Returns the object that is used as a label to identify the filter that is installed on the column at c . |
boolean |
getRemoveOnInvisible()
Determines whether the filter should be removed once the column is no longer visible in the table. |
TableFilter |
getTableFilter(int c)
Returns the TableFilter object that is installed on the column at c
and that is responsible for filtering that column. |
TableFilter |
getTableFilterForModel(int modelIndex)
Returns the TableFilter object that is installed on a column and that is responsible for filtering that column. |
TableFilter |
getTableFilterForObject(Object o,
int c)
Returns an appropriate table filter object for the supplied object and column index. |
TableFilter |
getTableFilterForObjectToModel(Object o,
int modelIndex)
Returns an appropriate table filter object for the supplied object and column model index. |
FilterTableHeader |
getTableHeader()
Returns the header that will be used for displaying a visual representation of a filter on columns. |
boolean |
hasFilter(int c)
Determines whether a column is allowed to filter. |
Class |
inferColumnClass(int c)
A utility method to retrieve the class for the objects under the column at c
In most cases, this is similar to calling getColumnClass on the table. |
Class |
inferColumnClassModel(int modelIndex)
A utility method to retrieve the class for the objects under the column at modelIndex
In most cases, this is similar to calling getColumnClass on the table. |
void |
installFilter(Object listValue,
int c)
Assigns a new table filter to the column c . |
void |
installFilter(Object listValue,
Object filterValue,
int c)
Assigns a new table filter to the column c . |
void |
installFilter(TableFilter tableFilter,
Object listValue,
Object filterValue,
int c)
Assigns a new table filter to the column c . |
void |
installFilterToModel(Object listValue,
int modelIndex)
Assigns a new table filter to the column with model index modelIndex . |
void |
installFilterToModel(Object listValue,
Object filterValue,
int modelIndex)
Assigns a new table filter to the column with model index modelIndex . |
void |
installFilterToModel(TableFilter tableFilter,
Object listValue,
Object filterValue,
int modelIndex)
Assigns a new table filter to the column with model index modelIndex . |
void |
loadFilterState(ObjectInputStream in)
Restores the filters and assigns them on the model. |
void |
removeFilter(int c)
Removes the filter value from the supplied column. |
void |
removeFilterFromColumn(TableColumn aColumn)
Removes a filter previously installed on a column. |
void |
removeFilterFromModel(int modelIndex)
Removes the filter value from the supplied column. |
void |
removeFilterInColumns()
Removes the filters from all the columns. |
void |
removeFromTable()
Removes this FilterHeaderModel instance from the table to which it was previously assigned. |
abstract void |
removeRenderer(TableColumn aColumn)
Remove the renderer for aColumn . |
void |
saveFilterState(ObjectOutputStream out)
Saves the filters that are currently installed on the model. |
void |
sendFilterEvent()
Sends a filter event to the associated FilterListModel. |
void |
setAutoCreateAllFilters(boolean newAutoCreateAllFilters)
Assigns a new value for the autoCreateAllFilters property. |
void |
setColumnShowing(int c)
Sets the column for which the user requested a filter to appear. |
void |
setDefaultFilter(Class columnClass,
Filter filter)
Sets the default filter for columnClass. |
void |
setFilterMode(int mode)
Assigns a mode that is being employed to populate the available filter expressions. |
void |
setFilterModel(FilterModel filterModel)
Assigns the filter model that is used to propagate the filter events. |
void |
setModel(FilterListModel ftm)
Assigns the filter list model that will be used to process the filter events. |
void |
setModel(TableModel model)
Assigns the filterlist model that will be used to process the filter events. |
void |
setRemoveOnInvisible(boolean removeOnInvisible)
Determines whether the filter should be removed once the column is no longer visible in the table. |
abstract void |
setRenderer(TableColumn aColumn)
Assigns a renderer for aColumn . |
void |
setTableHeader(FilterTableHeader header)
Associates a header that will be used for displaying a visual representation of a filter on columns. |
abstract void |
updateUI()
Calls to this method should update all components that are used to display the filter on the header. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sciapp.filter.FilterHeaderCallback |
---|
shouldProcessEvent |
Field Detail |
---|
protected boolean removeOnInvisible
protected FilterListModel tableModel
protected transient FilterModel filterModel
protected FilterTableHeader filterHeader
protected boolean autoCreateAllFilters
protected HashMap defaultFiltersByColumnClass
protected int columnShowing
public static final int ALL_VALUES_MODE
public static final int PROGRESSIVE_MODE
public static final int ORDERED_MODE
protected int filterMode
Constructor Detail |
---|
public FilterHeaderModel()
Method Detail |
---|
public void addFilterInColumn(TableColumn aColumn)
aColumn
- the column for which a filter we want to add.public void addFilterInColumns()
public void attachToTable(JTable table)
ListTableMap
, contain one in the
chain of ListTableMaps. This FilterListModel will be used to process filter events.
table
- the table on which the FilterHeaderModel is installed.public void attachToTable(JTable table, FilterListModel ftm)
table
- the table on which the FilterHeaderModel is installed.ftm
- the FilterListModel that will be used to process filter events on behalf of the table.protected void createDefaultFilters()
protected FilterTableHeader createTableHeader()
public Iterator filterIterator()
remove
method has not yet been implemented.
public boolean getAutoCreateAllFilters()
public int getColumnShowing()
public Filter getDefaultFilter(Class columnClass)
columnClass
- the class to which a filter is associated.
protected Filter getFilter(int index)
index
.
This method returns null by default.
index
- the model index of the column
public int getFilterMode()
public FilterModel getFilterModel()
public int getFilterOrder(int c)
c
- the view index of the column.
public Object getFilterValue(int c)
c
.
c
- the view index of the column.
public Collection getFilterValues(int c, Collection list)
c
- the view index of the columnlist
- the collection to be populated with values
public Collection getFilterValues(int c, Collection list, int mode)
c
- the view index of the columnlist
- the collection to be populated with valuesmode
- the mode to be used when populating the list
public Collection getFilterValuesFromModel(int modelIndex, Collection list)
modelIndex
- the model index of the columnlist
- the collection to be populated with values
public Collection getFilterValuesFromModel(int modelIndex, Collection list, int mode)
modelIndex
- the model index of the columnlist
- the collection to be populated with valuesmode
- the mode to be used when populating the list
public Object getListValue(int c)
c
.
c
- the view index of the column.
public boolean getRemoveOnInvisible()
public TableFilter getTableFilter(int c)
c
and that is responsible for filtering that column.
c
- the view index of the column.
public TableFilter getTableFilterForModel(int modelIndex)
modelIndex
- the model index of the column.
public TableFilter getTableFilterForObject(Object o, int c)
c
- the view index of the column.
public TableFilter getTableFilterForObjectToModel(Object o, int modelIndex)
modelIndex
- the model index of the column.
public FilterTableHeader getTableHeader()
public boolean hasFilter(int c)
c
- the view index of the column.
c
is allowed to filter, false otherwise.public Class inferColumnClass(int c)
c
In most cases, this is similar to calling getColumnClass on the table.
c
- the view index of the column
public Class inferColumnClassModel(int modelIndex)
modelIndex
In most cases, this is similar to calling getColumnClass on the table.
modelIndex
- the model index of the column
public void installFilter(TableFilter tableFilter, Object listValue, Object filterValue, int c)
c
.
tableFilter
- the new table filter to assign.listValue
- the label of the filter.filterValue
- the value of the filter.c
- the view index of the column.public void installFilter(Object listValue, int c)
c
.
The table filter will be retrieved by calling getTableFilterForObject(filterValue, c),
whereas the filter value will be the same as the supplied list value.
listValue
- the label of the filter.c
- the view index of the column.public void installFilter(Object listValue, Object filterValue, int c)
c
.
The table filter will be retrieved by calling getTableFilterForObject(filterValue, c).
listValue
- the label of the filter.filterValue
- the value of the filter.c
- the view index of the column.public void installFilterToModel(TableFilter tableFilter, Object listValue, Object filterValue, int modelIndex)
modelIndex
.
tableFilter
- the new table filter to assign.listValue
- the label of the filter.filterValue
- the value of the filter.modelIndex
- the model index of the column.public void installFilterToModel(Object listValue, int modelIndex)
modelIndex
.
The table filter will be retrieved by calling getTableFilterForObjectToModel(filterValue, modelIndex),
whereas the filter value will be the same as the supplied list value.
listValue
- the label of the filter.modelIndex
- the model index of the column.public void installFilterToModel(Object listValue, Object filterValue, int modelIndex)
modelIndex
.
The table filter will be retrieved by calling getTableFilterForObjectToModel(filterValue, modelIndex).
listValue
- the label of the filter.filterValue
- the value of the filter.modelIndex
- the model index of the column.public void loadFilterState(ObjectInputStream in)
saveFilterState
method.
in
- the object input stream to read from in order to construct the filters.public void removeFilter(int c)
c
- the view index of the columnpublic void removeFilterFromColumn(TableColumn aColumn)
aColumn
- the column from which a filter we want to remove.public void removeFilterFromModel(int modelIndex)
modelIndex
- the model index of the columnpublic void removeFilterInColumns()
public void removeFromTable()
public abstract void removeRenderer(TableColumn aColumn)
aColumn
.
aColumn
- the column which renderer we want to remove.public void saveFilterState(ObjectOutputStream out)
loadFilterState
method.
out
- the object output stream to write to when saving the filter state.public void sendFilterEvent()
public void setAutoCreateAllFilters(boolean newAutoCreateAllFilters)
newAutoCreateAllFilters
- boolean the new value to assignpublic void setColumnShowing(int c)
c
- the view index of the columnpublic void setDefaultFilter(Class columnClass, Filter filter)
columnClass
- the Class with which a filter we want to associatefilter
- the filter to setpublic void setFilterMode(int mode)
mode
- the new current filter mode to assign.public void setFilterModel(FilterModel filterModel)
filterModel
- the filter model to assign.public void setModel(FilterListModel ftm)
ftm
- the new filter list model to assign.public void setModel(TableModel model)
model
must be an instance of FilterListModel, or, if it is a ListTableMap
,
it should contain one FilterListModel in its chain of ListTableMaps.
The first FilterListModel found will be used to process filter events.
model
- a tablemodel to query if it is or contains a FilterListModel.public void setRemoveOnInvisible(boolean removeOnInvisible)
removeOnInvisible
- true, if the filter should be removed, false otherwisepublic abstract void setRenderer(TableColumn aColumn)
aColumn
.
aColumn
- the column to which a renderer we want to assign.public void setTableHeader(FilterTableHeader header)
header
- the new header to assignpublic abstract void updateUI()
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |