/** Methods that create a tree node for given node. * The tree node reflects the state of the associated node as close * as possible, but is updated asynchronously in event dispatch thread. * <P> * This method can be called only from AWT-Event dispatch thread. * * @param node node to create safe representant for * @return tree node that represents the node */ public static TreeNode findVisualizer (Node node) { return VisualizerNode.getVisualizer (null, node); }
/** Methods that create a tree node for given node. * The tree node reflects the state of the associated node as close * as possible, but is updated asynchronously in event dispatch thread. * <P> * This method can be called only from AWT-Event dispatch thread. * * @param node node to create safe representant for * @return tree node that represents the node */ public static TreeNode findVisualizer (Node node) { return VisualizerNode.getVisualizer (null, node); }
/** Utility method to find a visualizer node for the object passed to * any of the cell renderer methods as the value */ private static final VisualizerNode findVisualizerNode(Object value) { VisualizerNode vis = (value instanceof Node) ? VisualizerNode.getVisualizer (null, (Node) value) : (VisualizerNode)value; if (vis == null) { vis = VisualizerNode.EMPTY; } return vis; }
/** Creates new VisualizerChildren. * Can be called only from EventQueue. */ public VisualizerChildren (VisualizerNode parent, Node[] nodes) { this.parent = parent; int s = nodes.length; for (int i = 0; i < s; i++) { VisualizerNode v = VisualizerNode.getVisualizer (this, nodes[i]); list.add (v); } }
/** Creates new VisualizerChildren. * Can be called only from EventQueue. */ public VisualizerChildren (VisualizerNode parent, Node[] nodes) { this.parent = parent; int s = nodes.length; for (int i = 0; i < s; i++) { VisualizerNode v = VisualizerNode.getVisualizer (this, nodes[i]); list.add (v); } }
/** Utility method to find a visualizer node for the object passed to * any of the cell renderer methods as the value */ private static VisualizerNode findVisualizerNode(Object value) { if (value instanceof Node) { return VisualizerNode.getVisualizer(null, (Node)value); } else if (value instanceof VisualizerNode) { return (VisualizerNode)value; } else if (value == null || " ".equals(value) || "".equals(value)) { return VisualizerNode.EMPTY; } else { throw new ClassCastException("Unexpected value: " + value); } }
public javax.swing.tree.TreeNode getParent() { Node parent = node.getParentNode(); return (parent == null) ? null : getVisualizer(null, parent); }
public javax.swing.tree.TreeNode getParent() { Node parent = node.getParentNode (); return parent == null ? null : getVisualizer (null, parent); }
/** Test whether a node is expanded in the tree or not * @param n the node to test * @return true if the node is expanded */ public boolean isExpanded (Node n) { TreePath treePath = new TreePath ( treeModel.getPathToRoot ( VisualizerNode.getVisualizer (null, n) ) ); return tree.isExpanded (treePath); }
/** Collapses the tree under given node. * * @param n node to collapse */ public void collapseNode (Node n) { TreePath treePath = new TreePath ( treeModel.getPathToRoot ( VisualizerNode.getVisualizer (null, n) ) ); tree.collapsePath (treePath); }
/** Test whether a node is expanded in the tree or not * @param n the node to test * @return true if the node is expanded */ public boolean isExpanded (Node n) { TreePath treePath = new TreePath ( treeModel.getPathToRoot ( VisualizerNode.getVisualizer (null, n) ) ); return tree.isExpanded (treePath); }
/** Collapses the tree under given node. * * @param n node to collapse */ public void collapseNode (Node n) { TreePath treePath = new TreePath ( treeModel.getPathToRoot ( VisualizerNode.getVisualizer (null, n) ) ); tree.collapsePath (treePath); }
/** Collapses the tree under given node. * * @param n node to collapse */ public void collapseNode(Node n) { if (n == null) { throw new IllegalArgumentException(); } TreePath treePath = new TreePath(treeModel.getPathToRoot(VisualizerNode.getVisualizer(null, n))); getOutline().collapsePath(treePath); }
/** Test whether a node is expanded in the tree or not * @param n the node to test * @return true if the node is expanded */ public boolean isExpanded(Node n) { TreePath treePath = new TreePath(treeModel.getPathToRoot(VisualizerNode.getVisualizer(null, n))); return getOutline().isExpanded(treePath); }
/** Synchronize the explored context from the manager of this Explorer. */ final void synchronizeExploredContext() { Node n = manager.getExploredContext (); if (n != null) { TreePath treePath = new TreePath (treeModel.getPathToRoot (VisualizerNode.getVisualizer (null, n))); showPath(treePath); } }
/** Synchronize the explored context from the manager of this Explorer. */ final void synchronizeExploredContext() { Node n = manager.getExploredContext (); if (n != null) { TreePath treePath = new TreePath (treeModel.getPathToRoot (VisualizerNode.getVisualizer (null, n))); showPath(treePath); } }
/** Expandes the node in the tree. * * @param n node */ public void expandNode (Node n) { lookupExplorerManager (); TreePath treePath = new TreePath ( treeModel.getPathToRoot ( VisualizerNode.getVisualizer (null, n) ) ); tree.expandPath (treePath); }
public void run () { VisualizerNode v = (VisualizerNode)getRoot (); VisualizerNode nr = VisualizerNode.getVisualizer (null, root); if (v == nr) { // no change return; } v.removeNodeModel (listener ()); nr.addNodeModel (listener ()); setRoot (nr); } });
private void updateSelection() { Node[] nodes = manager.getSelectedNodes (); if (nodes.length > 0) { setSelectedItem ( VisualizerNode.getVisualizer (null, nodes[0]) ); } else { setSelectedItem (showExploredContext ? manager.getExploredContext() : manager.getRootContext()); } }
private void updateSelection() { Node[] nodes = manager.getSelectedNodes(); if (nodes.length > 0) { setSelectedItem(VisualizerNode.getVisualizer(null, nodes[0])); } else { setSelectedItem(showExploredContext ? manager.getExploredContext() : manager.getRootContext()); } }