0 Replies Latest reply on Jun 17, 2008 6:55 PM by Nicolas di Tada

    Tree component loads the model several times

    Nicolas di Tada Newbie

      I'm using the Tree component and I found a strange behaviour. The beans that represents the model gets called a lot of times whenever a I just expand a branch of the tree.

      Has anyone run into a similar problem? Am I doing something wrong?

      The code is included below.

      Thanks


      <html>
      <f:view>
      <head>
      </head>
      <body>
      <h:form>
      <rich:tree switchType="client" showConnectingLines="false">
      <rich:treeNodesAdaptor id="foo" nodes="#{foo.nodes}" var="root">
      <rich:treeNode>
      <h:outputText value="#{foo}" />
      </rich:treeNode>
      <rich:treeNodesAdaptor var="item" nodes="#{root.nodes}">
      <rich:treeNode>
      <h:outputText value="#{item}" />
      </rich:treeNode>
      </rich:treeNodesAdaptor>
      
      </rich:treeNodesAdaptor>
      </rich:tree>
      </h:form>
      </body>
      </f:view>
      </html>
      

      @Component
      public class Foo {
      
      public Object[] getNodes() {
      List<Bar> result = new ArrayList<Bar>();
      
      result.add(new Bar());
      //result.add(new Bar());
      //result.add(new Bar());
      
      return result.toArray();
      }
      }
      
      @Component
      public class Bar {
      
      public Object[] getNodes() {
      List<String> result = new ArrayList<String>();
      
      result.add("A");
      //result.add("B");
      //result.add("C");
      
      return result.toArray();
      }