Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.treetable
Class TreeTableModelMap

java.lang.Object
  extended by com.sciapp.treetable.AbstractTreeTableModel
      extended by com.sciapp.treetable.TreeModelMap
          extended by com.sciapp.treetable.TreeTableModelMap
All Implemented Interfaces:
ReorderListener, CacheableTreeTableModel, ReorderModel, TreeTableModel, Serializable, EventListener, TreeModelListener, TreeModel
Direct Known Subclasses:
AbstractColumnFilterMapper.ColumnFilterTreeTableModel, DefaultFilterTreeTableModel, DefaultSortTreeTableModel, LevelFilterMapper.DoubleTreeTableModelMap, NodeTreeTableModelMap, TreeTableColumnModelMap

public class TreeTableModelMap
extends TreeModelMap
implements ReorderModel, ReorderListener, CacheableTreeTableModel

TreeTableModelMap wraps around a TreeTableModel.

See Also:
Serialized Form

Field Summary
protected  TreeTableModel treeTableModel
          the underlying treetable model.
 
Fields inherited from class com.sciapp.treetable.TreeModelMap
treeModel
 
Fields inherited from class com.sciapp.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.sciapp.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Constructor Summary
TreeTableModelMap(TreeTableModel treeTableModel)
          Constructs a TreeTableModelMap.
 
Method Summary
 void addReorderListener(ReorderListener l)
          Adds a ReorderListener that is notified each time a change to the data model occurs so that the table updates the selected rows accordingly.
 void fireRowsMapped(int[] changedIndices)
          Notifies listeners that the rows of the table have been reordered according to the changedIndices map.
 void fireRowsReordered(ReorderEvent event)
          Notifies listeners that the rows of the table have been reordered in some way.
 Class getColumnClass(int columnIndex)
          Returns the class of all the cells in the column.
 int getColumnCount()
          Returns the number of columns.
 String getColumnName(int columnIndex)
          Returns the name of the column at columnIndex as it will be displayed by the table
 TreeTableModel getInnerTreeTableModel()
          In a chain of TreeTableModelMaps, this method returns the inner most treetable model that is not an instanceof TreeTableModelMap.
 int[] getMappedIndexes(Object node)
          Returns an array representing how the nodes' children have been transformed.
 TreeTableModel getTreeTableModel()
          Returns the underlying tree table model.
 List getUncachedChildren(Object parent, int from, int to)
          Retrieves the leaf rows from the treetable model by specifying a row interval.
 int getUncachedGroupCount(Object node)
          Retrieves the children count for node.
 List getUncachedGroups(Object parent, int from, int to)
          Retrieves the branch rows from the treetable model by specifying a row interval.
 Object getValueAt(Object node, int column)
          Returns the value to be displayed for node, at column index column.
 boolean isAggregate(Object row)
          Determines if node is an aggregate row.
 boolean isCellEditable(Object node, int columnIndex)
          Returns true if node at columnIndex is editable.
 boolean isCountCached(Object node)
          Determines whether the children count for node has been evaluated.
 boolean isFooter(Object row)
          Determines if node is a footer.
 boolean isHeader(Object row)
          Determines if node is a header.
 boolean isRangedModel()
          Determines whether the cache model can fetch data in ranges.
 boolean isValueCached(Object node, int column)
          Determines whether the value for node at index column has been evaluated.
 void removeReorderListener(ReorderListener l)
          Removes a listener from the list that is notified each time a reorder event is generated.
 void rowsReordered(ReorderEvent e)
          Called whenever the rows of a JTable have been restructured.
 void setTreeModel(TreeModel newModel)
          Sets the underlying tree model to newModel
 void setTreeTableModel(TreeTableModel treeTableModel)
          Sets the underlying tree table model to treeTableModel.
 void setValueAt(Object aValue, Object node, int columnIndex)
          Sets the value for node at columnIndex to aValue.
 
Methods inherited from class com.sciapp.treetable.TreeModelMap
getChild, getChildCount, getIndexOfChild, getPathToRoot, getPathToRoot, getRoot, getTreeModel, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, treeNodesChanged, treeNodesInserted, treeNodesRemoved, treeStructureChanged, valueForPathChanged
 
Methods inherited from class com.sciapp.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, fireTreeTableStructureChanged, removeTreeModelListener, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Field Detail

treeTableModel

protected TreeTableModel treeTableModel
the underlying treetable model.

Constructor Detail

TreeTableModelMap

public TreeTableModelMap(TreeTableModel treeTableModel)
Constructs a TreeTableModelMap.

Method Detail

addReorderListener

public void addReorderListener(ReorderListener l)
Adds a ReorderListener that is notified each time a change to the data model occurs so that the table updates the selected rows accordingly.

Specified by:
addReorderListener in interface ReorderModel
Parameters:
l - the ReorderListener

fireRowsMapped

public void fireRowsMapped(int[] changedIndices)
Notifies listeners that the rows of the table have been reordered according to the changedIndices map.

Specified by:
fireRowsMapped in interface ReorderModel
Parameters:
changedIndices - int array indicating how the rows have been reordered.
See Also:
ReorderEvent

fireRowsReordered

public void fireRowsReordered(ReorderEvent event)
Notifies listeners that the rows of the table have been reordered in some way.

Specified by:
fireRowsReordered in interface ReorderModel
Parameters:
event - the reorder event.
See Also:
ReorderEvent

getColumnClass

public Class getColumnClass(int columnIndex)
Returns the class of all the cells in the column.

Specified by:
getColumnClass in interface TreeTableModel
Parameters:
columnIndex - the index of the column
Returns:
the class of all the cells in the column.

