xlawrence    2005/06/15 14:50:13 CEST

  Modified files:
    core/src/webapp/jsp/jahia/htmleditors/xinha utils.jsp 
  Log:
  optimizations
  
  Revision  Changes    Path
  1.7       +20 -15    
jahia/core/src/webapp/jsp/jahia/htmleditors/xinha/utils.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/htmleditors/xinha/utils.jsp.diff?r1=1.6&r2=1.7&f=h
  
  
  
  Index: utils.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/htmleditors/xinha/utils.jsp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- utils.jsp 14 Jun 2005 11:26:58 -0000      1.6
  +++ utils.jsp 15 Jun 2005 12:50:13 -0000      1.7
  @@ -35,6 +35,7 @@
   public String[] pathSearch = {"users", "shared", "private", "public"};
   public String[] pathReplace = {"utilisateurs", "partage", "privé", 
"publique"};
   public ArrayList excludeList = new ArrayList();
  +public StringBuffer buff = new StringBuffer();
   
   public String getPicto (String contentType) {
       String f = contentType.toLowerCase();
  @@ -47,7 +48,6 @@
   }
   
   public String expandOne(DAVFileAccess fileObject, int level, String lang) {
  -    StringBuffer html = new StringBuffer();
       if (fileObject != null) {
           TreeSet sortedResources = new TreeSet(new Comparator() {
               public int compare(Object o1, Object o2) {
  @@ -84,15 +84,17 @@
                   
                   pathDisplay = pathDisplay.replaceAll("'", "\\\'");
                   
  -                
html.append("[").append(level).append(",").append(counterOperations)
  +                
buff.append("[").append(level).append(",").append(counterOperations)
                   
.append(",\'").append(pathDisplay).append("\','").append(expand)
                   .append("'],");
                   counterOperations++;
  -                html.append(expandOne(curDf, level + 1, lang));
  +                buff.append(expandOne(curDf, level + 1, lang));
               }
           }
       }
  -    return html.toString();
  +    String res = buff.toString();
  +    buff.delete(0, buff.length());
  +    return res;
   }
   
   public void addOperation(DAVFileAccess parentObj, DAVFileAccess curObj, 
boolean selected) {
  @@ -158,36 +160,37 @@
           String getcontentlength = curObj.getProperty("DAV:", 
"getcontentlength").toString();
           int size = Integer.parseInt(getcontentlength);
           if (size < 1024) {
  -            fileSize = new StringBuffer().append(size).append(" 
octets").toString();
  +            fileSize = buff.append(size).append(" octets").toString();
  +            buff.delete(0, buff.length());
               
           } else {
               final double fileSizeKo = size / 1024;
               DecimalFormat df = new DecimalFormat();
               df.setMaximumFractionDigits(2);
               df.setMinimumIntegerDigits(1);
  -            fileSize = new 
StringBuffer().append(df.format(fileSizeKo)).append(" ko").
  -                    toString();
  +            fileSize = buff.append(df.format(fileSizeKo)).append(" 
ko").toString();
  +            buff.delete(0, buff.length());
           }
       }
       return fileSize;
   }
   
   public String getFilesToJs(ParamBean jParams, String lang ) {
  -    StringBuffer html = new StringBuffer();
  -    html.append("[[0,0,\'root\','/'],");
  +    buff.append("[[0,0,\'root\','/'],");
       excludeList.add("actions");
       excludeList.add("mygroups");
       excludeList.add("groups");
       DAVFileAccess df = 
JahiaWebdavBaseService.getInstance().getDAVFileAccess(jParams, "/");
  -    html.append(expandOne(df, 1, lang));
  -    html = html.deleteCharAt(html.length() - 1);
  -    html.append("]");
  -    return html.toString();
  +    buff.append(expandOne(df, 1, lang));
  +    buff = buff.deleteCharAt(buff.length() - 1);
  +    buff.append("]");
  +    String res = buff.toString();
  +    buff.delete(0, buff.length());
  +    return res;
   }
   
   public String getSitemapToJs(JahiaData jData, String jahiaPath, JahiaField 
theField,
           HashMap engineMap, String currentLanguageCode) throws JahiaException 
{
  -    StringBuffer buff = new StringBuffer();
       try {
           ParamBean jParams = jData.params();
           buff.append("[[0,0,\'root\','/'],");
  @@ -268,6 +271,8 @@
       } catch (Exception e) {
           e.printStackTrace();
       }
  -    return buff.toString();
  +    String res = buff.toString();
  +    buff.delete(0, buff.length());
  +    return res;
   }
   %>
  \ No newline at end of file
  

Reply via email to