0 Replies Latest reply on Jun 1, 2007 12:30 PM by laksu

    Tree tutorial

    laksu

      Hi,
      I am new to richfaces and I need to use the tree component. I have gone through the developer's guide and the sample application's source but I still feel like a stupid. I don't understand a number of things and I wonder if there exists a more verbose example somewhere.

      I have a number of question marks but one-at-a-time: Let's say I have a simple entity bean, referencing itself to form a tree:

      @Entity
      class Category {
       Long id;
       String Name
      
      @ManyToOne
       Category parent;
      
      @OneToMany ...
       List<Category> children;
      }


      Those "Category"s with a null parent are the root nodes of the tree etc.
      In the richfaces' sample application, entities like Library,Song,Artist, etc. all implement TreeNode. I doubt, that is a proper practice because it deviates from the POJO pattern and introduces dependency to an external library. Looks like it is better to have built wrapper classes that is extending the TreeNode which is somewhat awkward either.
      I wonder how you guys out there handle it.