Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.filter.tree
Class TreeFilterHeaderModel

java.lang.Object
  extended by com.citra.filter.tree.TreeFilterHeaderModel
All Implemented Interfaces:
FilterHeaderCallback
Direct Known Subclasses:
PopupTreeFilterHeaderModel

public abstract class TreeFilterHeaderModel
extends Object
implements FilterHeaderCallback

TreeFilterHeaderModel is used to provide real-time row filtering via a component that is installed on the table header.


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  DefaultFilterTreeTableModel dynamicFilterTreeTableModel
          An internal filter tree table model providing a filtered model according to the mode installed.
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  FilterTreeTableModel filterTreeTableModel
          The FilterTreeTableModel that will be used to process the filter events.
protected  ColumnFilterMapper mapper
          The mapper responsible for creating, installing and assigning filters.
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.
 
Constructor Summary
TreeFilterHeaderModel()
          Constructs a TreeFilterHeaderModel.
 
Method Summary
 void attachToTable(JTable table, FilterTreeTableModel ftm)
          Installs this TreeFilterHeaderModel instance to a table, by explicitly specifying the FilterTreeTableModel object that will process filter events.
 void attachToTable(TreeTable treetable)
          Installs this TreeFilterHeaderModel instance to a treetable.
protected  void createDefaultFilters()
          Creates default filters for objects, strings, numbers and boolean values.
protected abstract  ColumnFilterMapper createFilterMapper()
          Creates a new instance of the column filter mapper that will be used to install and uninstall the filters.
protected abstract  TableCellRendererWrapper createFilterWrapper()
          Creates and returns the renderer wrapper that will be installed on the header.
protected  FilterTableHeader createTableHeader()
          Returns a new instance of the header that will be installed on the table.
 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.
 Filter getFilter(int modelIndex)
          Returns a filter object for the column with model index modelIndex.
 ColumnFilterMapper getFilterMapper()
          Creates the assigned column filter mapper that will be used to install and uninstall the column filters.
 int getFilterMode()
          Returns the mode that is being employed to populate the available filter expressions.
 boolean getRemoveOnInvisible()
          Determines whether the filter should be removed once the column is no longer visible in the table.
 FilterTableHeader getTableHeader()
          Returns the header that will be used for displaying a visual representation of a filter on columns.
 boolean hasFilter(int modelIndex)
          Determines whether a column has a filter installed.
 boolean hasFilterControl(int modelIndex)
          Determines whether a column has a filter control installed.
 boolean hasFilterControl(TableColumn column)
          Determines whether a column has a filter control installed.
 Class inferColumnClass(int modelIndex)
          A utility method to retrieve the class for the objects under the column at viewIndex In most cases, this is similar to calling getColumnClass on the table.
 void removeFilter(int modelIndex)
          Removes all installed filters from a column.
 void removeFilterControlFromColumn(TableColumn aColumn)
          Removes a filter control previously installed on a column.
 void removeFilterControlFromColumns()
          Removes the filter controls from all columns.
 void removeFromTable()
          Removes this TreeFilterHeaderModel instance from the table to which it was previously installed.
protected abstract  void removeRenderer(TableColumn aColumn)
          Deprecated. this method is no longer used. A renderer is now installed on every column, whose appearance can be modified with the renderer wrapper created with the createFilterWrapper method.
 void setAutoCreateAllFilters(boolean newAutoCreateAllFilters)
          Assigns a new value for the autoCreateAllFilters property.
protected  void setColumnShowing(int modelIndex)
          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 setFilterControlInColumn(TableColumn aColumn)
          Installs a filter on the supplied column.
 void setFilterControlInColumns()
          Installs filters on all columns.
 void setFilterMapper(ColumnFilterMapper mapper)
          Assigns the column filter mapper that will be used to install and uninstall the column filters.
 void setFilterMode(int mode)
          Assigns a mode that is being employed to populate the available filter expressions.
 void setModel(FilterTreeTableModel ftm)
          Assigns the filter tree table model that will be used to provide the filtering.
 void setModel(TreeTableModel model)
          Assigns the filter tree table model that will be used to provide the filtering.
 void setRemoveOnInvisible(boolean removeOnInvisible)
          Determines whether the filter should be removed once the column is no longer visible in the table.
protected abstract  void setRenderer(TableColumn aColumn)
          Deprecated. this method is no longer used. A renderer is now installed on every column, whose appearance can be modified with the renderer wrapper created with the createFilterWrapper method.
 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.citra.filter.FilterHeaderCallback
shouldProcessEvent
 

Field Detail

removeOnInvisible

protected boolean removeOnInvisible
flag to indicate that the filter should be removed once the column is no longer shown in the table.


mapper

