6 Replies Latest reply on Feb 5, 2009 10:02 AM by erm0

    dynamic tree and nodeselectlistener problem

    walleye160

      Anybody has problem with dynamic tree and nodeselectlistener? It seems that the processSelection never been fired. Can make the sample from live demo work. However, when I load data from database to generate a tree, like the sample Library, Ablum, and Song, the nodeselectlistener does not work, am i missing something?

      Use 3.2.2, tomcat 6.0

      thanks for any help

        • 1. Re: dynamic tree and nodeselectlistener problem
          nbelaevski

          Hello,

          The provided information is not enough to assist you on the issue. Please post bean and page code.

          • 2. Re: dynamic tree and nodeselectlistener problem
            walleye160

            here is the page code

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfaces.org/rich">
            
             <rich:tree value="#{RootNode.data}"
             var="item" nodeFace="#{item.type}"
             switchType="ajax"
             ajaxSubmitSelection="true"
             reRender="selectedNode"
             nodeSelectListener="#{projectTreeListener.processSelection}"/>
            
             <rich:treeNode type="my_project" >
             <h:outputText value="#{item.name}" />
             </rich:treeNode>
             <rich:treeNode type="Project" iconLeaf="#{item.iconPath}" icon="#{item.iconPath}">
             <h:outputText value="#{item.title}" />
             </rich:treeNode>
             <rich:treeNode type="project_summary" iconLeaf="#{item.iconPath}" icon="#{item.iconPath}">
             <h:outputText value="#{item.title}" />
             </rich:treeNode>
             <rich:treeNode type="project_timeline" iconLeaf="#{item.iconPath}" icon="#{item.iconPath}">
             <h:outputText value="#{item.title}" />
             </rich:treeNode>
            
             </rich:tree>
            
            </ui:composition>
            


            here is my bean:
            import javax.faces.event.*;
            import org.richfaces.event.*;
            import org.richfaces.model.TreeNode;
            import org.richfaces.component.*;
            import org.apache.commons.logging.*;
            
            import sun.util.logging.resources.logging;
            public class ProjectTreeListener implements org.richfaces.event.NodeSelectedListener{
            
             private boolean is_project_panel = true;
             private boolean is_maintenance_panel = false;
             private boolean is_program_panel = false;
            
            // public ProjectTreeListener() {
            // is_project_panel = true;
            // is_maintenance_panel = false;
            // is_program_panel = false;
            // }
            
             public void processSelection(NodeSelectedEvent event)
             throws AbortProcessingException {
             System.out.println("node selected");
             }
            
            }
            


            try to debug, but the method never been called.

            thanks for any help

            • 3. Re: dynamic tree and nodeselectlistener problem
              nbelaevski

              Looks ok. Does expansion works ok? Also can you please create a simple demo project showing the issue? You can send it to nbelaevski at exadel dot com

              • 4. Re: dynamic tree and nodeselectlistener problem
                walleye160

                yes, the expansion works okay. RootNode connects to database and loads MyProjectNode (for now), MyProjectNode will load project list as ProjectNode. The selection listener doesnot work even I use some fake data.

                I will try to come up a simple project demo.

                Thanks

                • 5. Re: dynamic tree and nodeselectlistener problem
                  erm0

                  I have the exact same issue, and I'm unable to make this thing work, however I try...

                  Here's my jsp :

                   <rich:tree switchType="ajax"
                   value="#{modeleBean.treeRoot}" var="item"
                   ajaxSubmitSelection="true"
                   nodeSelectListener="#{modeleBean.onSelectTreeNode}">
                   <rich:treeNode>
                   <h:outputText value="#{item.name}" styleClass="texteDefault"></h:outputText>
                   </rich:treeNode>
                   </rich:tree>
                  


                  And the method in my bean :

                   public void onSelectTreeNode(NodeSelectedEvent event) {
                   // some code here;
                   }
                  


                  Do we missed something??

                  Thanks

                  • 6. Re: dynamic tree and nodeselectlistener problem
                    erm0

                    Looks like my problem was caused by Ext JS. I didn't know that there was a possible conflict with Ext JS and that ajax fonctionnality in Rich Faces could stop working. So, problem solved...