4 Replies Latest reply on Feb 2, 2007 11:23 AM by denis.diggin

    The Tree died

    rkalff

      This problem is driving me crazy for day's now. I want to make use of the ADF Tree or Trinidad Tree in my Seam application. Unlike the examples I want to fill the tree with data from my Session Bean. The problem is that only the root elements are rendered and no child elements nor an arrow to indicate that the root element has child properties.
      When I use the same data and define the bean as a managed bean in my faces-config everything works fine.

      My code of session bean:
      @Stateful
      @Name("brandFinder")
      @Scope(ScopeType.SESSION)
      public class BrandFinderBean implements BrandFinder {
      @Out(required=false)
      TreeModel brandTreeModel;

      @Factory("brandTreeModel")
      public void initBrandTreeModel() {
      ArrayList list = new ArrayList();

      TreeNodeImpl node_0 = _createNode("tnode_0");
      TreeNodeImpl node_0_0 = _createNode("tnode_0_0");
      TreeNodeImpl node_0_0_0 = _createNode("tnode_0_0_0");
      TreeNodeImpl node_0_0_0_0 = _createNode("tnode_0_0_0_0");
      TreeNodeImpl node_0_0_1 = _createNode("tnode_0_0_1");
      TreeNodeImpl node_0_1 = _createNode("tnode_0_1");
      TreeNodeImpl node_0_1_0 = _createNode("tnode_0_1_0");
      TreeNodeImpl node_0_1_1 = _createNode("tnode_0_1_1");
      TreeNodeImpl node_0_2 = _createNode("tnode_0_2");
      TreeNodeImpl node_0_3 = _createNode("tnode_0_3");
      TreeNodeImpl node_0_4 = _createNode("tnode_0_4");
      TreeNodeImpl node_0_5 = _createNode("tnode_0_5");
      list.add(node_0);

      ArrayList list_0 = new ArrayList();
      list_0.add(node_0_0);
      list_0.add(node_0_1);
      list_0.add(node_0_2);
      list_0.add(node_0_3);
      list_0.add(node_0_4);
      list_0.add(node_0_5);
      node_0.setChildren(list_0);

      ArrayList list_0_0 = new ArrayList();
      list_0_0.add(node_0_0_0);
      list_0_0.add(node_0_0_1);
      node_0_0.setChildren(list_0_0);

      ArrayList list_0_0_0 = new ArrayList();
      list_0_0_0.add(node_0_0_0_0);
      node_0_0_0.setChildren(list_0_0_0);

      ArrayList list_0_1 = new ArrayList();
      list_0_1.add(node_0_1_0);
      list_0_1.add(node_0_1_1);
      node_0_1.setChildren(list_0_1);

      brandTreeModel = new ChildPropertyTreeModel(list, "children");
      }

      @Destroy @Remove
      public void destroy() {}
      }

      My code of the tree:
      <af:tree var="foo" value="#{brandTreeModel}">
      <f:facet name="nodeStamp">
      <af:outputText value="#{foo.text}"/>
      </f:facet>
      </af:tree>

      I'm desparadely searching for an solution, I hope that someone has run into the problem before or has an possible solution why it does work when using a managed bean and doesn't when using a session bean.

      Regards,

      Rene