public class NodeTreeManager extends Object implements NodeListener
JTreewith a view of a node graph. Since
Nodealready implements the
TreeNodeinterface, what we do here is to install a
NodeListeneron a provided
NodeWatcherand keep a
TreeModelup-to-date. In many cases you will not need to set up a
JTreeyourself, but simply create an instance of
Because of the asynchronous nature of node manipulation,
we have decided to not use the
which cannot account for method failures, for example. The proposed
implementation therefore is, to call the node's methods like
run directly, and the tree will be
updated as soon as the
|Modifier and Type||Field and Description|
Set this to
|Constructor and Description|
Creates a new
|Modifier and Type||Method and Description|
Disposes all resources associated with the tree manager.
Dumps a list of nodes to the given stream.
This method is part of the
public boolean VERBOSE
truefor debugging the incoming node notifications and tree model updates
public NodeTreeManager(NodeWatcher nw, Node rootNode)
NodeTreeManagerfor a given
NodeWatcherinstance and root
nw- the nodewatcher to listen to for node updates. the tree manager copies the current list of registered nodes from the watcher and continuously updates the tree when node notfication messages arrive.
rootNode- the supposed root element in the tree display. can be something like
public NodeTreeManager(NodeWatcher nw)
public void setRoot(Node rootNode)
public void dispose()
disposeon the node watcher.
public TreeModel getModel()
TreeModelsuitable to creating a
public static void dumpTree(PrintStream stream, TreeNode rootNode)
stream- a stream to print on, such as
rootNode- the top element of the tree, or
Copyright © 2015–2017 UW-Madison LOCI. All rights reserved.