You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/07/19 23:31:45 UTC

svn commit: r1148548 [3/3] - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/mixins/ main/java/org/apache/tapestry5/internal/services/javascript/ main/resources/org/apache/tapestry5/ test/java/org/apache/tapestry5...

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tree.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tree.js?rev=1148548&r1=1148547&r2=1148548&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tree.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tree.js Tue Jul 19 21:31:44 2011
@@ -14,162 +14,157 @@
  */
 
 T5.extend(T5, {
-	tree : {
+    tree : {
 
-		/**
-		 * Approximate time per pixel for the hide and reveal animations. The
-		 * idea is to have small (few children) and large (many childen)
-		 * animations operate at the same visible rate, even though they will
-		 * take different amounts of time.
-		 */
-		ANIMATION_RATE : .005,
-
-		/**
-		 * Maximum animation time, in seconds. This is necessary for very large
-		 * animations, otherwise its looks visually odd to see the child tree
-		 * nodes whip down the screen.
-		 */
-		MAX_ANIMATION_DURATION : .5,
-
-		/** Type of Scriptaculous effect to hide/show child nodes. */
-		TOGGLE_TYPE : 'blind',
-
-		/**
-		 * Name of Scriptaculous effects queue to ensure that animations do not
-		 * overwrite each other.
-		 */
-		QUEUE_NAME : 't-tree-updates'
-	}
+        /**
+         * Approximate time per pixel for the hide and reveal animations. The
+         * idea is to have small (few children) and large (many childen)
+         * animations operate at the same visible rate, even though they will
+         * take different amounts of time.
+         */
+        ANIMATION_RATE : .005,
+
+        /**
+         * Maximum animation time, in seconds. This is necessary for very large
+         * animations, otherwise its looks visually odd to see the child tree
+         * nodes whip down the screen.
+         */
+        MAX_ANIMATION_DURATION : .5,
+
+        /** Type of Scriptaculous effect to hide/show child nodes. */
+        TOGGLE_TYPE : 'blind',
+
+        /**
+         * Name of Scriptaculous effects queue to ensure that animations do not
+         * overwrite each other.
+         */
+        QUEUE_NAME : 't-tree-updates'
+    }
 });
 
