Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.treetable
Class NodeTreeTableModelMap

java.lang.Object
  extended by com.sciapp.treetable.AbstractTreeTableModel
      extended by com.sciapp.treetable.TreeModelMap
          extended by com.sciapp.treetable.TreeTableModelMap
              extended by com.sciapp.treetable.NodeTreeTableModelMap
All Implemented Interfaces:
ReorderListener, CacheableTreeTableModel, ReorderModel, TreeTableModel, Serializable, EventListener, TreeModelListener, TreeModel

public class NodeTreeTableModelMap
extends TreeTableModelMap

NodeTreeTableModelMap will show only a single branch of a TreeTableModel. Whether the node's children will be visible, depends on the showChildren property. The tree node to show can be specified in the constructor, but can be later specified by calling AbstractTreeTableModel.setRoot(java.lang.Object).

See Also:
Serialized Form

Field Summary
protected  boolean showChildren
          determines whether to show the node's children
 
Fields inherited from class com.sciapp.treetable.TreeTableModelMap
treeTableModel
 
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
NodeTreeTableModelMap(TreeTableModel treeTableModel, Object root)
          Constructs a NodeTreeTableModelMap.
 
Method Summary
 int getChildCount(Object parent)
          Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.
 Object getRoot()
          Returns the root of the tree. Returns null only if the tree has no nodes.
 boolean getShowChildren()
          Determines whether to show the node's children.
 boolean isLeaf(Object node)
          Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.
 void setShowChildren(boolean showChildren)
          Determines whether to show the node's children.
 void treeStructureChanged(TreeModelEvent e)
          

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

Use e.getPath() to get the path to the node. e.getChildIndices() returns null.

 
Methods inherited from class com.sciapp.treetable.TreeTableModelMap
addReorderListener, fireRowsMapped, fireRowsReordered, getColumnClass, getColumnCount, getColumnName, getInnerTreeTableModel, getMappedIndexes, getTreeTableModel, getUncachedChildren, getUncachedGroupCount, getUncachedGroups, getValueAt, isAggregate, isCellEditable, isCountCached, isFooter, isHeader, isRangedModel, isValueCached, removeReorderListener, rowsReordered, setTreeModel, setTreeTableModel, setValueAt
 
Methods inherited from class com.sciapp.treetable.TreeModelMap
getChild, getIndexOfChild, getPathToRoot, getPathToRoot, getTreeModel, nodeChanged, nodesChanged, nodeStructureChanged, treeNodesChanged, treeNodesInserted, treeNodesRemoved, 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, getIndexOfChild, removeTreeModelListener, valueForPathChanged
 

Field Detail

showChildren

protected boolean showChildren
determines whether to show the node's children

Constructor Detail

NodeTreeTableModelMap

public NodeTreeTableModelMap(TreeTableModel treeTableModel,
                             Object root)
Constructs a NodeTreeTableModelMap.

Method Detail

getChildCount

public int getChildCount(Object parent)
Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.

Specified by:
getChildCount in interface TreeModel
Overrides:
getChildCount in class TreeModelMap
Parameters:
parent - a node in the tree, obtained from this data source
Returns:
the number of children of the node parent

getRoot

public Object getRoot()
Returns the root of the tree. Returns null only if the tree has no nodes.

Specified by:
getRoot in interface TreeModel
Overrides:
getRoot in class TreeModelMap
Returns:
the root of the tree

getShowChildren

public boolean getShowChildren()
Determines whether to show the node's children.

Returns:
true if the children will be shown, false otherwise

isLeaf

public boolean isLeaf(Object node)
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

Specified by:
isLeaf in interface TreeModel
Overrides:
isLeaf in class TreeModelMap
Parameters:
node - a node in the tree, obtained from this data source
Returns:
true if node is a leaf

setShowChildren

public void setShowChildren(boolean showChildren)
Determines whether to show the node's children.

Parameters:
showChildren - true if the children will be shown, false otherwise

treeStructureChanged

public void treeStructureChanged(TreeModelEvent e)

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

Use e.getPath() to get the path to the node. e.getChildIndices() returns null.

Specified by:
treeStructureChanged in interface TreeModelListener
Overrides:
treeStructureChanged in class TreeModelMap

Copyright © 2005 Scientific Applications. All Rights Reserved.