/** * Bean constructor. * @param root */ public TreeModelBase(final TreeNode root) { super(root); rootNode = root; setNodeIdentifiers(); }
/** * Set the identifiers of all the nodes of the tree. */ protected void setNodeIdentifiers() { rootNode.setIdentifier("0"); setChildrenIdentifiers(rootNode, "0"); }
/** * Set the identifiers of all the nodes of the tree. */ protected void setNodeIdentifiers() { rootNode.setIdentifier("0"); setChildrenIdentifiers(rootNode, "0"); }
/** * 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); } }
/** * 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); } }