1 2 Previous Next 26 Replies Latest reply on Apr 1, 2011 4:21 PM by naveenm Go to original post
      • 15. Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
        nbelaevski

        Naveen,

         

        I don't agree:

         

        1) public TreeNode<String> getTreeHierarchies() doesn't satisfy signature of action method

        2) main question: what do you expect from action? In your page code you've provided value for tree component, so it shows the tree structure, besides of what action method does.

        • 16. Re: Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
          naveenm

          Hi Nick,

           

          Sorry I could be using wrong code/logic, but here is what I'm trying to achieve:

           

          1. When I first visit my xhtml page I should only see the drop down, let's say the drop down has a list of departments of a company and if I select one department then I want to show a tree with all the employees in that department. And if a particular employee is a manager then I want to show all the employees under him as a subtreenodes under that manager.

           

          Can you please share a sample code where I can create and render rich:tree on selection of a drop down value. Tree shouldn't be displayed when I first visit the page, and need to reload/recreate the tree with new values when a department is changed in the drop down through ajax submissions.

           

          Thanks,

          Naveen

          • 17. Re: Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
            naveenm

            Hi Nick,

             

            I posted latest code here, please see the most recent post for the updated code: http://seamframework.org/Community/DynamicLoadOfRichTreeFailsWithSeam221FinalVersionAndRichfaces333FinalVersion#comment152252

             

            • 18. Re: Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
              nbelaevski

              Naveen,

               

              Check this out:

               

               

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              
              
              <html xmlns="http://www.w3.org/1999/xhtml"
                        xmlns:a4j="http://richfaces.org/a4j"
                        xmlns:rich="http://richfaces.org/rich"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:h="http://java.sun.com/jsf/html"
                        xmlns:ui="http://java.sun.com/jsf/facelets"
                        xmlns:s="http://jboss.com/products/seam/taglib"
                        xmlns:c="http://java.sun.com/jstl/core"
                        xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                        contentType="text/html">
              
              
              <f:view>
                        <body>
              
              
                                  <rich:panel>
                                            <h:form>
                                                      <h:selectOneMenu value="#{treeTestAction.selectedHierarchy}">
                                                                <f:selectItem itemLabel="none" />
                                                                <f:selectItem itemLabel="A" itemValue="a" />
                                                                <f:selectItem itemLabel="B" itemValue="b" />
              
                                                                <a4j:support action="#{treeTestAction.resetSelectedHierarchy}" reRender="treePanel" event="onchange"/>
                                                      </h:selectOneMenu>
              
              
                                                      <a4j:outputPanel layout="none" id="treePanel">
                                                                <rich:tree id="tree" switchType="client" ajaxSubmitSelection="true"
                                                                          rendered="#{not empty treeTestAction.treeHierarchies}"
                                                                          ajaxSingle="true" ajaxNodeSelectionEncodeBehavior="none"
                                                                          value="#{treeTestAction.treeHierarchies}"
                                                                          nodeSelectListener="#{treeTestAction.processSelection}" var="item">
                                                                          <rich:treeNode>
                                                                                    #{item}
                                                                          </rich:treeNode>
                                                                </rich:tree>
                                                      </a4j:outputPanel>
                                            </h:form>
                                  </rich:panel>
              
              
                        </body>
              </f:view>
              
              
              </html>
              
              

               

              package com.seam3test.action;
              
              
              import java.io.Serializable;
              
              
              import org.jboss.seam.ScopeType;
              import org.jboss.seam.annotations.Begin;
              import org.jboss.seam.annotations.Name;
              import org.jboss.seam.annotations.Scope;
              import org.richfaces.component.html.HtmlTree;
              import org.richfaces.event.NodeSelectedEvent;
              import org.richfaces.model.TreeNode;
              import org.richfaces.model.TreeNodeImpl;
              
              
              @Scope(ScopeType.CONVERSATION)
              @Name("treeTestAction")
              public class TreeTestAction implements Serializable{
                  private static final long serialVersionUID = 7013787589153013508L;
              
              
                  private TreeNode<String> rootNode;
              
              
                  private String selectedHierarchy;
              
                  public String getSelectedHierarchy() {
                      return selectedHierarchy;
                  }
                  public void setSelectedHierarchy(String selectedHierarchy) {
                      this.selectedHierarchy = selectedHierarchy;
                  }
              
                  public TreeTestAction() {
                  }
              
                  public TreeNode<String> getTreeHierarchies() {
                      return rootNode;
                  }
              
                  @Begin(join = true)
                  public void resetSelectedHierarchy() {
                      rootNode = null;
                      initRootNode();
                  }
              
              
                  private void initRootNodeWithString(String s) {
                      rootNode = new TreeNodeImpl<String>();
              
                      for (int i = 0; i < 3; i++) {
                          TreeNodeImpl<String> subNode = new TreeNodeImpl<String>();
                          subNode.setData("Node " + s + i);
                          rootNode.addChild(s + i, subNode);
                      }
                  }
              
                  private void initRootNode() {
                      String hierarchy = getSelectedHierarchy();
                      if (hierarchy != null && hierarchy.length() > 0) {
                          initRootNodeWithString(hierarchy);
                      }
                  }
              
              
                  public void processSelection(NodeSelectedEvent event) {
                      HtmlTree tree = (HtmlTree) event.getComponent();
                      String key = tree.getRowKey().toString();
                      String rowData = tree.getRowData().toString();
                      System.out.println("Key: " + key + ", RowData: " + rowData);
                  }
              }
              
              
              • 19. Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                naveenm

                Hello Nick,


                It's still not working for me, I'm using JDK5 and deploying on weblogic 10g and testing on both IE8 and FF3.5.1.

                 

                Thanks,

                Naveen

                • 20. Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                  nbelaevski

                  Does this work on Tomcat?

                  • 21. Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                    naveenm

                    Hi Nick,

                     

                    I haven't tried on Tomcat, I will let you know shortly.

                     

                    Thanks,

                    Naveen

                    • 22. Re: Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                      naveenm

                      Hi Nick,

                       

                      I'm facing some problems deploying on Tomcat 6.0.32, it complains about The ELResolvers for JSF were not registered with the JSP container and the page never comes up.

                       

                      I had to put this context-param com.sun.faces.expressionFactory with value org.jboss.el.ExpressionFactoryImpl in web.xml to deploy on Tomcat without that it's not deploying at all. Otherwise it complains for java.lang.LinkageError: loader constraints violated when linking javax/el/ExpressionFactory class

                       

                      On what server  are you deploying this code on?

                       

                      Thanks,

                      Naveen

                       

                       

                      • 23. Re: Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                        nbelaevski

                        Tomcat 6.

                        • 24. Re: Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                          naveenm

                          Hi Nick,

                           

                          Can you please share your classpath, faces-config, pages.xml, components.xml and web.xml files.

                           

                          Thanks,

                          Naveen

                          • 26. Dynamic load of rich tree fails with RichFaces 3.3.3.Final version and Seam 2.2.1.Final version
                            naveenm

                            Hi Nick,

                             

                            It worked fine now, I took the web.xml, components.xml and faces-config.xml from the demo project, modified it to my requirements and was able to get it working.

                             

                            Thanks so much for your time in helping me, I really appreciate your help!

                             

                            Thanks,

                            Naveen

                            1 2 Previous Next