getColumnCount

public int getColumnCount()
Returns the number of columns.

Specified by:
getColumnCount in interface TreeTableModel
Returns:
the number of columns.

getColumnName

public String getColumnName(int columnIndex)
Returns the name of the column at columnIndex as it will be displayed by the table

Specified by:
getColumnName in interface TreeTableModel
Parameters:
columnIndex - the index of the column
Returns:
the name of the column

getMappedIndexes

public int[] getMappedIndexes(Object node)
Returns an array representing how the nodes' children have been transformed.

Parameters:
node - the tree node
Returns:
an array of integers showing how the nodes children transform to the original

getTreeTableModel

public TreeTableModel getTreeTableModel()
Returns the underlying tree table model.

Returns:
the underlying tree table model.

getUncachedChildren

public List getUncachedChildren(Object parent,
                                int from,
                                int to)
Retrieves the leaf rows from the treetable model by specifying a row interval. The following condition must be true: from >= to. The List returned must contain the row elements starting at from. However, the List may contain less elements than those specified in the range.

Specified by:
getUncachedChildren in interface CacheableTreeTableModel
Parameters:
parent - the parent node
from - the starting row
to - the ending row
Returns:
a list of objects, each element of which contains a row from the treetable model

getUncachedGroupCount

public int getUncachedGroupCount(Object node)
Retrieves the children count for node.

Specified by:
getUncachedGroupCount in interface CacheableTreeTableModel
Parameters:
node - the node for which the children count we want to retrieve.
Returns:
the node's children count.

getUncachedGroups

public List getUncachedGroups(Object parent,
                              int from,
                              int to)
Retrieves the branch rows from the treetable model by specifying a row interval. The following condition must be true: from >= to. The List returned must contain the row elements starting at from. However, the List may contain less elements than those specified in the range.

Specified by:
getUncachedGroups in interface CacheableTreeTableModel
Parameters:
parent - the parent node
from - the starting row
to - the ending row
Returns:
a list of objects, each element of which contains a row from the treetable model

getValueAt

public Object getValueAt(Object node,
                         int column)
Returns the value to be displayed for node, at column index column.

Specified by:
getValueAt in interface TreeTableModel
Parameters:
node - the node to query
column - the column index
Returns:
the value

isAggregate

public boolean isAggregate(Object row)
Determines if node is an aggregate row.

Specified by:
isAggregate in interface TreeTableModel
Overrides:
isAggregate in class AbstractTreeTableModel
Parameters:
row - the node to consider
Returns:
true if node is an aggregate row, false otherwise

isCellEditable

public boolean isCellEditable(Object node,
                              int columnIndex)
Returns true if node at columnIndex is editable.

Specified by:
isCellEditable in interface TreeTableModel
Parameters:
node - the node to consider
columnIndex - the column index
Returns:
true if the node at columnIndex is editable, false otherwise

isCountCached

public boolean isCountCached(Object node)
Determines whether the children count for node has been evaluated.

Specified by:
isCountCached in interface CacheableTreeTableModel
Returns:
true if the node's children count has already been evaluated.

isFooter

public boolean isFooter(Object row)
Determines if node is a footer.

Specified by:
isFooter in interface TreeTableModel
Overrides:
isFooter in class AbstractTreeTableModel
Parameters:
row - the row to consider
Returns:
true if node is a footer, false otherwise

isHeader

public boolean isHeader(Object row)
Determines if node is a header.

Specified by:
isHeader in interface TreeTableModel
Overrides:
isHeader in class AbstractTreeTableModel
Parameters:
row - the row to query
Returns:
true if node is a header, false otherwise

isRangedModel

public boolean isRangedModel()
Determines whether the cache model can fetch data in ranges.

Specified by:
isRangedModel in interface CacheableTreeTableModel
Returns:
true if the cache model can fetch ranged data.

isValueCached

public boolean isValueCached(Object node,
                             int column)
Determines whether the value for node at index column has been evaluated.

Specified by:
isValueCached in interface CacheableTreeTableModel
Parameters:
node - the node to consider
column - the cell's column index
Returns:
true if the value has already been evaluated

removeReorderListener

public void removeReorderListener(ReorderListener l)
Removes a listener from the list that is notified each time a reorder event is generated.

Specified by:
removeReorderListener in interface ReorderModel
Parameters:
l - the RearrangeListener

rowsReordered

public void rowsReordered(ReorderEvent e)
Called whenever the rows of a JTable have been restructured.

Specified by:
rowsReordered in interface ReorderListener
Parameters:
e - the ReorderEvent object

setTreeModel

public void setTreeModel(TreeModel newModel)
Sets the underlying tree model to newModel

Overrides:
setTreeModel in class TreeModelMap
Parameters:
newModel - the new tree model to assign.

setTreeTableModel

public void setTreeTableModel(TreeTableModel treeTableModel)
Sets the underlying tree table model to treeTableModel. This method will invoke setTreeModel.

Parameters:
treeTableModel - the new tree table model to assign.

setValueAt

public void setValueAt(Object aValue,
                       Object node,
                       int columnIndex)
Sets the value for node at columnIndex to aValue.

Specified by:
setValueAt in interface TreeTableModel
Parameters:
aValue - the new value
node - the node whose value is to be changed
columnIndex - the column whose value is to be changed

getInnerTreeTableModel

public TreeTableModel getInnerTreeTableModel()
In a chain of TreeTableModelMaps, this method returns the inner most treetable model that is not an instanceof TreeTableModelMap.

Returns:
the innermost treetable model instance that is not an instance of TreeTableModelMap.

Copyright © 2005 Scientific Applications. All Rights Reserved.