The nodes of the graph will be represented by instances
of a class TreeSDMNode
. The TreeSDMModel
class
creates a node that represents the root of the tree, and keeps a reference
to it as shown in the following code example.
private TreeSDMNode root;
public TreeSDMModel(TreeModel treeModel)
{
root = new TreeSDMNode(treeModel, null, treeModel.getRoot());
}
When asked to return the top-level objects of the graph,
the getObjects
method just returns a single
element: the root of the tree, as shown in the following code example.
public Enumeration getObjects()
{
Vector v = new Vector();
v.addElement(root);
return v.elements();
}