www.sdmetrics.com

sdmetrics.app
Class TreeView

java.lang.Object
  |
  +--sdmetrics.app.TreeView

public class TreeView
extends java.lang.Object

Class to generate a set of trees of ElementTreeNode that can be used to create a Swing JTree.

Each tree always shows the elements of one metamodel element type. The class maintains a bidirectional mapping between the nodes in the tree and the indices of the corresponding model elements in the element pool.


Constructor Summary
TreeView(ElementPool pool)
           
 
Method Summary
 ElementTreeNode getNodeForIndex(int tree, int index)
          Retrieve a node for a specific model element.
 int getNumberOfTypes()
          Get the number of available trees (model element types).
 ElementTreeNode getRoot(int tree)
          Get the root node of a specified tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeView

public TreeView(ElementPool pool)
Parameters:
pool - Element pool with the model elements for which to create the trees.
Method Detail

getNumberOfTypes

public int getNumberOfTypes()
Get the number of available trees (model element types).

Returns:
The number N of available trees. Trees are addressed via an index that runs from 0 to N-1.

getNodeForIndex

public ElementTreeNode getNodeForIndex(int tree,
                                       int index)
Retrieve a node for a specific model element.

Parameters:
tree - Index of the tree. Valid indices run from 0 to getNumberOfTypes()-1.
index - Index of the model element type in the meta model.
Returns:
The node object with that index.

getRoot

public ElementTreeNode getRoot(int tree)
Get the root node of a specified tree.

Parameters:
tree - Index of the tree. Valid indices run from 0 to getNumberOfTypes()-1.
Returns:
Root node of that tree.

www.sdmetrics.com