2 Replies Latest reply on Jan 26, 2009 6:02 AM by lmk

    rich:tree: why rootNode disappear

    lmk

      hi all,

      just a quation about using a default tree model;
      I have one rootNode wich contains a lot of childs, only childs are displayed.
      here a snippet code:

      private void loadTree() {
      
       rootNode = new TreeNodeImpl();
       rootNode.setData(rootObject);
       addNodes(files, rootNode);
       }
      
      private void addNodes(List<FileObject> files, TreeNode node) {
      
      Iterator<FileObject> i = files.iterator();
      
      int counter = 1;
      while (i.hasNext()) {
      FileObject fo = i.next();
      String value = fo.getName();
      TreeNodeImpl nodeImpl = new TreeNodeImpl();
      nodeImpl.setData(value);
      node.addChild(new Integer(counter), nodeImpl);
      counter++;
      }
      
      }


      thanks