private boolean checkChildren(DefaultMutableTreeNode parent, MixedCheckBox.MixedCheckBoxStatus status) { boolean childrenCheck = true; Enumeration children = parent.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); MixedCheckBox checkBox = (MixedCheckBox) child.getUserObject(); if (checkBox.getStatus() != status) { childrenCheck = false; break; } } return childrenCheck; }
@SuppressWarnings("unchecked") public DefaultMutableTreeNode getChild(DefaultMutableTreeNode node, TreeNodeUserObject name) { Enumeration<DefaultMutableTreeNode> entry = node.children(); while (entry.hasMoreElements()) { DefaultMutableTreeNode nods = entry.nextElement(); if (((TreeNodeUserObject) nods.getUserObject()).getOriginalName().equals(name.getOriginalName())) { return nods; } } return null; }
private void selectChildren(DefaultMutableTreeNode parent, MixedCheckBox.MixedCheckBoxStatus status) { MixedCheckBox box = (MixedCheckBox) parent.getUserObject(); if (box.getBenchmarkResult() instanceof SingleBenchmarkResult) { if (status == CHECKED) { selectedSingleBenchmarkNodes.add(parent); } else if (status == UNCHECKED) { selectedSingleBenchmarkNodes.remove(parent); } } Enumeration children = parent.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); MixedCheckBox childCheckBox = (MixedCheckBox) child.getUserObject(); childCheckBox.setStatus(status); selectChildren(child, status); } }
private void expandSubtree(TreePath path, boolean expand) { if (path == null) { TreePath selectionPath = getSelectionPath(); path = selectionPath == null ? new TreePath(treeModel.getRoot()) : selectionPath; } DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) path.getLastPathComponent(); Enumeration children = currentNode.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); TreePath expandedPath = path.pathByAddingChild(child); expandSubtree(expandedPath, expand); } if (expand) { expandPath(path); } else if (path.getParentPath() != null) { collapsePath(path); } }
/** * @deprecated */ public void setAllDescendantsDeSelected() { Enumeration children = children(); while (children.hasMoreElements()) { CategoryNode node = (CategoryNode) children.nextElement(); node.setSelected(false); node.setAllDescendantsDeSelected(); } }
/** * @deprecated */ public void setAllDescendantsSelected() { Enumeration children = children(); while (children.hasMoreElements()) { CategoryNode node = (CategoryNode) children.nextElement(); node.setSelected(true); node.setAllDescendantsSelected(); } }
private void logNode(DefaultMutableTreeNode theTreeNode, String message) { if (!LOGGER.isDebugEnabled()) { return; } DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) theTreeNode.getParent(); Node theNode = (Node) theTreeNode.getUserObject(); Node theParentNode = parentNode == null ? null : (Node) parentNode.getUserObject(); @SuppressWarnings({"unchecked"}) Enumeration<DefaultMutableTreeNode> children = theTreeNode.children(); LOGGER.debug( message + ": " + theNode + ", " + theNode.type + ", parent " + theParentNode + (theParentNode == null ? "" : ", " + theParentNode.type)); while (children.hasMoreElements()) { DefaultMutableTreeNode treeNode = children.nextElement(); Node child = (Node) treeNode.getUserObject(); LOGGER.debug("\t" + child.toString() + ", " + child.type); } }
@Override public void run() { try { Queue<DefaultMutableTreeNode> q = new LinkedList<>(); q.add(node); while (!q.isEmpty()) { final DefaultMutableTreeNode n = q.poll(); expand(n); @SuppressWarnings("unchecked") Enumeration<TreeNode> children = n.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); if (!child.isLeaf() && child.getChildCount() > 0) { q.offer(child); } } } } finally { executor.shutdownNow(); } } });
/** * returns null if no CategoryNode exists. */ public CategoryNode getCategoryNode(CategoryPath path) { CategoryNode root = (CategoryNode) getRoot(); CategoryNode parent = root; // Start condition. for (int i = 0; i < path.size(); i++) { CategoryElement element = path.categoryElementAt(i); // If the two nodes have matching titles they are considered equal. Enumeration children = parent.children(); boolean categoryAlreadyExists = false; while (children.hasMoreElements()) { CategoryNode node = (CategoryNode) children.nextElement(); String title = node.getTitle().toLowerCase(); String pathLC = element.getTitle().toLowerCase(); if (title.equals(pathLC)) { categoryAlreadyExists = true; // This is now the new parent node. parent = node; break; // out of the while, and back to the for(). } } if (categoryAlreadyExists == false) { return null; // Didn't find the Node. } } return (parent); }
Enumeration children = parent.children();
Enumeration children = parent.children();
@SuppressWarnings({"unchecked"}) @Override public Enumeration<N> children() { return (Enumeration<N>) super.children(); }
private boolean isNodeContained(String nodeName, DefaultMutableTreeNode root) { Enumeration children = root.children(); while (children.hasMoreElements()) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); if (nodeName.equals(child.toString())) { return true; } } return false; }
public Enumeration children() { loadChildrenIfNecessary(); return super.children(); } }
public Enumeration children() { loadChildrenIfNecessary(); return super.children(); } }
@Override public Enumeration children() { init(); return super.children(); }
/** Used as the basis for dynamic generation of hotkey list. * Same as {@link #createMenuEntryTree(String)} but all MenuEntries without associated accelerator * and (then) empty submenus are removed from the result. * @throws IllegalArgumentException if the menuRootKey does not point to an entry in the menu tree */ public static DefaultMutableTreeNode createAcceleratebleMenuEntryTree(final String menuRootKey) { final DefaultMutableTreeNode menuEntryTreeNode = MenuUtils.createMenuEntryTree(menuRootKey); final DefaultMutableTreeNode result = new DefaultMutableTreeNode(menuEntryTreeNode.getUserObject()); addAcceleratableChildrenRecursively(result, menuEntryTreeNode.children()); return result; }
/** * @deprecated */ public void setAllDescendantsDeSelected() { Enumeration children = children(); while (children.hasMoreElements()) { CategoryNode node = (CategoryNode) children.nextElement(); node.setSelected(false); node.setAllDescendantsDeSelected(); } }
/** * @deprecated */ public void setAllDescendantsSelected() { Enumeration children = children(); while (children.hasMoreElements()) { CategoryNode node = (CategoryNode) children.nextElement(); node.setSelected(true); node.setAllDescendantsSelected(); } }
/** * @deprecated */ public void setAllDescendantsDeSelected() { Enumeration children = children(); while (children.hasMoreElements()) { CategoryNode node = (CategoryNode) children.nextElement(); node.setSelected(false); node.setAllDescendantsDeSelected(); } }