// ===============================================================
 // ===============================================================
 private void expandChildren(DefaultMutableTreeNode node) {
   boolean level_done = false;
   for (int i = 0; i < node.getChildCount(); i++) {
     DefaultMutableTreeNode child = (DefaultMutableTreeNode) node.getChildAt(i);
     if (child.isLeaf()) {
       if (!level_done) {
         expandNode(child);
         level_done = true;
       }
     } else expandChildren(child);
   }
 }
 private void _storePaths(DefaultMutableTreeNode root) {
   ArrayList<TreeNode> childNodes = childrenToArray(root);
   for (final Object childNode1 : childNodes) {
     DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) childNode1;
     TreePath path = new TreePath(childNode.getPath());
     if (myTree.isPathSelected(path)) {
       addPathToList(childNode, mySelectionPaths);
     }
     if ((myTree.isExpanded(path) || childNode.getChildCount() == 0) && !childNode.isLeaf()) {
       addPathToList(childNode, myPathsToExpand);
       _storePaths(childNode);
     }
   }
 }
 /**
  * Called whenever the value of the selection changes.
  *
  * @param e the event that characterizes the change.
  */
 public void valueChanged(TreeSelectionEvent e) {
   TreePath path = e.getPath();
   if (path != null) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
     if (node.isLeaf()) {
       if (getInformation(path) != null) {
         // When selecting an image information.
         XmlInformation info = getInformation(path);
         for (int i = 0; i < listener_list.size(); i++) {
           InformationTreeSelectionListener listener =
               (InformationTreeSelectionListener) listener_list.elementAt(i);
           listener.select(info);
         }
       } else {
         // When expanding a folder.
         expandNode(node);
       }
     }
   }
 }
  private void doSaveAll() {
    ObjectOutputStream objectStream = getObjectOutputStream();

    if (objectStream != null) {
      try {
        System.out.println("Saving All " + generations.getLeafCount() + " Generations...");

        for (Enumeration e = generations.depthFirstEnumeration(); e.hasMoreElements(); ) {
          DefaultMutableTreeNode tmpNode = (DefaultMutableTreeNode) e.nextElement();

          if (tmpNode.isLeaf()) objectStream.writeObject(tmpNode.getUserObject());
        }

        objectStream.close();
        System.out.println("Save completed successfully.");
      } catch (IOException e) {
        System.err.println(e);
      }
    } else {
      System.out.println("Save All Files has been aborted!");
    }
  }