tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r481612 - in /tapestry/tapestry4/trunk: tapestry-contrib/ tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/ tapestry-examples/TimeTracker/ tapestry-examples/TimeTracker/src/context/WEB-INF/ tapestry-framework/src/java/org/apach...
Date Sat, 02 Dec 2006 19:43:10 GMT
Author: jkuhnert
Date: Sat Dec  2 11:43:06 2006
New Revision: 481612

URL: http://svn.apache.org/viewvc?view=rev&rev=481612
Log:
Resolves TAPESTRY-1159, TAPESTRY-811. 

Refactored PalleteFunctions.js to use tapestry.<namespace> type semantics like the rest
of the core tapestry 
javascript modules. (also provided backwards compatible deprecated functions for the existing/old
functions)

Took "var <foo>" out of generated javascript for tapestry namespaced javascript statements
as tapestry 
has already been defined by the time anyone has access to it. Now it's just "tapestry.<foo>
= ".

Refactored dynamic script package inclusion logic so that simple <include url="http://localhost/script.js"/>

elements are written to the client for package includes instead of trying to embed javascript
statements. 
(don't know why I was doing that to begin with, brain dead that day I guess)

Modified:
    tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.script
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/PaletteFunctions.js
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml
    tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/WEB-INF/timetracker.application
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/util/TestPageRenderSupport.java

Modified: tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/pom.xml?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/pom.xml Sat Dec  2 11:43:06 2006
@@ -74,6 +74,9 @@
                 <directory>src/java</directory>
                 <includes>
                     <include>**/*</include>
+                    <include>**/*.library</include>
+                    <include>**/*.page</include>
+                    <include>**/*.jwc</include>
                 </includes>
                 <excludes>
                     <exclude>**/*.java</exclude>

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java
Sat Dec  2 11:43:06 2006
@@ -416,7 +416,7 @@
         }
 
         PaletteColumn availableColumn = new PaletteColumn((String) _symbols.get("availableName"),
-                null, getRows());
+                (String)_symbols.get("availableName"), getRows());
         PaletteColumn selectedColumn = new PaletteColumn(getName(), getClientId(), getRows());
 
         // Each value specified in the model will go into either the selected or available

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.script?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
Binary files - no diff available.

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/PaletteFunctions.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/PaletteFunctions.js?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
Binary files - no diff available.

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml Sat Dec  2 11:43:06 2006
@@ -1,5 +1,4 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.tapestry</groupId>
@@ -25,6 +24,10 @@
             <artifactId>tapestry-annotations</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.tapestry</groupId>
+            <artifactId>tapestry-contrib</artifactId>
+        </dependency>
+        <dependency>
             <groupId>hivemind</groupId>
             <artifactId>hivemind</artifactId>
         </dependency>
@@ -88,7 +91,7 @@
     <build>
         <sourceDirectory>src/java</sourceDirectory>
         <testSourceDirectory>src/test</testSourceDirectory>
-        
+
         <plugins>
             <plugin>
                 <groupId>org.mortbay.jetty</groupId>

Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/WEB-INF/timetracker.application
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/WEB-INF/timetracker.application?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/WEB-INF/timetracker.application
(original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/WEB-INF/timetracker.application
Sat Dec  2 11:43:06 2006
@@ -23,11 +23,7 @@
    
    <meta key="org.apache.tapestry.page-class-packages" 
         value="org.apache.tapestry.timetracker.page"/>
-        <!-- 
-    <meta key="org.apache.tapestry.component-class-packages" 
-        value="org.apache.tapestry.integration.app1.components"/>
-        -->
-        
+  
   <library id="contrib" specification-path="classpath:/org/apache/tapestry/contrib/Contrib.library"/>
   
 </application>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.script?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.script
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.script
Sat Dec  2 11:43:06 2006
@@ -52,13 +52,15 @@
 </let>
 <body>
 tapestry.${onMouseOverName}=function(){
-  if (document.images)
+  if (document.images){
     ${attribute} = ${mouseOverImageURL};
+  }
 }
 
 tapestry.${onMouseOutName}=function(){
-  if (document.images)
+  if (document.images) {
     ${attribute} = ${mouseOutImageURL};
+  }
 }
 </body>
 <initialization>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
Sat Dec  2 11:43:06 2006
@@ -411,11 +411,8 @@
         IMarkupWriter writer = getWriter(ResponseBuilder.INCLUDE_SCRIPT, ResponseBuilder.SCRIPT_TYPE);
         
         // causes asset includes to be loaded dynamically into document head
-        writer.printRaw("tapestry.loadScriptFromUrl(\"");
-        writer.print(url);
-        writer.printRaw("\");");
-        
-        writer.println();
+        writer.beginEmpty("include");
+        writer.attribute("url", url);
     }
     
     /** 
@@ -425,9 +422,8 @@
     {
         IMarkupWriter writer = getWriter(ResponseBuilder.BODY_SCRIPT, ResponseBuilder.SCRIPT_TYPE);
         
-        writer.printRaw("\nvar " + preloadName + " = new Array();\n");
-        writer.printRaw("if (document.images)\n");
-        writer.printRaw("{\n");
+        writer.printRaw("\n" + preloadName + " = [];\n");
+        writer.printRaw("if (document.images) {\n");
         
         writer.printRaw(script);
         

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
Sat Dec  2 11:43:06 2006
@@ -89,7 +89,7 @@
         _idAllocator = new IdAllocator(namespace);
         _builder = builder;
         
-        _preloadName = (namespace.equals("") ? "tapestry." : namespace) + "_preload";
+        _preloadName = (namespace.equals("") ? "tapestry." : namespace) + "preload";
     }
     
     /**

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js Sat Dec  2 11:43:06
2006
@@ -133,10 +133,13 @@
 					continue;
 				} else if (id == "includescript") {
 					// includes get processed immediately (syncrhonously)
-					tapestry.loadScriptContent(elms[i], false);
+					var includes=elms[i].getElementsByTagName("include");
+					if (!includes){continue;}
+					for (var e=0; e<includes.length;e++) {
+						tapestry.loadScriptFromUrl(includes[e].getAttribute("url"));
+					}
 					continue;
 				}
-				
 			}
 			
 			if (!id){
@@ -278,14 +281,20 @@
 	 */
 	loadScriptFromUrl:function(url){
 	    var scripts = window.document.getElementsByTagName("script");
-	    for (var i = 0; i < scripts.length; i++) {
-	        var src = scripts[i].src;
-	        if (src && src.length > 0 && src.indexOf(url)>=0 ) {
-	            return;
-	        }
+	    if (scripts){
+		    for (var i = 0; i < scripts.length; i++) {
+		        var src = scripts[i].src;
+		        if (src && src.length > 0 && src.indexOf(url)>=0 ) {
+		            return;
+		        }
+		    }
+	    }
+	    
+	    if (djConfig.isDebug) {
+	    	dojo.log.debug("loadScriptFromUrl: " + url + " success?: " + dojo.hostenv.loadUri(url));
+	    } else {
+	    	dojo.hostenv.loadUri(url);
 	    }
-		
-	    dojo.hostenv.loadUri(url);
 	},
 	
 	/**

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
Sat Dec  2 11:43:06 2006
@@ -15,7 +15,6 @@
 package org.apache.tapestry.enhance;
 
 import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.endsWith;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.isNull;
@@ -847,7 +846,7 @@
         
         ClassFab fab = newMock(ClassFab.class);
 
-        expect(cf.newClass(endsWith("$ExistingAbstractMethodFixture_97"), eq(TestEnhancementOperation.ExistingAbstractMethodFixture.class)))
+        expect(cf.newClass(startsWith("$TestEnhancementOperation$ExistingAbstractMethodFixture"),
eq(TestEnhancementOperation.ExistingAbstractMethodFixture.class)))
         .andReturn(fab);
         
         replay();

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
Sat Dec  2 11:43:06 2006
@@ -13,7 +13,8 @@
 // limitations under the License.
 package org.apache.tapestry.services.impl;
 
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.checkOrder;
+import static org.easymock.EasyMock.expect;
 
 import java.io.CharArrayWriter;
 import java.io.PrintWriter;
@@ -56,9 +57,6 @@
 
     private static CharArrayWriter _writer;
     
-    private static String LINE_SEPERATOR = (String)java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("line.separator"));
-    
     private PrintWriter newPrintWriter()
     {
         _writer = new CharArrayWriter();
@@ -74,7 +72,7 @@
 
     private void assertOutput(String expected)
     {
-        assertEquals(expected, _writer.toString());
+        assertEquals(_writer.toString(), expected);
 
         _writer.reset();
     }
@@ -326,9 +324,8 @@
                 "<ajax-response><response id=\"bodyscript\" type=\"script\"><script>\n"
+ 
                 "//<![CDATA[\n" + 
                 "\n" + 
-                "var preloadedvarname = new Array();\n" + 
-                "if (document.images)\n" + 
-                "{\n" + 
+                "preloadedvarname = [];\n" + 
+                "if (document.images) {\n" + 
                 "image initializations}\n" + 
                 "var e=4;\n" + 
                 "//]]>\n" + 
@@ -365,11 +362,9 @@
         assertOutput("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html PUBLIC
\"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"
[\n" + 
                 "<!ENTITY nbsp \'&#160;\'>\n" + 
                 "]>\n" + 
-                "<ajax-response><response id=\"includescript\" type=\"script\">tapestry.loadScriptFromUrl(\"http://noname/js/package.js\");"
+ 
-                LINE_SEPERATOR +
-                "tapestry.loadScriptFromUrl(\"http://noname/js/package2.js\");" +
-                LINE_SEPERATOR +
-                "</response></ajax-response>");
+                "<ajax-response><response id=\"includescript\" type=\"script\">"

+                + "<include url=\"http://noname/js/package.js\"/>"
+                + "<include url=\"http://noname/js/package2.js\"/></response></ajax-response>");
         
         verify();
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/util/TestPageRenderSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/util/TestPageRenderSupport.java?view=diff&rev=481612&r1=481611&r2=481612
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/util/TestPageRenderSupport.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/util/TestPageRenderSupport.java
Sat Dec  2 11:43:06 2006
@@ -131,9 +131,9 @@
 
         PageRenderSupportImpl prs = new PageRenderSupportImpl(factory, "", l, newBuilder(writer));
 
-        assertEquals("tapestry._preload[0].src", prs.getPreloadedImageReference("/foo/bar.gif"));
-        assertEquals("tapestry._preload[1].src", prs.getPreloadedImageReference("/zip/zap.png"));
-        assertEquals("tapestry._preload[0].src", prs.getPreloadedImageReference("/foo/bar.gif"));
+        assertEquals(prs.getPreloadedImageReference("/foo/bar.gif"), "tapestry.preload[0].src");
+        assertEquals(prs.getPreloadedImageReference("/zip/zap.png"), "tapestry.preload[1].src");
+        assertEquals(prs.getPreloadedImageReference("/foo/bar.gif"), "tapestry.preload[0].src");
 
         prs.addBodyScript("myBodyScript();");
 
@@ -142,11 +142,11 @@
         assertOutput(new String[]
         { "<script type=\"text/javascript\"><!--","",
                 "dojo.addOnLoad(function(e) {",
-                "tapestry._preload = [];", "if (document.images)", "{",
-                "tapestry._preload[0] = new Image();",
-                "  tapestry._preload[0].src = \"/foo/bar.gif\";",
-                "  tapestry._preload[1] = new Image();",
-                "  tapestry._preload[1].src = \"/zip/zap.png\";}", "});myBodyScript();",
+                "tapestry.preload = [];", "if (document.images)", "{",
+                "tapestry.preload[0] = new Image();",
+                "  tapestry.preload[0].src = \"/foo/bar.gif\";",
+                "  tapestry.preload[1] = new Image();",
+                "  tapestry.preload[1].src = \"/zip/zap.png\";}", "});myBodyScript();",
                 "// --></script>" });
 
         verify();
@@ -161,18 +161,18 @@
 
         replay();
         
-        PageRenderSupportImpl prs = new PageRenderSupportImpl(factory, "NAMESPACE", l, newBuilder(writer));
+        PageRenderSupportImpl prs = new PageRenderSupportImpl(factory, "NAMESPACE.", l, newBuilder(writer));
         
-        assertEquals("NAMESPACE_preload[0].src", prs.getPreloadedImageReference("/foo/bar.gif"));
+        assertEquals(prs.getPreloadedImageReference("/foo/bar.gif"), "NAMESPACE.preload[0].src");
         
         prs.writeBodyScript(writer, cycle);
         
         assertOutput(new String[]
         {"<script type=\"text/javascript\"><!--", "",
                 "dojo.addOnLoad(function(e) {",
-                "NAMESPACE_preload = [];", "if (document.images)", "{",
-                "NAMESPACE_preload[0] = new Image();",
-                "  NAMESPACE_preload[0].src = \"/foo/bar.gif\";}",
+                "NAMESPACE.preload = [];", "if (document.images)", "{",
+                "NAMESPACE.preload[0] = new Image();",
+                "  NAMESPACE.preload[0].src = \"/foo/bar.gif\";}",
                 "});",
                 "// --></script>" });
 



Mime
View raw message