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 2013/07/20 01:09:35 UTC

[1/4] git commit: TAP5-1984: Do not invoke AjaxResponseRenderer callbacks when the response is an Ajax redirect

Updated Branches:
  refs/heads/master 1cbec694d -> 22a6f129e


TAP5-1984: Do not invoke AjaxResponseRenderer callbacks when the response is an Ajax redirect


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

Branch: refs/heads/master
Commit: cba4eea6d0b0e2491fe44e8426e7eff8d5cc3768
Parents: 1cbec69
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 15:28:43 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 15:28:43 2013 -0700

----------------------------------------------------------------------
 .../services/ajax/AjaxResponseRendererImpl.java | 50 ++++++++++++++++----
 1 file changed, 42 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cba4eea6/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/AjaxResponseRendererImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/AjaxResponseRendererImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/AjaxResponseRendererImpl.java
index 98a0cc5..6d3b329 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/AjaxResponseRendererImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ajax/AjaxResponseRendererImpl.java
@@ -1,7 +1,21 @@
+//  Copyright 2011, 2013 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+
 package org.apache.tapestry5.internal.services.ajax;
 
 import org.apache.tapestry5.ClientBodyElement;
 import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.internal.InternalConstants;
 import org.apache.tapestry5.internal.services.PageRenderQueue;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.services.TypeCoercer;
@@ -62,9 +76,9 @@ public class AjaxResponseRendererImpl implements AjaxResponseRenderer
         {
             public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
             {
-                callback.run(javaScriptSupport);
-
                 renderer.renderMarkup(writer, reply);
+
+                callback.run(javaScriptSupport);
             }
         });
 
@@ -79,9 +93,9 @@ public class AjaxResponseRendererImpl implements AjaxResponseRenderer
         {
             public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
             {
-                callback.run();
-
                 renderer.renderMarkup(writer, reply);
+
+                callback.run();
             }
         });
 
@@ -89,11 +103,31 @@ public class AjaxResponseRendererImpl implements AjaxResponseRenderer
         return this;
     }
 
-    public AjaxResponseRenderer addFilter(PartialMarkupRendererFilter filter)
+    private boolean isRedirect(JSONObject reply)
+    {
+
+        return reply.has(InternalConstants.PARTIAL_KEY) &&
+                reply.in(InternalConstants.PARTIAL_KEY).has("redirectURL");
+    }
+
+    public AjaxResponseRenderer addFilter(final PartialMarkupRendererFilter filter)
     {
         assert filter != null;
 
-        queue.addPartialMarkupRendererFilter(filter);
+        queue.addPartialMarkupRendererFilter(new PartialMarkupRendererFilter()
+        {
+            public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer delete)
+            {
+                if (isRedirect(reply))
+                {
+                    // Bypass the callback.
+                    delete.renderMarkup(writer, reply);
+                    return;
+                }
+
+                filter.renderMarkup(writer, reply, delete);
+            }
+        });
 
         return this;
     }
@@ -106,9 +140,9 @@ public class AjaxResponseRendererImpl implements AjaxResponseRenderer
         {
             public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
             {
-                callback.run(reply);
-
                 renderer.renderMarkup(writer, reply);
+
+                callback.run(reply);
             }
         });
 


[2/4] git commit: Restore t5/core/fields:showValidationError which was incorrectly removed

Posted by hl...@apache.org.
Restore t5/core/fields:showValidationError which was incorrectly removed


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

Branch: refs/heads/master
Commit: 0acc96d400dd97c303176aa0d32817b2ee61ba42
Parents: cba4eea
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 15:58:38 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 15:58:38 2013 -0700

----------------------------------------------------------------------
 .../main/coffeescript/META-INF/modules/t5/core/fields.coffee    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0acc96d4/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
index 2846f91..da60ffa 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
@@ -89,6 +89,9 @@ define ["underscore", "./events", "./dom", "./utils", "./forms"],
 
       return block
 
+    showValidationError = (id, message) ->
+      dom.wrap(id).trigger events.field.showValidationError, { message }
+
     collectOptionValues = (wrapper) ->
       _.pluck wrapper.element.options, "value"
 
@@ -169,4 +172,4 @@ define ["underscore", "./events", "./dom", "./utils", "./forms"],
 
       group and group.addClass "error"
 
-    exports = {findHelpBlock, createHelpBlock}
\ No newline at end of file
+    exports = {findHelpBlock, createHelpBlock, showValidationError}
\ No newline at end of file


[4/4] git commit: Adjust the code that locates alert content

Posted by hl...@apache.org.
Adjust the code that locates alert content


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

