Пример #1
0
 /*
  * @see javax.swing.tree.DefaultTreeModel#insertNodeInto(javax.swing.tree.MutableTreeNode, javax.swing.tree.MutableTreeNode, int)
  */
 @Override
 public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index) {
   super.insertNodeInto(newChild, parent, index);
   if (newChild instanceof ExplorerTreeNode) {
     addNodesToMap((ExplorerTreeNode) newChild);
   }
 }
Пример #2
0
 /**
  * Map all nodes in the subtree rooted at node.
  *
  * @param node the node to be added
  */
 private void addNodesToMap(ExplorerTreeNode node) {
   Enumeration children = node.children();
   while (children.hasMoreElements()) {
     ExplorerTreeNode child = (ExplorerTreeNode) children.nextElement();
     addNodesToMap(child);
   }
   addToMap(node.getUserObject(), node);
 }