5 Replies Latest reply on Sep 25, 2007 1:51 PM by Yurii Kartsev

    recursiveTreeNodesAdaptor demo doesn't work

    Yurii Kartsev Apprentice

      Good afternoon, dear RichFaces gurus!

      I've started getting into rich:tree and the first example I've tried is - Recursive Tree Adaptor (http://livedemo.exadel.com/richfaces-demo/richfaces/treeNodesAdaptor.jsf)

      I've copied the sources from the page:

      FileSystemBean.java
      FileSystemNode.java
      PostbackPhaseListener.java
      TreeDemoStateAdvisor.java

      Then I've added this in my faces-config.xml (like in 3.1.0 src):

      <managed-bean>
       <managed-bean-name>treeDemoStateAdvisor</managed-bean-name>
       <managed-bean-class>
       org.richfaces.treemodeladaptor.TreeDemoStateAdvisor
       </managed-bean-class>
       <managed-bean-scope>application</managed-bean-scope>
       </managed-bean>
      
       <managed-bean>
       <managed-bean-name>fileSystemBean</managed-bean-name>
       <managed-bean-class>
       org.richfaces.treemodeladaptor.FileSystemBean
       </managed-bean-class>
       <managed-bean-scope>application</managed-bean-scope>
       </managed-bean>
      
       <lifecycle>
       <phase-listener>org.richfaces.treemodeladaptor.PostbackPhaseListener</phase-listener>
       </lifecycle>


      Then I've added this code to my xhtml-file:
      ...
      
       <ui:define name="tree">
      
       <rich:separator height="1" style="padding:10px" />
       <h:form id="employeesDataTable_form">
      
       <rich:tree style="width:300px" switchType="ajax" stateAdvisor="#{treeDemoStateAdvisor}">
       <rich:recursiveTreeNodesAdaptor roots="#{fileSystemBean.sourceRoots}" var="item" nodes="#{item.nodes}" />
       </rich:tree>
      
       </h:form>
       <rich:separator height="1" style="padding:10px;" />
       </ui:define>
      
      ...


      And the result is no tree at all. Just free space for 400px.

      I've tried to debug FileSystemBean.getSourceRoots(), and there is a condition "if (srcRoots == null)" - it gives false. Maybe this is the reason? Because there is no defined constructor in FileSystemBean and there is no place where srcRoots equals null. Just definition: "private FileSystemNode[] srcRoots;".

      Definitely I'm doing something wrong, but what exactly?

      Thank you in advance.