Branch: refs/heads/master
Commit: 22a6f129e46c69198f3d9b10c9db1b64bcfe850c
Parents: 8ae691c
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 16:01:17 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 16:01:17 2013 -0700

----------------------------------------------------------------------
 .../org/apache/tapestry5/integration/TapestryCoreTestCase.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/22a6f129/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
index eb97fbd..fb54010 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
@@ -58,7 +58,7 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase
         waitForCSSSelectedElementToAppear("[data-container-type=alerts] .alert");
 
         // Add the special "x" for the close button to the text.
-        assertText("css=[data-container-type=alerts] .alert", "\u00d7" + text);
+        assertText("css=[data-container-type=alerts] .alert span", text);
     }
 
 }


[3/4] git commit: Throw an Error when an initialize function can not be found

Posted by hl...@apache.org.
Throw an Error when an initialize function can not be found


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

Branch: refs/heads/master
Commit: 8ae691c543e6a241a8b55ede45e6f0eb7c4b627f
Parents: 0acc96d
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 16:00:39 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 16:00:39 2013 -0700

----------------------------------------------------------------------
 .../main/coffeescript/META-INF/modules/t5/core/pageinit.coffee    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8ae691c5/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
index f01fa23..bf42856 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
@@ -96,6 +96,9 @@ define ["underscore", "./console", "./dom", "./events"],
 
         fn = if functionName? then moduleLib[functionName] else moduleLib
 
+        unless fn?
+          throw new Error "Could not locate function `#{qualifiedName}'."
+
         if console.debugEnabled
           argsString = _.map(initArguments, JSON.stringify).join(", ")
           console.debug "Invoking #{qualifiedName}(#{argsString})"


[2/4] git commit: Restore t5/core/fields:showValidationError which was incorrectly removed

Posted by hl...@apache.org.
Restore t5/core/fields:showValidationError which was incorrectly removed


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

Branch: refs/heads/master
Commit: 0acc96d400dd97c303176aa0d32817b2ee61ba42
Parents: cba4eea
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 15:58:38 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 15:58:38 2013 -0700

----------------------------------------------------------------------
 .../main/coffeescript/META-INF/modules/t5/core/fields.coffee    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0acc96d4/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
index 2846f91..da60ffa 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/fields.coffee
@@ -89,6 +89,9 @@ define ["underscore", "./events", "./dom", "./utils", "./forms"],
 
       return block
 
+    showValidationError = (id, message) ->
+      dom.wrap(id).trigger events.field.showValidationError, { message }
+
     collectOptionValues = (wrapper) ->
       _.pluck wrapper.element.options, "value"
 
@@ -169,4 +172,4 @@ define ["underscore", "./events", "./dom", "./utils", "./forms"],
 
       group and group.addClass "error"
 
-    exports = {findHelpBlock, createHelpBlock}
\ No newline at end of file
+    exports = {findHelpBlock, createHelpBlock, showValidationError}
\ No newline at end of file


[4/4] git commit: Adjust the code that locates alert content

Posted by hl...@apache.org.
Adjust the code that locates alert content


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

Branch: refs/heads/master
Commit: 22a6f129e46c69198f3d9b10c9db1b64bcfe850c
Parents: 8ae691c
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 16:01:17 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 16:01:17 2013 -0700

----------------------------------------------------------------------
 .../org/apache/tapestry5/integration/TapestryCoreTestCase.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/22a6f129/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
index eb97fbd..fb54010 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
@@ -58,7 +58,7 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase
         waitForCSSSelectedElementToAppear("[data-container-type=alerts] .alert");
 
         // Add the special "x" for the close button to the text.
-        assertText("css=[data-container-type=alerts] .alert", "\u00d7" + text);
+        assertText("css=[data-container-type=alerts] .alert span", text);
     }
 
 }


[3/4] git commit: Throw an Error when an initialize function can not be found

Posted by hl...@apache.org.
Throw an Error when an initialize function can not be found


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

Branch: refs/heads/master
Commit: 8ae691c543e6a241a8b55ede45e6f0eb7c4b627f
Parents: 0acc96d
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jul 19 16:00:39 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jul 19 16:00:39 2013 -0700

----------------------------------------------------------------------
 .../main/coffeescript/META-INF/modules/t5/core/pageinit.coffee    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8ae691c5/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
index f01fa23..bf42856 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
@@ -96,6 +96,9 @@ define ["underscore", "./console", "./dom", "./events"],
 
         fn = if functionName? then moduleLib[functionName] else moduleLib
 
+        unless fn?
+          throw new Error "Could not locate function `#{qualifiedName}'."
+
         if console.debugEnabled
           argsString = _.map(initArguments, JSON.stringify).join(", ")
           console.debug "Invoking #{qualifiedName}(#{argsString})"