5 Replies Latest reply on Jan 21, 2009 10:33 AM by Ilya Shaikovsky

    problem with richfaces tree menu

    safa said Newbie

      Good Morning,
      I'm trying to create a tree menu with richfaces, but the menu wasn't shown


      My JSF code:

      <a4j:form>
      <rich:tree style="width:300px"
       value="#{parc.tree}" var="item">
       <rich:treeNode>
      
       <h:outputText value="#{item.id}" />
       </rich:treeNode>
       </rich:tree>
       </a4j:form>


      My ParcList Class:


      @Name("parcList")
      public class ParcList extends EntityQuery {
      
       private static final String[] RESTRICTIONS = {};
      
       private Parc parc = new Parc();
      
       @Override
       public String getEjbql() {
       return "select parc from Parc parc";
       }
      
       @Override
       public Integer getMaxResults() {
       return 25;
       }
      
       public Parc getParc() {
       return parc;
       }
      
       @Override
       public List<String> getRestrictions() {
       return Arrays.asList(RESTRICTIONS);
       }
      
      
      
       @In EntityManager entityManager;
       TreeNodeImpl parcTree=null;
       public void setTree(){
      
       List<Parc> parc = entityManager.createQuery("from Parc").getResultList();
       Iterator iter = parc.iterator();
       while (iter.hasNext()) {
      
       parcTree.addChild((Parc)iter.next(), parcTree);
       }
       }
      
       public List getTree(){
       List <Parc> parcs = (List<Parc>) parcTree;
       return parcs;
       }
      
      
      }


      and My entity class:

      @Entity
      @Table(name = "parc", schema = "public")
      public class Parc implements java.io.Serializable {
      
       private int id;
       private AireProtegee aireProtegee;
      }
      


      I use seam 2.0.3

      I really need your help,
      thx