tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject [7/16] git commit: Rename some fields of DocumentLinkerImpl
Date Fri, 06 Jul 2012 00:38:00 GMT
Rename some fields of DocumentLinkerImpl


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2813b6ca
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2813b6ca
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2813b6ca

Branch: refs/heads/5.4-js-rewrite
Commit: 2813b6ca84dc21e650b5c7e211eb6fc320af90ab
Parents: 3c42af2
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Thu Jul 5 12:58:04 2012 -0700
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Thu Jul 5 12:58:04 2012 -0700

----------------------------------------------------------------------
 .../internal/services/DocumentLinkerImpl.java      |   19 ++++++++------
 1 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2813b6ca/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
index c87e153..e906680 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
@@ -28,7 +28,7 @@ import java.util.Map;
 
 public class DocumentLinkerImpl implements DocumentLinker
 {
-    private final List<String> scripts = CollectionFactory.newList();
+    private final List<String> scriptURLs = CollectionFactory.newList();
 
     private final Map<InitializationPriority, StringBuilder> priorityToScript = CollectionFactory.newMap();
 
@@ -44,7 +44,8 @@ public class DocumentLinkerImpl implements DocumentLinker
 
     private final String tapestryBanner;
 
-    private boolean hasDynamicScript;
+    // Initially false; set to true when a scriptURL or any kind of initialization is added.
+    private boolean hasScriptsOrInitializations;
 
     /**
      * @param moduleManager
@@ -72,7 +73,9 @@ public class DocumentLinkerImpl implements DocumentLinker
 
     public void addScriptLink(String scriptURL)
     {
-        scripts.add(scriptURL);
+        scriptURLs.add(scriptURL);
+
+        hasScriptsOrInitializations = true;
     }
 
     public void addScript(InitializationPriority priority, String script)
@@ -90,7 +93,7 @@ public class DocumentLinkerImpl implements DocumentLinker
 
         builder.append("\n");
 
-        hasDynamicScript = true;
+        hasScriptsOrInitializations = true;
     }
 
     @Override
@@ -112,7 +115,7 @@ public class DocumentLinkerImpl implements DocumentLinker
 
         InternalUtils.addToMapList(priorityToModuleInit, priority, init);
 
-        hasDynamicScript = true;
+        hasScriptsOrInitializations = true;
     }
 
     /**
@@ -161,7 +164,7 @@ public class DocumentLinkerImpl implements DocumentLinker
 
     private void addScriptElements(Element root)
     {
-        if (scripts.isEmpty() && !hasDynamicScript)
+        if (!hasScriptsOrInitializations)
         {
             return;
         }
@@ -224,9 +227,9 @@ public class DocumentLinkerImpl implements DocumentLinker
 
         // Next, include all stacks and individual JavaScript files *after* RequireJS.
 
-        for (String script : scripts)
+        for (String scriptURL : scriptURLs)
         {
-            body.element("script", "type", "text/javascript", "src", script);
+            body.element("script", "type", "text/javascript", "src", scriptURL);
         }
 
         if (priorityToScript.isEmpty() && priorityToModuleInit.isEmpty())


Mime
View raw message