1 Reply Latest reply on Nov 6, 2007 8:55 PM by jvinson

    richfaces treeNode api

    jbarak

      I am trying to build the tree structure in the backing bean using the HtmlTree and HtmlTreeNode api and then bind it from my jsp page. I am unable to add an OutputText inside a treenode. I don't see any exposed method to add a child in the HtmlTreeNode. Am I missing something??

      
       Library library = new Library();
       HtmlTree tree = new HtmlTree();
       tree.setStyle("width:150px");
       tree.setValue(library.getData());
       tree.setVar("item");
       tree.setNodeFace(library.getType());
      
       Iterator it = library.getArtists().values().iterator();
       while (it.hasNext()) {
       Artist artist = (Artist)it.next();
      
       HtmlTreeNode artistNode = new HtmlTreeNode();
       artistNode.setType("artist");
       HtmlOutputText artistText = new HtmlOutputText();
       artistText.setValue(artist.getName());
      
       Iterator it1 = artist.getAlbums();
       while (it1.hasNext()) {
       Album album = (Album) it1.next();
      
       HtmlTreeNode albumNode = new HtmlTreeNode();
       albumNode.setType("album");
       HtmlOutputText albumText = new HtmlOutputText();
       //albumText.setValue(album.getTitle()); ??how do I add this
      
       Iterator it3 = album.getSongs();
       while (it3.hasNext()) {
       Song song = (Song) it3.next();
      
       HtmlTreeNode songNode = new HtmlTreeNode();
       songNode.setType("song");
       HtmlOutputText songText = new HtmlOutputText();
       //songText.setValue(song.getTitle());??how do I add this
      
       tree.getChildren().add(songNode);
       }
       tree.getChildren().add(albumNode);
       tree.getChildren().add(artistNode);
       }
       }