Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.filter.tree
Class DefaultColumnFilterMapper

java.lang.Object
  extended by com.sciapp.filter.tree.DefaultColumnFilterMapper
All Implemented Interfaces:
ColumnFilterMapper

public class DefaultColumnFilterMapper
extends Object
implements ColumnFilterMapper

DefaultColumnFilterMapper is the default ColumnFilterMapper implementation that is a combination of node and level mappers. By default, a level mode is used.


Field Summary
protected  int defaultMode
          the default mode to use when a column has not been assigned to a mapper
static int LEVEL_MODE
          the mode that is associated to the level mapper
protected  LevelFilterMapper levelMapper
          the mapper used for presenting distinct values at each node level
static int NODE_MODE
          the mode that is associated to the node mapper
protected  NodeFilterMapper nodeMapper
          the mapper used for presenting every node of a tree
 
Constructor Summary
DefaultColumnFilterMapper()
          Constructs a DefaultColumnFilterMapper.
DefaultColumnFilterMapper(LevelFilterMapper levelMapper)
          Constructs a DefaultColumnFilterMapper.
DefaultColumnFilterMapper(NodeFilterMapper nodeMapper)
          Constructs a DefaultColumnFilterMapper.
DefaultColumnFilterMapper(NodeFilterMapper nodeMapper, LevelFilterMapper levelMapper)
          Constructs a DefaultColumnFilterMapper.
 
Method Summary
 void applyFilters(FilterTreeTableModel ftm, int[] excludedColumns)
          Applies the stored filters to the supplied filterTreeTableModel, excluding a list of column indexes defined by excludedModelIndexes.
 void clear(int modelIndex)
          Removes the association made between a column and a node or level mapper.
 void commitFilters(FilterTreeTableModel filterTreeTableModel, Filter f, int modelIndex)
          Stores and commits the filters for the column modelIndex for which filter expressions were previously made available to the user.
 void filterCancelled()
          Cancels the action of previously showing available filter expressions to the user.
 void filterVisible(int modelIndex, CheckBoxTree tree, TreeTableModel treeTableModel, TreeTable table)
          Method called when available filter expressions are made available to the user.
 int getDefaultMode()
          Determines the default mode for a column if an association has not been explicitly made.
 int[] getFilteredColumns()
          Returns an array of the columns that have filters.
 LevelFilterMapper getLevelMapper()
          Returns the mapper used for presenting distinct values on each tree level.
 ColumnFilterMapper getMapper(int modelIndex)
          Determines the mapper that will be used for a column.
 NodeFilterMapper getNodeMapper()
          Returns the mapper used for presenting every node of a tree.
 boolean hasFilter(int modelIndex)
          Determines whether filters for the column modelIndex exist.
 boolean isLevel(int modelIndex)
          Determines whether a column is assigned to use the level mapper.
 boolean isNode(int modelIndex)
          Determines whether a column is assigned to use the node mapper.
 boolean removeFilters(FilterTreeTableModel ftm, int[] modelIndexes, boolean commit)
          Removes the stored filters for the supplied modelIndexes columns.
 void setDefaultMode(int defaultMode)
          Assigns the default mode for a column if an association has not been explicitly made.
 void setLevel(int modelIndex)
          Assigns a column to use the level mapper.
 void setNode(int modelIndex)
          Assigns a column to use the node mapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeMapper

protected NodeFilterMapper nodeMapper
the mapper used for presenting every node of a tree


levelMapper

protected LevelFilterMapper levelMapper
the mapper used for presenting distinct values at each node level


defaultMode

protected int defaultMode
the default mode to use when a column has not been assigned to a mapper


NODE_MODE

public static final int NODE_MODE
the mode that is associated to the node mapper

See Also:
Constant Field Values

LEVEL_MODE

public static final int LEVEL_MODE
the mode that is associated to the level mapper

See Also:
Constant Field Values
Constructor Detail

DefaultColumnFilterMapper

public DefaultColumnFilterMapper()
Constructs a DefaultColumnFilterMapper.


DefaultColumnFilterMapper

public DefaultColumnFilterMapper(LevelFilterMapper levelMapper)
Constructs a DefaultColumnFilterMapper.


DefaultColumnFilterMapper

public DefaultColumnFilterMapper(NodeFilterMapper nodeMapper)
Constructs a DefaultColumnFilterMapper.


DefaultColumnFilterMapper

