tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andy...@apache.org
Subject svn commit: r595628 - /tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
Date Fri, 16 Nov 2007 11:18:05 GMT
Author: andyhot
Date: Fri Nov 16 03:18:04 2007
New Revision: 595628

URL: http://svn.apache.org/viewvc?rev=595628&view=rev
Log:
null checks (needed due to this being hardcoded inside Exception.html, but useful for dojo
upgrade ) + checkstyle

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java?rev=595628&r1=595627&r2=595628&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
Fri Nov 16 03:18:04 2007
@@ -13,12 +13,17 @@
 // limitations under the License.
 package org.apache.tapestry.dojo;
 
+import java.util.Locale;
+
 import org.apache.hivemind.util.Defense;
-import org.apache.tapestry.*;
+import org.apache.tapestry.IAsset;
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IPage;
+import org.apache.tapestry.IRender;
+import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.json.JSONLiteral;
 import org.apache.tapestry.json.JSONObject;
 
-import java.util.Locale;
 
 /**
  * The default rendering delegate responsible for include the dojo sources in
@@ -38,7 +43,13 @@
     public static final String BROWSER_LOG_CRITICAL="CRITICAL";
 
     private static final String SYSTEM_NEWLINE= (String)java.security.AccessController.doPrivileged(
-      new sun.security.action.GetPropertyAction("line.separator"));
+      new sun.security.action.GetPropertyAction("line.separator"));    
+
+    /** Default list of pre-bundled dojo supported locales. */
+    protected String[] SUPPORTED_LOCALES = { "en-us", "de-de", "de", "en-gb",
+                                             "es-es", "es", "fr-fr", "fr", "zh-cn",
+                                             "zh-tw", "zh" , "it-it", "it", "ja-jp",
+                                             "ja", "ko-kr", "ko", "pt-br", "pt", "en", "xx"};
 
     private IAsset _dojoSource;
 
@@ -68,12 +79,6 @@
     
     private String _searchIds;
 
-    /** Default list of pre-bundled dojo supported locales */
-    protected String[] SUPPORTED_LOCALES = { "en-us", "de-de", "de", "en-gb",
-                                             "es-es", "es", "fr-fr", "fr", "zh-cn",
-                                             "zh-tw", "zh" , "it-it", "it", "ja-jp",
-                                             "ja", "ko-kr", "ko", "pt-br", "pt", "en", "xx"};
-
     /**
      * {@inheritDoc}
      */
@@ -101,7 +106,10 @@
 
         // The key to resolving everything out of the asset service
 
-        dojoConfig.put("baseRelativePath", _dojoPath.buildURL());
+        if (_dojoPath!=null)
+        {
+            dojoConfig.put("baseRelativePath", _dojoPath.buildURL());
+        }
 
         if (page.hasFormComponents())
         {
@@ -136,16 +144,19 @@
 
         // include the core dojo.js package
 
-        str.append("<script type=\"text/javascript\" src=\"")
-          .append(_dojoSource.buildURL()).append("\"></script>");
+        if (_dojoSource!=null)
+        {
+            str.append("<script type=\"text/javascript\" src=\"")
+              .append(_dojoSource.buildURL()).append("\"></script>");
+        }
 
-        if (page.hasFormComponents())
+        if (page.hasFormComponents() && _dojoFormSource!=null)
         {
             str.append("<script type=\"text/javascript\" src=\"")
               .append(_dojoFormSource.buildURL()).append("\"></script>");
         }
 
-        if (page.hasWidgets())
+        if (page.hasWidgets() && _dojoWidgetSource!=null)
         {
             str.append("<script type=\"text/javascript\" src=\"")
               .append(_dojoWidgetSource.buildURL()).append("\"></script>");
@@ -167,21 +178,27 @@
 
         // module path registration to tapestry javascript sources
 
-        String tapestryUrl = _tapestryPath.buildURL();
-        if (tapestryUrl.endsWith("/"))
+        if (_tapestryPath!=null)
         {
-            tapestryUrl = tapestryUrl.substring(0, tapestryUrl.length() - 1);
+            String tapestryUrl = _tapestryPath.buildURL();
+            if (tapestryUrl.endsWith("/"))
+            {
+                tapestryUrl = tapestryUrl.substring(0, tapestryUrl.length() - 1);
+            }
+
+            str.append(SYSTEM_NEWLINE).append("<script type=\"text/javascript\">").append(SYSTEM_NEWLINE)
+              .append("dojo.registerModulePath(\"tapestry\", \"")
+              .append(tapestryUrl).append("\");").append(SYSTEM_NEWLINE);
+            str.append("</script>").append(SYSTEM_NEWLINE);
         }
 
-        str.append(SYSTEM_NEWLINE).append("<script type=\"text/javascript\">").append(SYSTEM_NEWLINE)
-          .append("dojo.registerModulePath(\"tapestry\", \"")
-          .append(tapestryUrl).append("\");").append(SYSTEM_NEWLINE);
-        str.append("</script>").append(SYSTEM_NEWLINE);
-
         // include core tapestry.js package
 
-        str.append("<script type=\"text/javascript\" src=\"")
-          .append(_tapestrySource.buildURL()).append("\"></script>");
+        if (_tapestrySource!=null)
+        {
+            str.append("<script type=\"text/javascript\" src=\"")
+              .append(_tapestrySource.buildURL()).append("\"></script>");
+        }
 
         // namespace registration
 



Mime
View raw message