4 Replies Latest reply on Mar 3, 2009 5:59 PM by Nick Belaevski

    Richfaces render performances

    Oliver Yuen Newbie

      Hi,

      I am a newbie to Richfaces. I am developing an application which generate tabs dynamically from an array and populates each tab with a datatable which dynamically generates the columns.

      I did so by binding the tabpanel to a backing bean property and uses Java to run through loops and generate the components.

      However, I am seeing a 30 seconds delay before the tabpanel shows on IE 6.

      At first I though the timing issues came from the array processing and such. I did some timing measurements in my java code by recording the start and stop times in the method which generates the tabs..and tables. However, it turns out that the time were only 50 - 70 ms. It tells me that it actually took only 90 ms to fully execute the code to generate the tabpanel.

      So I am guessing the rest of the time spent is on the rendering phase? How can I improve the performances of such? any tips will be greatly appreciated...this is urgent.

      Here is a snippet of my code:

      JSF:

      <rich:tabPanel id="tabpanel_" binding="#{GUIBean.testTabPanel}" selectedTab="SWtab" immediate="true">
      </rich:tabPanel>

      Backing Beans:

      some tabpanel code that calls the generateTable method, the code below contains the code for generateTable:
      public HtmlScrollableDataTable generateTable(String tableName)
      {
      long start = new Date().getTime();
      ctx = FacesContext.getCurrentInstance();
      app = ctx.getApplication();
      HtmlScrollableDataTable table = new HtmlScrollableDataTable();
      String _tableName = "_" + tableName;
      table.setId(tableName);
      table.setVar(_tableName);
      table.setFrozenColCount(2);
      table.setHeight("500px");
      table.setWidth("1050px");
      table.setTimeout(0); // Enforces Ajax to timeout
      table.setStyle("background-color:#EEEEEE");
      table.setValueBinding("value", (ValueBinding)app.createValueBinding("#{IRMBean.tableVectors}"));
      // Employee Name column
      HtmlColumn columnEmpName = new HtmlColumn();
      columnEmpName.setId(tableName + "EmpNameCol");
      HtmlOutputText columnEmpNameHeader = new HtmlOutputText();
      columnEmpNameHeader.setId("columnEmpNameHeader");
      columnEmpNameHeader.setValue("Employee Name");
      columnEmpName.setHeader(columnEmpNameHeader);
      HtmlOutputText colEmpNameTxt = new HtmlOutputText();
      colEmpNameTxt.setValueBinding("value", (ValueBinding)app.createValueBinding("#{" + _tableName + ".employeeName}"));
      columnEmpName.getChildren().add(colEmpNameTxt);
      table.getChildren().add(columnEmpName);
      // Program Name column
      HtmlColumn columnProgName = new HtmlColumn();
      columnProgName.setId(tableName + "ProgNameCol");
      HtmlOutputText columnProgNameHeader = new HtmlOutputText();
      columnProgNameHeader.setId("columnProgNameHeader");
      columnProgNameHeader.setValue("Program");
      columnProgName.setHeader(columnProgNameHeader);
      HtmlInplaceSelect colProgNameSel = new HtmlInplaceSelect();
      colProgNameSel.setValueBinding("defaultLabel", (ValueBinding)app.createValueBinding("#{" + _tableName + ".programName}"));
      //colProgNameSel.setStyleClass("inplace");
      columnProgName.getChildren().add(colProgNameSel);
      table.getChildren().add(columnProgName);
      // Date columns
      for(int k = 0; k < duration; k++)
      {
      HtmlColumn column = new HtmlColumn();
      column.setId(tableName + "Col" + k);
      column.setWidth("60");
      HtmlOutputText columnHeader = new HtmlOutputText();
      columnHeader.setId("Col" + k);
      columnHeader.setValue(columnHeaders[k]);
      column.setHeader(columnHeader);
      HtmlInplaceInput columnSelect = new HtmlInplaceInput();
      columnSelect.setValueBinding("defaultLabel", (ValueBinding)app.createValueBinding("#{" + _tableName + ".allocationVector[" + k + "]}"));
      column.getChildren().add(columnSelect);
      table.getChildren().add(column);
      }
      long end = new Date().getTime();
      System.out.println("Time it takes to generate a single table is: " + (end-start));
      return table;
      }



      Oliver