2 Replies Latest reply on Sep 17, 2010 4:51 AM by krikor herlopian

    Rich Tree<Object> problem

    krikor herlopian Newbie


                                                  <rich:tree   styleClass="font"  style="width:300px" nodeSelectListener="#{menu.processSelection}"
                                                  switchType="ajax"
                                                  value="#{menu.treeNode}"  var="item">
                                                         <a4j:support event="onselected" reRender="panelGrid" action="#{menu.changeForm}"  />
                                                        <h:outputText   value="#{item.objectName}" ></h:outputText>
                                                  </rich:tree>

       

       

      I have rich tree. I add nodes to it this way

      String key = path != null ? menuSList.get(index).getObjectCode() + '.' + counter : String.valueOf(counter);

       

                  TreeNodeImpl<Menu> nodeImpl = new TreeNodeImpl<Menu>();
                  nodeImpl.setData(menuSList.get(index));
                  node.addChild(new Integer(counter), nodeImpl);
                 
              //    arrayA.add(nodeImpl.toString());
                  //arrayB.add(menuSList.get(index).getObjectCode());
                  addNodes(key, nodeImpl, properties,menuSList.get(index).getChildren());
                  index = index + 1;
                  counter++;

       

       

      Its of type Menu, the class Menu has objectName. I want to display the objectName as the node name. But my problem is that  it displays the address of menu  like this

      src.com.fp.Menu@14e5e21

       

       

      anyone with help?       

        • 1. Re: Rich Tree<Object> problem
          krikor herlopian Newbie

          When I do this on process selection

           

          TreeNode currentNode = tree.getModelTreeNode(tree.getRowKey());
                      Menu men = (Menu) currentNode.getData();
                      System.out.println("--"+men.getObjectCode()+"--"+men.getObjectName());

           

          am reading everything perfect. I am getting the objectcode. But I want to display the objectname. any help appreciated.    

          • 2. Re: Rich Tree<Object> problem
            krikor herlopian Newbie

            i solved the issue

             

            <rich:tree   styleClass="font"  style="width:300px" nodeSelectListener="#{menu.processSelection}"
                                                        switchType="ajax"
                                                        value="#{menu.treeNode}"  var="item">
                                                               <a4j:support event="onselected" reRender="panelGrid" action="#{menu.changeForm}"  />
                                                                <rich:treeNode>
                                                              <h:outputText   value="#{item.objectName}" ></h:outputText>
                                                            </rich:treeNode>
                                                        </rich:tree>

             

             

            sorry for bothering.