Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.filter.tree
Class LevelFilterMapper

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

public class LevelFilterMapper
extends AbstractColumnFilterMapper

LevelFilterMapper is a ColumnFilterMapper that presents users with unique values to filter on each tree level.


Nested Class Summary
protected  class LevelFilterMapper.DoubleTreeTableModelMap
           
 
Nested classes/interfaces inherited from class com.sciapp.filter.tree.AbstractColumnFilterMapper
AbstractColumnFilterMapper.ColumnFilterTreeTableModel
 
Field Summary
 
Fields inherited from class com.sciapp.filter.tree.AbstractColumnFilterMapper
ALL_STRING, columnFilterTreeTableModel
 
Constructor Summary
LevelFilterMapper()
          Constructs a LevelFilterMapper.
 
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 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.
protected  void createDefaultComparators()
          Creates default comparators for objects, strings and boolean values.
 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.
 Comparator getDefaultComparator(Class columnClass)
          Returns the comparator to use for objects of the specified columnClass.
 int[] getFilteredColumns()
          Returns an array of the columns that have filters.
 boolean hasFilter(int modelIndex)
          Determines whether filters for the column modelIndex exist.
 boolean removeFilters(FilterTreeTableModel ftm, int[] modelIndexes, boolean commit)
          Removes the stored filters for the supplied modelIndexes columns.
 void setDefaultComparator(Class columnClass, Comparator comparator)
          Sets the default comparator for columnClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelFilterMapper

public LevelFilterMapper()
Constructs a LevelFilterMapper.

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.

Parameters:
ftm - the model to which the stored filters are applied
excludedColumns - an array of column indexes to exclude while filtering

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.

Parameters:
filterTreeTableModel - the model to which the filters are commited
f - the filter to use
modelIndex - the column

createDefaultComparators

protected void createDefaultComparators()
Creates default comparators for objects, strings and boolean values.


filterCancelled

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


filterVisible

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

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

getDefaultComparator

public Comparator getDefaultComparator(Class columnClass)
Returns the comparator to use for objects of the specified columnClass. If there is no entry for this columnClass, this method returns the entry for the most specific superclass. SortTableModel installs entries for Object, Number, and Boolean, all of which can be modified or replaced.

Parameters:
columnClass - the class for which we want to find a comparator
Returns:
the comparator for this columnClass

getFilteredColumns

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

Returns:
a list of columns that have filters

hasFilter

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

Parameters:
modelIndex - the column
Returns:
true if filters for the supplied are defined, false otherwise

removeFilters

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

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

setDefaultComparator

public void setDefaultComparator(Class columnClass,
                                 Comparator comparator)
Sets the default comparator for columnClass.

Parameters:
columnClass - the Class for which a comparator we want to set
comparator - the comparator to set

Copyright © 2005 Scientific Applications. All Rights Reserved.