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 2010/09/20 23:41:12 UTC

svn commit: r999127 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/resources/org/apache/tapestry5/tapestry.js test/app1/nested/ZoneDemo.tml test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java

Author: hlship
Date: Mon Sep 20 21:41:12 2010
New Revision: 999127

URL: http://svn.apache.org/viewvc?rev=999127&view=rev
Log:
TAP5-1177: In a partial page update request, if the server returns an empty string for the content, the client-side is left as is, rather than cleared

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=999127&r1=999126&r2=999127&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js Mon Sep 20 21:41:12 2010
@@ -1794,17 +1794,15 @@ Tapestry.ZoneManager = Class.create( {
 	processReply : function(reply) {
 		Tapestry.loadScriptsInReply(reply, function() {
 			/*
-			 * In a multi-zone update, the reply.content may be blank or
-			 * missing.
+			 * In a multi-zone update, the reply.content may be missing, 
+			 * in which case, leave the curent content in place. TAP5-1177
 			 */
-
-			reply.content && this.show(reply.content);
+			reply.content != undefined && this.show(reply.content);
 
 			/*
 			 * zones is an object of zone ids and zone content that will be
 			 * present in a multi-zone update response.
 			 */
-
 			Object.keys(reply.zones).each(function(zoneId) {
 				var manager = Tapestry.findZoneManagerForZone(zoneId);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml?rev=999127&r1=999126&r2=999127&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml Mon Sep 20 21:41:12 2010
@@ -1,74 +1,81 @@
 <html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" xml:space="default">
-    <h1>Zone/Ajax Demo</h1>
+  <h1>Zone/Ajax Demo</h1>
 
 
-    <h2>Last update: ${currentTime}</h2>
+  <h2>Last update: ${currentTime}</h2>
 
 
-    <t:zone t:id="output" style="float:right; width: 800px;" update="slidedown">
-        <span class="t-zone-update">
-            <t:if test="name" else="No name has been selected.">
-                Selected: ${name}
+  <t:zone t:id="output" style="float:right; width: 800px;" update="slidedown">
+    <span class="t-zone-update">
+      <t:if test="name" else="No name has been selected.">
+        Selected: ${name}
             </t:if>
-        </span>
-    </t:zone>
+    </span>
+  </t:zone>
 
-    <t:block id="registrationForm">
+  <t:block id="registrationForm">
 
 
-        <t:beaneditform t:id="registrationForm" object="registration" zone="output" add="roles">
+    <t:beaneditform t:id="registrationForm" object="registration" zone="output" add="roles">
 
-            <t:parameter name="roles">
-                <t:palette selected="registration.roles" encoder="encoder" model="literal:guest,user,admin"/>
-            </t:parameter>
+      <t:parameter name="roles">
+        <t:palette selected="registration.roles" encoder="encoder" model="literal:guest,user,admin"/>
+      </t:parameter>
 
-        </t:beaneditform>
+    </t:beaneditform>
 
-        <t:actionlink t:id="clear" zone="output">clear</t:actionlink>
+    <t:actionlink t:id="clear" zone="output">clear</t:actionlink>
 
-    </t:block>
+  </t:block>
 
-    <t:block id="registrationOutput">
-        <t:beandisplay object="registration" add="roles">
-            <t:parameter name="roles">
-                ${registration.roles}
+  <t:block id="registrationOutput">
+    <t:beandisplay object="registration" add="roles">
+      <t:parameter name="roles">
+        ${registration.roles}
             </t:parameter>
-        </t:beandisplay>
-    </t:block>
+    </t:beandisplay>
+  </t:block>
 
-    <t:block id="voteForm">
-        <t:form t:id="vote" zone="output">
-            Vote:
-            <input type="submit" name="abstain" value="Abstain"/>
-            <t:submit t:id="voteYes" value="Yes"/>
-            <t:submit t:id="voteNo" value="No"/>
-        </t:form>
-    </t:block>
+  <t:block id="voteForm">
+    <t:form t:id="vote" zone="output">
+      Vote:
+      <input type="submit" name="abstain" value="Abstain"/>
+      <t:submit t:id="voteYes" value="Yes"/>
+      <t:submit t:id="voteNo" value="No"/>
+    </t:form>
+  </t:block>
 
-    <t:block id="voteOutput">
-        You voted: ${vote}
+  <t:block id="voteOutput">
+    You voted: ${vote}
     </t:block>
 
 
-    <ul>
-        <li t:type="loop" source="names" value="name">
-            <t:actionlink t:id="select" context="name" zone="output">Select "${name}"</t:actionlink>
-        </li>
-        <li>
-            <t:actionlink t:id="JSON" zone="output">Direct JSON response</t:actionlink>
-        </li>
-        <li>
-            <t:actionlink t:id="fail" zone="output">Failure on the server side</t:actionlink>
-        </li>
-        <li>
-            <t:actionlink t:id="redirect" zone="output">Perform a redirect to another page</t:actionlink>
-        </li>
-        <li>
-            <t:actionlink t:id="secureRedirect" zone="output">Perform secure redirect to another page</t:actionlink>
-        </li>
-    </ul>
+  <ul>
+    <li t:type="loop" source="names" value="name">
+      <t:actionlink t:id="select" context="name" zone="output">Select "${name}"</t:actionlink>
+    </li>
+    <li>
+      <t:actionlink t:id="JSON" zone="output">Direct JSON response</t:actionlink>
+    </li>
+    <li>
+      <t:actionlink t:id="fail" zone="output">Failure on the server side</t:actionlink>
+    </li>
+    <li>
+      <t:actionlink t:id="redirect" zone="output">Perform a redirect to another page
+      </t:actionlink>
+    </li>
+    <li>
+      <t:actionlink t:id="secureRedirect" zone="output">Perform secure redirect to another page
+      </t:actionlink>
+    </li>
+    <li>
+      <t:actionlink t:id="blankUpdate" zone="output">Blank the zone</t:actionlink>
+    </li>
+  </ul>
+
+  <t:block id="empty"/>
 
-    <div id="zone-update-message"/>
+  <div id="zone-update-message"/>
 
 
 </html>
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java?rev=999127&r1=999126&r2=999127&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java Mon Sep 20 21:41:12 2010
@@ -43,7 +43,7 @@ public class ZoneDemo
     { "Fred & Wilma", "Mr. <Roboto>", "Grim Fandango", "Registration", "Vote" };
 
     @Inject
-    private Block registrationForm, registrationOutput, voteForm, voteOutput;
+    private Block registrationForm, registrationOutput, voteForm, voteOutput, empty;
 
     @Property
     private String vote;
@@ -156,6 +156,11 @@ public class ZoneDemo
     {
         return securePage;
     }
+    
+    Object onActionFromBlankUpdate()
+    {
+        return empty;
+    }
 
     void afterRender()
     {