public DefaultColumnFilterMapper(NodeFilterMapper nodeMapper,
                                 LevelFilterMapper levelMapper)
Constructs a DefaultColumnFilterMapper.

Method Detail

applyFilters

public void applyFilters(FilterTreeTableModel ftm,
                         int[] excludedColumns)
Applies the stored filters to the supplied filterTreeTableModel, excluding a list of column indexes defined by excludedModelIndexes. If excludedModelIndexes is null, or is empty, all stored filters are applied.

Specified by:
applyFilters in interface ColumnFilterMapper
Parameters:
ftm - the model to which the stored filters are applied
excludedColumns - an array of column indexes to exclude while filtering

clear

public void clear(int modelIndex)
Removes the association made between a column and a node or level mapper.

Parameters:
modelIndex - the column

commitFilters

public void commitFilters(FilterTreeTableModel filterTreeTableModel,
                          Filter f,
                          int modelIndex)
Stores and commits the filters for the column modelIndex for which filter expressions were previously made available to the user.

Specified by:
commitFilters in interface ColumnFilterMapper
Parameters:
filterTreeTableModel - the model to which the filters are commited
f - the filter to use
modelIndex - the column

filterCancelled

public void filterCancelled()
Cancels the action of previously showing available filter expressions to the user.

Specified by:
filterCancelled in interface ColumnFilterMapper

filterVisible

public void filterVisible(int modelIndex,
                          CheckBoxTree tree,
                          TreeTableModel treeTableModel,
                          TreeTable table)
Method called when available filter expressions are made available to the user.

Specified by:
filterVisible in interface ColumnFilterMapper
Parameters:
modelIndex - the column for which filter expressions are shown
tree - the tree that should be filled with a hierarchical filter expression structure
treeTableModel - the data model that holds a hierarchical filter expression structure
table - the treetable containing the structure

getDefaultMode

public int getDefaultMode()
Determines the default mode for a column if an association has not been explicitly made.
This can either be LEVEL_MODE or NODE_MODE.

Returns:
the default mode.

getFilteredColumns

public int[] getFilteredColumns()
Returns an array of the columns that have filters.

Specified by:
getFilteredColumns in interface ColumnFilterMapper
Returns:
a list of columns that have filters

getLevelMapper

public LevelFilterMapper getLevelMapper()
Returns the mapper used for presenting distinct values on each tree level.

Returns:
the level mapper

getMapper

public ColumnFilterMapper getMapper(int modelIndex)
Determines the mapper that will be used for a column.

Parameters:
modelIndex - the column
Returns:
the evaluated mapper for the supplied column

getNodeMapper

public NodeFilterMapper getNodeMapper()
Returns the mapper used for presenting every node of a tree.

Returns:
the node mapper

hasFilter

public boolean hasFilter(int modelIndex)
Determines whether filters for the column modelIndex exist.

Specified by:
hasFilter in interface ColumnFilterMapper
Parameters:
modelIndex - the column
Returns:
true if filters for the supplied are defined, false otherwise

isLevel

public boolean isLevel(int modelIndex)
Determines whether a column is assigned to use the level mapper.

Parameters:
modelIndex - the column
Returns:
true, if an association exists between the column and the level mapper

isNode

public boolean isNode(int modelIndex)
Determines whether a column is assigned to use the node mapper.

Parameters:
modelIndex - the column
Returns:
true, if an association exists between the column and the level mapper

removeFilters

public boolean removeFilters(FilterTreeTableModel ftm,
                             int[] modelIndexes,
                             boolean commit)
Removes the stored filters for the supplied modelIndexes columns.

Specified by:
removeFilters in interface ColumnFilterMapper
Parameters:
ftm - the model from which the stored filters are removed
modelIndexes - a list of columns
commit - a flag indicating that the filter removal should be commited
Returns:
true, if at least one filter was removed, false otherwise

setDefaultMode

public void setDefaultMode(int defaultMode)
Assigns the default mode for a column if an association has not been explicitly made.
This can either be LEVEL_MODE or NODE_MODE.

Parameters:
defaultMode - the default mode to assign

setLevel

public void setLevel(int modelIndex)
Assigns a column to use the level mapper.

Parameters:
modelIndex - the column to assign to the level mapper

setNode

public void setNode(int modelIndex)
Assigns a column to use the node mapper.

Parameters:
modelIndex - the column to assign to the node mapper

Copyright © 2005 Scientific Applications. All Rights Reserved.