private void addElementsToCollection(TreeNode parent, Collection collection) {
    collection.add(parent);
    Enumeration children = parent.children();
    if (children == null) return;
    while(children.hasMoreElements()){
      TreeNode child = (TreeNode) children.nextElement();
      addElementsToCollection(child, collection);
    }
  }
private void addElementsToCollection(TreeNode parent, Collection collection)