-T5.extendInitializer(function() {
+T5.extendInitializers(function() {
 
-	var cfg = T5.tree;
+    var cfg = T5.tree;
 
-	function doAnimate(element) {
-		var sublist = $(element).up('li').down("ul");
+    function doAnimate(element) {
+        var sublist = $(element).up('li').down("ul");
 
-		var dim = sublist.getDimensions();
+        var dim = sublist.getDimensions();
 
-		var duration = Math.min(dim.height * cfg.ANIMATION_RATE,
-				cfg.MAX_ANIMATION_DURATION)
+        var duration = Math.min(dim.height * cfg.ANIMATION_RATE,
+            cfg.MAX_ANIMATION_DURATION)
 
-		new Effect.toggle(sublist, cfg.TOGGLE_TYPE, {
-			duration : duration,
-			queue : {
-				position : 'end',
-				scope : cfg.QUEUE_NAME
-			}
-		});
-	}
+        new Effect.toggle(sublist, cfg.TOGGLE_TYPE, {
+            duration : duration,
+            queue : {
+                position : 'end',
+                scope : cfg.QUEUE_NAME
+            }
+        });
+    }
 
-	function animateRevealChildren(element) {
-		$(element).addClassName("t-tree-expanded");
+    function animateRevealChildren(element) {
+        $(element).addClassName("t-tree-expanded");
 
-		doAnimate(element);
-	}
+        doAnimate(element);
+    }
 
-	function animateHideChildren(element) {
-		$(element).removeClassName("t-tree-expanded");
+    function animateHideChildren(element) {
+        $(element).removeClassName("t-tree-expanded");
 
-		doAnimate(element);
-	}
+        doAnimate(element);
+    }
 
-	function initializer(spec) {
-		var loaded = spec.expanded;
-		var expanded = spec.expanded;
+    function initializer(spec) {
+        var loaded = spec.expanded;
+        var expanded = spec.expanded;
         var selected = false;
 
-		if (expanded) {
-			$(spec.clientId).addClassName("t-tree-expanded")
-		}
-		var loading = false;
+        if (expanded) {
+            $(spec.clientId).addClassName("t-tree-expanded")
+        }
+        var loading = false;
 
-		function successHandler(reply) {
-			// Remove the Ajax load indicator
-			$(spec.clientId).update("");
-			$(spec.clientId).removeClassName("t-empty-node");
+        function successHandler(reply) {
+            // Remove the Ajax load indicator
+            $(spec.clientId).update("");
+            $(spec.clientId).removeClassName("t-empty-node");
 
-			var response = reply.responseJSON;
+            var response = reply.responseJSON;
 
-			Tapestry.loadScriptsInReply(response, function() {
-				var element = $(spec.clientId).up("li");
-				var label = element.down("span.t-tree-label");
+            Tapestry.loadScriptsInReply(response, function() {
+                var element = $(spec.clientId).up("li");
+                var label = element.down("span.t-tree-label");
 
-				label.insert({
-					after : response.content
-				});
+                label.insert({
+                    after : response.content
+                });
 
-				// Hide the new sublist so that we can animate revealing it.
-				element.down("ul").hide();
+                // Hide the new sublist so that we can animate revealing it.
+                element.down("ul").hide();
 
-				animateRevealChildren(spec.clientId);
+                animateRevealChildren(spec.clientId);
 
-				loading = false;
-				loaded = true;
-				expanded = true;
-			});
+                loading = false;
+                loaded = true;
+                expanded = true;
+            });
 
-		}
+        }
 
         function toggleLeafHandler(reply) {
-           var response = reply.responseJSON;
+            var response = reply.responseJSON;
 
-                $(spec.clientId).update("");
+            $(spec.clientId).update("");
 
-                Tapestry.loadScriptsInReply(response, function() {
-                    loading = false;
-                    loaded = true;
-                    expanded = true;
-                    selected = !selected;
-                });
+            Tapestry.loadScriptsInReply(response, function() {
+                loading = false;
+                loaded = true;
+                expanded = true;
+                selected = !selected;
+            });
         }
 
-		function doLoad() {
-			if (loading)
-				return;
-
-			loading = true;
-
-            if(spec.expandChildrenURL)
-            {
-			    $(spec.clientId).addClassName("t-empty-node");
+        function doLoad() {
+            if (loading)
+                return;
+
+            loading = true;
+
+            if (spec.expandChildrenURL) {
+                $(spec.clientId).addClassName("t-empty-node");
             }
-            else
-            {
+            else {
                 $(spec.clientId).next("span.t-tree-label").addClassName("t-selected-leaf-node-label");
             }
-			$(spec.clientId).update("<span class='t-ajax-wait'/>");
+            $(spec.clientId).update("<span class='t-ajax-wait'/>");
 
-            var requestURL = spec.expandChildrenURL? spec.expandChildrenURL:spec.toggleLeafURL;
+            var requestURL = spec.expandChildrenURL ? spec.expandChildrenURL : spec.toggleLeafURL;
 
-            var handler =  spec.expandChildrenURL? successHandler: toggleLeafHandler;
+            var handler = spec.expandChildrenURL ? successHandler : toggleLeafHandler;
 
-			Tapestry.ajaxRequest(requestURL, handler);
+            Tapestry.ajaxRequest(requestURL, handler);
 
-		}
+        }
 
-		$(spec.clientId).observe("click", function(event) {
-			event.stop();
+        $(spec.clientId).observe("click", function(event) {
+            event.stop();
 
-			if (!loaded) {
+            if (!loaded) {
 
-				doLoad();
+                doLoad();
 
-				return;
-			}
+                return;
+            }
 
-            if(spec.toggleLeafURL)
-            {
+            if (spec.toggleLeafURL) {
                 var label = $(spec.clientId).next("span.t-tree-label");
 
-                if(selected)
-                {
+                if (selected) {
                     label.removeClassName("t-selected-leaf-node-label");
                 }
-                else
-                {
-                     label.addClassName("t-selected-leaf-node-label");
+                else {
+                    label.addClassName("t-selected-leaf-node-label");
                 }
                 selected = !selected;
 
@@ -178,22 +173,22 @@ T5.extendInitializer(function() {
                 return;
             }
 
-			// Children have been loaded, just a matter of toggling
-			// between showing or hiding the children.
+            // Children have been loaded, just a matter of toggling
+            // between showing or hiding the children.
 
-			var f = expanded ? animateHideChildren : animateRevealChildren;
+            var f = expanded ? animateHideChildren : animateRevealChildren;
 
-			f.call(null, spec.clientId);
+            f.call(null, spec.clientId);
 
-			var url = expanded ? spec.markCollapsedURL : spec.markExpandedURL;
+            var url = expanded ? spec.markCollapsedURL : spec.markExpandedURL;
 
-			Tapestry.ajaxRequest(url, {});
+            Tapestry.ajaxRequest(url, {});
 
-			expanded = !expanded;
-		});
-	}
+            expanded = !expanded;
+        });
+    }
 
-	return {
-		treeNode : initializer
-	};
+    return {
+        treeNode : initializer
+    };
 });

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentDemo.java?rev=1148548&r1=1148547&r2=1148548&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormFragmentDemo.java Tue Jul 19 21:31:44 2011
@@ -29,7 +29,7 @@ public class FormFragmentDemo
     private boolean subscribeToEmail, codeVisible, subVisible = true;
 
     @Component(parameters =
-    { "clientValidation=false" })
+            {"clientValidation=false"})
     private Form form;
 
     @InjectPage