/** * Unfolds every node that has only children which themselves have children. As this function is a * bit difficult to describe and perhaps not so useful, it is currently not introduced into the * menus. * * @param node node to start from. */ public void foldLastBranches(MindMapNode node) { boolean nodeHasChildWhichIsLeave = false; for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { MindMapNode child = (MindMapNode) i.next(); if (child.getChildCount() == 0) { nodeHasChildWhichIsLeave = true; } } setFolded(node, nodeHasChildWhichIsLeave); for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { foldLastBranches((MindMapNode) i.next()); } }
private void updateModel(DefaultTableModel model, MindMapNode node) { ReminderHookBase hook = TimeManagementOrganizer.getHook(node); // show all nodes or only those with reminder: if (showAllNodes || hook != null) { Date date = null; if (hook != null) { date = new Date(hook.getRemindUserAt()); } model.addRow( new Object[] { date, new NodeHolder(node), new IconsHolder(node), node.getHistoryInformation().getCreatedAt(), node.getHistoryInformation().getLastModifiedAt(), new NotesHolder(node) }); } if ((!mViewFoldedNodes) && node.isFolded()) { // no recursion, if folded nodes should be hidden. return; } for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { MindMapNode child = (MindMapNode) i.next(); updateModel(model, child); } }
protected int getMaxDepth(MindMapNode node) { if (node.isFolded() || !node.hasChildren()) return depth(node); int k = 0; for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { int l = getMaxDepth((MindMapNode) i.next()); if (l > k) k = l; } return k; }
public int getMinDepth(MindMapNode node) { if (node.isFolded()) return depth(node); if (!node.hasChildren()) return Integer.MAX_VALUE; int k = Integer.MAX_VALUE; for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { int l = getMinDepth((MindMapNode) i.next()); if (l < k) k = l; } return k; }
public void foldStageN(MindMapNode node, int stage) { int k = depth(node); if (k < stage) { setFolded(node, false); for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { foldStageN((MindMapNode) i.next(), stage); } } else { foldAll(node); } }
public void unfoldAll(MindMapNode node) { setFolded(node, false); for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { unfoldAll((MindMapNode) i.next()); } }
protected void foldAll(MindMapNode node) { for (Iterator i = node.childrenUnfolded(); i.hasNext(); ) { foldAll((MindMapNode) i.next()); } setFolded(node, true); }