protected ColumnFilterMapper mapper
The mapper responsible for creating, installing and assigning filters.


dynamicFilterTreeTableModel

protected DefaultFilterTreeTableModel dynamicFilterTreeTableModel
An internal filter tree table model providing a filtered model according to the mode installed.


filterTreeTableModel

protected FilterTreeTableModel filterTreeTableModel
The FilterTreeTableModel that will be used to process the filter events.


filterHeader

protected FilterTableHeader filterHeader
The header that is installed on the table.


autoCreateAllFilters

protected boolean autoCreateAllFilters
A flag that if true will automatically install a filter for each column added to the table.


defaultFiltersByColumnClass

protected HashMap defaultFiltersByColumnClass
A table that contains filters indexed by class.


columnShowing

protected int columnShowing
the column of the header that is currently showing available filter expressions.


ALL_VALUES_MODE

public static final int ALL_VALUES_MODE
Defines the filter mode for showing all objects under a certain column

See Also:
Constant Field Values

PROGRESSIVE_MODE

public static final int PROGRESSIVE_MODE
Defines the filter mode for showing objects depending on all the filters currently installed.

See Also:
Constant Field Values

filterMode

protected int filterMode
The mode that is being employed to populate the available filter expressions.

Constructor Detail

TreeFilterHeaderModel

public TreeFilterHeaderModel()
Constructs a TreeFilterHeaderModel.

Method Detail

attachToTable

public void attachToTable(TreeTable treetable)
Installs this TreeFilterHeaderModel instance to a treetable. The supplied treetable must have a FilterTreeTableModel as its dataModel, or, if the dataModel is a TreeTableModelMap, contain one in the chain of TreeTableModelMaps. This FilterTreeTableModel will be used to provide the filtering.

Parameters:
treetable - the table on which the TreeFilterHeaderModel is installed.

attachToTable

public void attachToTable(JTable table,
                          FilterTreeTableModel ftm)
Installs this TreeFilterHeaderModel instance to a table, by explicitly specifying the FilterTreeTableModel object that will process filter events.

Parameters:
table - the table on which the TreeFilterHeaderModel is installed.
ftm - the FilterTreeTableModel that provides the filtering.

createDefaultFilters

protected void createDefaultFilters()
Creates default filters for objects, strings, numbers and boolean values. The default filter for strings and objects is the same.


createFilterMapper

protected abstract ColumnFilterMapper createFilterMapper()
Creates a new instance of the column filter mapper that will be used to install and uninstall the filters.

Returns:
a new instance of the column filter mapper object.

createFilterWrapper

protected abstract TableCellRendererWrapper createFilterWrapper()
Creates and returns the renderer wrapper that will be installed on the header.

Returns:
a new instance of a cell renderer wrapper

createTableHeader

protected FilterTableHeader createTableHeader()
Returns a new instance of the header that will be installed on the table.

Returns:
a new instance of the filter header.

getAutoCreateAllFilters

public boolean getAutoCreateAllFilters()
Returns the autoCreateAllFilters property value.

Returns:
a flag that if true, filters will be automatically installed for each column added to the table.

getColumnShowing

public int getColumnShowing()
Returns the column that is currently showing available filter expressions. If no filter is showing, -1 is returned.

Returns:
the model index of the column showing filter expressions

getDefaultFilter

public Filter getDefaultFilter(Class columnClass)
Returns the filter to use for the class defined by columnClass.

Parameters:
columnClass - the class to which a filter is associated
Returns:
the filter that corresponds to columnClass

getFilter

public Filter getFilter(int modelIndex)
Returns a filter object for the column with model index modelIndex. The filter can be used to filter the model. By default, this method will retrieve the class of the supplied column and call TreeFilterHeaderModel.getDefaultFilter(java.lang.Class) to return the filter.

Parameters:
modelIndex - the view index of the column
Returns:
the filter for the column

getFilterMapper

public ColumnFilterMapper getFilterMapper()
Creates the assigned column filter mapper that will be used to install and uninstall the column filters.

Returns:
the assigned column filter mapper object.

getFilterMode

public int getFilterMode()
Returns the mode that is being employed to populate the available filter expressions. This can either be ALL_VALUES_MODE or PROGRESSIVE_MODE.

Returns:
the current filter mode.

getRemoveOnInvisible

public boolean getRemoveOnInvisible()
Determines whether the filter should be removed once the column is no longer visible in the table. The default value is true.

Returns:
true, if the filter should be removed, false otherwise

getTableHeader

public FilterTableHeader getTableHeader()
Returns the header that will be used for displaying a visual representation of a filter on columns.

Returns:
the filter header that is assigned.

hasFilter

public boolean hasFilter(int modelIndex)
Determines whether a column has a filter installed.

