Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.group
Class LevelColumnFilterHeaderModel

java.lang.Object
  extended by com.sciapp.filter.tree.TreeFilterHeaderModel
      extended by com.sciapp.filter.tree.PopupTreeFilterHeaderModel
          extended by com.sciapp.table.group.LevelColumnFilterHeaderModel
All Implemented Interfaces:
FilterHeaderCallback

public class LevelColumnFilterHeaderModel
extends PopupTreeFilterHeaderModel

LevelColumnFilterHeaderModel is a FilterHeaderModel that can be used for filtering each level of a TreeTableColumnModel. One way of using it would be to create a FilterTableHeader with an empty table and add the header to a container, somewhere in your application.

For example:

AdvancedJTable t = new AdvancedJTable();
FilterTableHeader header = (FilterTableHeader) t.getTableHeader();

LevelColumnFilterHeaderModel pfh = new LevelColumnFilterHeaderModel();
pfh.setTableHeader(header);
DefaultFilterTreeTableModel ftm = new DefaultFilterTreeTableModel(treeColumnModel);
pfh.setModel(ftm);
pfh.setLevelCount(3);
pfh.setLevelValue(0, "Year");
pfh.setLevelValue(1, "Month");
pfh.setLevelValue(2, "Week");

scroller.setCorner(scroller.UPPER_LEFT_CORNER, header);
((AdvancedJTable) table).getTableRowHeader().setColumnWidth(header.getPreferredSize().width);


Field Summary
protected  int levelCount
          the number of stacked columns
 
Fields inherited from class com.sciapp.filter.tree.PopupTreeFilterHeaderModel
arrow, ARROW_LEFT, ARROW_RIGHT, arrowMode, box, defaultHeaderCursor, filteredColor, unfilteredColor
 
Fields inherited from class com.sciapp.filter.tree.TreeFilterHeaderModel
ALL_VALUES_MODE, autoCreateAllFilters, columnShowing, defaultFiltersByColumnClass, dynamicFilterTreeTableModel, filterHeader, filterMode, filterTreeTableModel, mapper, PROGRESSIVE_MODE, removeOnInvisible
 
Constructor Summary
LevelColumnFilterHeaderModel()
          Constructs a LevelColumnFilterHeaderModel.
 
Method Summary
protected  boolean checkForFilter(MouseEvent e)
          Determines if the user clicked on any of the arrow buttons on the table's header.
protected  ColumnFilterMapper createFilterMapper()
          This will return a custom ColumnFilterMapper.
 int getLevelCount()
          Determines the number of stacked columns that will be shown.
 boolean hasFilter(int viewIndex)
          The supplied viewIndex in this subclass refers to the column level.
protected  void prepareRendererLevel(int level, ArrowButton arrow)
          This method is called just before the renderer paints the column with tree level level for columns that have a filter installed.
 void setColumnShowing(int column)
          Sets the column for which the user requested a filter to appear.
 void setLevelCount(int levelCount)
          Determines the number of stacked columns that will be shown.
 void setLevelValue(int level, Object value)
          Convenience method for setting the header value of a column, based on its level.
protected  void setRenderer(TableColumn column)
          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.
 void updateUI()
          Calls to this method should update all components that are used to display the filter on the header.
 
Methods inherited from class com.sciapp.filter.tree.PopupTreeFilterHeaderModel
getArrowButton, getArrowMode, getComboBox, getDefaultHeaderCursor, getFilteredColor, getUnfilteredColor, popupWillShow, prepareRenderer, removeFromTable, removeRenderer, setArrowMode, setDefaultHeaderCursor, setFilteredColor, setUnfilteredColor, shouldProcessEvent
 
Methods inherited from class com.sciapp.filter.tree.TreeFilterHeaderModel
attachToTable, attachToTable, createDefaultFilters, createTableHeader, getAutoCreateAllFilters, getColumnShowing, getDefaultFilter, getFilter, getFilterMapper, getFilterMode, getRemoveOnInvisible, getTableHeader, hasFilterControl, inferColumnClass, removeFilter, removeFilterControlFromColumn, removeFilterControlFromColumns, setAutoCreateAllFilters, setDefaultFilter, setFilterControlInColumn, setFilterControlInColumns, setFilterMapper, setFilterMode, setModel, setModel, setRemoveOnInvisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

levelCount

protected int levelCount
the number of stacked columns

Constructor Detail

LevelColumnFilterHeaderModel

public LevelColumnFilterHeaderModel()
Constructs a LevelColumnFilterHeaderModel.

Method Detail

checkForFilter

protected boolean checkForFilter(MouseEvent e)
Determines if the user clicked on any of the arrow buttons on the table's header. If so, a popup menu containing available filter expression values is displayed for the column pressed.

Overrides:
checkForFilter in class PopupTreeFilterHeaderModel
Parameters:
e - the mouse event generated on the table's header.
Returns:
true if the arrow button was pressed.

createFilterMapper

protected ColumnFilterMapper createFilterMapper()
This will return a custom ColumnFilterMapper.

This will return a DefaultColumnFilterMapper.

Creates a new instance of the column filter mapper that will be used to install and uninstall the filters.

Overrides:
createFilterMapper in class PopupTreeFilterHeaderModel
Returns:
a new instance of the column filter mapper object.

getLevelCount

public int getLevelCount()
Determines the number of stacked columns that will be shown.

Returns:
the number of stacked columns

hasFilter

public boolean hasFilter(int viewIndex)
The supplied viewIndex in this subclass refers to the column level. Determines whether a column has a filter installed.

Overrides:
hasFilter in class TreeFilterHeaderModel
Parameters:
viewIndex - the view index of the column.
Returns:
true if the column at viewIndex has a filter installed, false otherwise.

prepareRendererLevel

protected void prepareRendererLevel(int level,
                                    ArrowButton arrow)
This method is called just before the renderer paints the column with tree level level for columns that have a filter installed. This implementation pushes the arrow button down and paints it with a blue color if a filter expression is present on the column.

Parameters:
level - the level of the column the renderer is painting
arrow - the arrow button

setColumnShowing

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

Overrides:
setColumnShowing in class TreeFilterHeaderModel
Parameters:
column - the view index of the column showing filter expressions.

setLevelCount

public void setLevelCount(int levelCount)
Determines the number of stacked columns that will be shown.

Parameters:
levelCount - the number of stacked columns

setLevelValue

public void setLevelValue(int level,
                          Object value)
Convenience method for setting the header value of a column, based on its level. This method will throw an IllegalArgumentException if the column at the specified level does not exist.

Parameters:
level - the level of the column
value - the column's header value

setRenderer

protected void setRenderer(TableColumn column)
Assigns a renderer for aColumn.

Overrides:
setRenderer in class PopupTreeFilterHeaderModel
Parameters:
column - 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.

Overrides:
setTableHeader in class PopupTreeFilterHeaderModel
Parameters:
header - the new header to assign

updateUI

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

Overrides:
updateUI in class PopupTreeFilterHeaderModel

Copyright © 2005 Scientific Applications. All Rights Reserved.