0 Replies Latest reply on Sep 30, 2011 8:09 AM by Charlin Joe

    Richfaces:Tree Performance problem

    Charlin Joe Newbie

      I am facing performance problem for the following source code. Can anyone give suggestion to improve

       

      Here this tree will have many folders and and under each folder there are many Files. There is possiblity of nested folders too.

      When there are few entries under a folder then the expansion is working without any problem. When there are many entries under a folder (for say 5000) then the expansion of folder is taking more time. Also I observed that when this big folder is expanded, and now when trying to open a folder with less entries also taking more time to expand.

       

      Here is my complete code (If you are not able to see my code clearly look into the attched files)

       

      XHTML code

      ----------------------

      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich" >
         


      <rich:tree nodeSelectListener="#{PageBean.processSelection}"
         ajaxSubmitSelection="true"  id="custo_tree"
         switchType="ajax" value="#{PageBean._treeNode}" var="item" componentState="#{PageBean._treeState}"
         ajaxKeys="#{null}" nodeFace="#{item._type}" 
        
         style="width:100"
         >
        
         <rich:treeNode data="#{item._id}"
          type="#{item._type}"
          icon="#{item._icon}" reRender="work_area"
          iconLeaf="#{item._icon}"
          changeExpandListener="#{PageBean.processExpansion}"
           id="sclass" >
          <f:facet name="iconCollapsed">
                 <h:graphicImage value="/claflib/images/tree/plus1.gif"/>
             </f:facet>
          <f:facet name="iconExpanded">
                 <h:graphicImage value="/claflib/images/tree/minus.gif"/>
             </f:facet>
           <h:outputText value="#{item._value}" styleClass="#{item._styleClass}" />
         </rich:treeNode>      
        </rich:tree>
      </html>

       

      --------------------------

      PageBean class

      --------------------------

      public class PageBean {

      private TreeNode<MyTree> _treeNode = null;

      private DataComponentState _treeState = new TreeState();


      public void processSelection(NodeSelectedEvent event){
      ....
      }

      public void processExpansion(NodeExpandedEvent event){
      ....
      }


      }

       

      -----------------------

      MyTree Class

      -----------------------
      public class MyTree{

      private String _id;
      private String _type;
      private String _icon;
      private String _value;
      private String _styleClass;
      }