/** * Unmap all nodes in the subtree rooted at the given node. * * @param node the given node */ private void removeNodesFromMap(ExplorerTreeNode node) { Enumeration children = node.children(); while (children.hasMoreElements()) { ExplorerTreeNode child = (ExplorerTreeNode) children.nextElement(); removeNodesFromMap(child); } removeFromMap(node.getUserObject(), node); }
/* * @see javax.swing.tree.DefaultTreeModel#removeNodeFromParent(javax.swing.tree.MutableTreeNode) */ @Override public void removeNodeFromParent(MutableTreeNode node) { if (node instanceof ExplorerTreeNode) { removeNodesFromMap((ExplorerTreeNode) node); ((ExplorerTreeNode) node).remove(); } super.removeNodeFromParent(node); }