/** * Bean constructor. * @param root */ public TransientTreeModelBase(final TreeNode root) { super(root); setTreeState(new TransientTreeStateBase()); }
/** * @return the active node of the tree */ public TreeNode getActiveNode() { TransientTreeStateBase myTreeState = (TransientTreeStateBase) getTreeState(); String nodeId = myTreeState.getActiveNodeId(); return getNodeById(nodeId); }
/** * Set the active node. * @param nodeId */ public void setActiveNode(final String nodeId) { TransientTreeStateBase myTreeState = (TransientTreeStateBase) getTreeState(); String[] nodePath = getPathInformation(nodeId); String id = ""; for (String string : nodePath) { id += " " + string; } myTreeState.expandPath(nodePath); }
/** * Set the identifiers of all the nodes of the tree. */ protected void setNodeIdentifiers() { rootNode.setIdentifier("0"); setChildrenIdentifiers(rootNode, "0"); }
/** * Bean constructor. * @param root */ public TreeModelBase(final TreeNode root) { super(root); rootNode = root; setNodeIdentifiers(); }
/** * @return the active node of the tree */ public TreeNode getActiveNode() { TransientTreeStateBase myTreeState = (TransientTreeStateBase) getTreeState(); String nodeId = myTreeState.getActiveNodeId(); return getNodeById(nodeId); }
/** * Set the active node. * @param nodeId */ public void setActiveNode(final String nodeId) { TransientTreeStateBase myTreeState = (TransientTreeStateBase) getTreeState(); String[] nodePath = getPathInformation(nodeId); String id = ""; for (String string : nodePath) { id += " " + string; } myTreeState.expandPath(nodePath); }
/** * Bean constructor. * @param root */ public TransientTreeModelBase(final TreeNode root) { super(root); setTreeState(new TransientTreeStateBase()); }
/** * Set the identifiers of all the nodes of the tree. */ protected void setNodeIdentifiers() { rootNode.setIdentifier("0"); setChildrenIdentifiers(rootNode, "0"); }
/** * Bean constructor. * @param root */ public TreeModelBase(final TreeNode root) { super(root); rootNode = root; setNodeIdentifiers(); }
/** * Set the identifiers of the nodes of a hierarchy. * @param node * @param id */ private void setChildrenIdentifiers(final TreeNode node, final String id) { for (int i = 0; i < node.getChildCount(); i++) { TreeNode child = (TreeNode) (node.getChildren().get(i)); String childId = id + SEPARATOR + i; child.setIdentifier(childId); setChildrenIdentifiers(child, childId); } }
/** * Set the identifiers of the nodes of a hierarchy. * @param node * @param id */ private void setChildrenIdentifiers(final TreeNode node, final String id) { for (int i = 0; i < node.getChildCount(); i++) { TreeNode child = (TreeNode) (node.getChildren().get(i)); String childId = id + SEPARATOR + i; child.setIdentifier(childId); setChildrenIdentifiers(child, childId); } }