Parameters:
modelIndex - the model index of the column
Returns:
true if the column with modelIndex has a filter installed, false otherwise

hasFilterControl

public boolean hasFilterControl(int modelIndex)
Determines whether a column has a filter control installed.

Parameters:
modelIndex - the model index of the column
Returns:
true if the column at modelIndex has a filter control installed, false otherwise

hasFilterControl

public boolean hasFilterControl(TableColumn column)
Determines whether a column has a filter control installed.

Parameters:
column - the column
Returns:
true if the supplied column has a filter control installed, false otherwise

inferColumnClass

public Class inferColumnClass(int modelIndex)
A utility method to retrieve the class for the objects under the column at viewIndex In most cases, this is similar to calling getColumnClass on the table.

Parameters:
modelIndex - the modelIndex index of the column
Returns:
the class of the objects under the supplied column

removeFilter

public void removeFilter(int modelIndex)
Removes all installed filters from a column.

Parameters:
modelIndex - the model index of the column

removeFilterControlFromColumn

public void removeFilterControlFromColumn(TableColumn aColumn)
Removes a filter control previously installed on a column. If the column did not have a filter control, this method will do nothing.

Parameters:
aColumn - the column from which the filter control we want removed.

removeFilterControlFromColumns

public void removeFilterControlFromColumns()
Removes the filter controls from all columns.


removeFromTable

public void removeFromTable()
Removes this TreeFilterHeaderModel instance from the table to which it was previously installed. The TreeFilterHeaderModel can then become free for garbage collection.


removeRenderer

protected abstract void removeRenderer(TableColumn aColumn)
Deprecated. this method is no longer used. A renderer is now installed on every column, whose appearance can be modified with the renderer wrapper created with the createFilterWrapper method.

Remove the renderer for aColumn.

Parameters:
aColumn - the column which renderer we want to remove.

setAutoCreateAllFilters

public void setAutoCreateAllFilters(boolean newAutoCreateAllFilters)
Assigns a new value for the autoCreateAllFilters property.

Parameters:
newAutoCreateAllFilters - boolean the new value to assign

setColumnShowing

protected void setColumnShowing(int modelIndex)
Sets the column for which the user requested a filter to appear.

Parameters:
modelIndex - the model index of the column showing filter expressions

setDefaultFilter

public void setDefaultFilter(Class columnClass,
                             Filter filter)
Sets the default filter for columnClass.

Parameters:
columnClass - the Class with which a filter we want to associate
filter - the filter to set

setFilterControlInColumn

public void setFilterControlInColumn(TableColumn aColumn)
Installs a filter on the supplied column.

Parameters:
aColumn - the column for which a filter we want to add.

setFilterControlInColumns

public void setFilterControlInColumns()
Installs filters on all columns.


setFilterMapper

public void setFilterMapper(ColumnFilterMapper mapper)
Assigns the column filter mapper that will be used to install and uninstall the column filters.

Parameters:
mapper - the column filter mapper to assign.

setFilterMode

public void setFilterMode(int mode)
Assigns a mode that is being employed to populate the available filter expressions. This can either be ALL_VALUES_MODE or PROGRESSIVE_MODE.

Parameters:
mode - the new current filter mode to assign.

setModel

public void setModel(FilterTreeTableModel ftm)
Assigns the filter tree table model that will be used to provide the filtering.

Parameters:
ftm - the new filter tree table model to assign.

setModel

public void setModel(TreeTableModel model)
Assigns the filter tree table model that will be used to provide the filtering. model must be an instance of FilterTreeTableModel, or, if it is a TreeTableModelMap, it should contain one FilterTreeTableModel in its chain of TreeTableModelMap. The first FilterTreeTableModel found will be used in the latter case.

Parameters:
model - the treetablemodel to search for a FilterTreeTableModel and assign it

setRemoveOnInvisible

public void setRemoveOnInvisible(boolean removeOnInvisible)
Determines whether the filter should be removed once the column is no longer visible in the table. The default value is true.

Parameters:
removeOnInvisible - true, if the filter should be removed, false otherwise

setRenderer

protected abstract void setRenderer(TableColumn aColumn)
Deprecated. this method is no longer used. A renderer is now installed on every column, whose appearance can be modified with the renderer wrapper created with the createFilterWrapper method.

Assigns a renderer for aColumn.

Parameters:
aColumn - the column to which a renderer we want to assign.

setTableHeader

public void setTableHeader(FilterTableHeader header)
Associates a header that will be used for displaying a visual representation of a filter on columns.

Parameters:
header - the new header to assign

updateUI

public abstract void updateUI()
Calls to this method should update all components that are used to display the filter on the header.


Copyright © 2011 Citra Technologies. All Rights Reserved.