portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/template JetspeedTemplateService.java
Date Tue, 13 Mar 2001 11:53:40 GMT
ingo        01/03/13 03:53:40

  Modified:    src/java/org/apache/jetspeed/services/template
                        JetspeedTemplateService.java
  Log:
  [bug fix], make fallback work for both layout names, not only for the default layout
  
  Revision  Changes    Path
  1.3       +46 -7     jakarta-jetspeed/src/java/org/apache/jetspeed/services/template/JetspeedTemplateService.java
  
  Index: JetspeedTemplateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/template/JetspeedTemplateService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JetspeedTemplateService.java	2001/03/08 16:27:38	1.2
  +++ JetspeedTemplateService.java	2001/03/13 11:53:38	1.3
  @@ -414,7 +414,7 @@
               template = template + "." + getDefaultExtension(); 
           }
   
  -        Log.note("JetspeedTemplateService.parseScreen: template = " + template);
  +        Log.debug("JetspeedTemplateService.parseScreen: template = " + template);
           
           StringTokenizer st = new StringTokenizer(template, "/");
           List tokens = new ArrayList(st.countTokens());
  @@ -426,7 +426,7 @@
                   tokens.add(token);
               }
           }
  -        Log.note("JetspeedTemplateService.parseScreen: tokens1: " + tokens);
  +        Log.debug("JetspeedTemplateService.parseScreen: tokens1: " + tokens);
           String fileName = (String)tokens.get(tokens.size() - 1);
           tokens.remove(tokens.size()-1);
           int dot = fileName.lastIndexOf('.');
  @@ -442,7 +442,7 @@
           String firstChar = String.valueOf(className.charAt(0));
           firstChar = firstChar.toUpperCase();
           className = firstChar + className.substring(1);
  -        Log.note("JetspeedTemplateService.parseScreen: tokens2: " + tokens);
  +        Log.debug("JetspeedTemplateService.parseScreen: tokens2: " + tokens);
   
           // make sure the template exists and determine the correct
           // templateRoot path
  @@ -451,7 +451,7 @@
           String pathSep = System.getProperty("path.separator");
           for (int i=0; i<templateRoot.length; i++)
           {
  -        Log.note("JetspeedTemplateService.parseScreen: templateRoot " + i + " " + templateRoot[i]);
  +        Log.debug("JetspeedTemplateService.parseScreen: templateRoot " + i + " " + templateRoot[i]);
   
               String templatePath = null;
           
  @@ -464,19 +464,19 @@
                   }
                   StringBuffer distinctPath = new StringBuffer(path.toString()).append("/").append(fileName);
                   templatePath = distinctPath.toString();
  -                Log.note("JetspeedTemplateService.parseScreen: Path: " + templatePath);
  +                Log.debug("JetspeedTemplateService.parseScreen: Path: " + templatePath);
            
                   if (new File(templateRoot[i] + "/screens" + templatePath).exists())
                   {
                       template = templatePath;
  -                    Log.note("JetspeedTemplateService.parseScreen: template found: " +
template);
  +                    Log.debug("JetspeedTemplateService.parseScreen: template found: " +
template);
                       break;
                   }
                   templatePath = null;
               }
               if (templatePath != null) {
                   pathRoot = templateRoot[i];
  -                Log.note("JetspeedTemplateService.parseScreen: pathRoot: " + pathRoot);
  +                Log.debug("JetspeedTemplateService.parseScreen: pathRoot: " + pathRoot);
                   break;
               }
               allPaths += pathSep + templateRoot[i];
  @@ -491,6 +491,7 @@
                                   "determine associated templates.");
           }
   
  +        /*
           String[] paths = new String[tokens.size() + 2];
           String[] pkgs = new String[tokens.size() + 2];
           int arrayIndex = 0;
  @@ -515,6 +516,44 @@
               pkgs[arrayIndex] = pkg.append("Default").toString();
               arrayIndex++;
           }
  +        */        
  +
  +        String[] paths = new String[2 * tokens.size() +2];
  +        String[] pkgs  = new String[2 * tokens.size() +2];
  +        int arrayIndex = 0;
  +        for (int i=tokens.size(); i>=0;  i--)
  +        {
  +            StringBuffer path = new StringBuffer();
  +            StringBuffer pkg = new StringBuffer();
  +            for (int j=0; j<i; j++)
  +            {
  +                path.append("/").append((String)tokens.get(j));
  +                pkg.append((String)tokens.get(j)).append('.');
  +            }
  +            paths[arrayIndex] = path.append("/").append(fileName).toString();
  +            pkgs[arrayIndex]  = pkg.append("/").append(className).toString();
  +            arrayIndex++;
  +        }
  +        
  +        for (int i=tokens.size(); i>=0;  i--)
  +        {
  +            StringBuffer path = new StringBuffer();
  +            StringBuffer pkg = new StringBuffer();
  +            for (int j=0; j<i; j++)
  +            {
  +                path.append("/").append((String)tokens.get(j));
  +                pkg.append((String)tokens.get(j)).append('.');
  +            }
  +            paths[arrayIndex] = path.append(defaultLayoutTemplate).toString();
  +            pkgs[arrayIndex]  = pkg.append("Default").toString();
  +            arrayIndex++;
  +        }
  +
  +// FIX ME: is there no such method??
  +//        if (Log.isLogging()) {
  +            for (int i=0; i<paths.length; i++)
  +                Log.debug("JetspeedTemplateService.parseScreen: paths[" + i + "] = " +
paths[i]);
  +//        }
   
           String[] holder = new String[3];
           holder[0] = getScreenName(pkgs);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message