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/03/27 02:24:15 UTC

svn commit: r928117 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components: Zone.java Zone.xdoc

Author: hlship
Date: Sat Mar 27 01:24:14 2010
New Revision: 928117

URL: http://svn.apache.org/viewvc?rev=928117&view=rev
Log:
TAP5-940: Change Zone component to run a Hearthbeat during a normal page render

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.xdoc

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java?rev=928117&r1=928116&r2=928117&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java Sat Mar 27 01:24:14 2010
@@ -22,6 +22,8 @@ import org.apache.tapestry5.dom.Element;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.ClientBehaviorSupport;
+import org.apache.tapestry5.services.Heartbeat;
+import org.apache.tapestry5.services.javascript.JavascriptSupport;
 
 /**
  * A Zone is portion of the output page designed for easy dynamic updating via Ajax or other client-side effects. A
@@ -57,6 +59,8 @@ import org.apache.tapestry5.services.Cli
  * allocated (rather than statically defined). In most cases, however, the programmer is responsible for assigning a
  * specific client-side id, via the id parameter.
  * <p/>
+ * A Zone starts and stops a {@link Heartbeat} when it renders (both normally, and when re-rendering).
+ * <p/>
  * After the client-side content is updated, a client-side event is fired on the zone's element. The constant
  * Tapestry.ZONE_UPDATED_EVENT can be used to listen to the event.
  */
@@ -93,7 +97,7 @@ public class Zone implements ClientEleme
     private String idParameter;
 
     @Environmental
-    private RenderSupport renderSupport;
+    private JavascriptSupport javascriptSupport;
 
     @Environmental
     private ClientBehaviorSupport clientBehaviorSupport;
@@ -108,6 +112,9 @@ public class Zone implements ClientEleme
     @Inject
     private ComponentResources resources;
 
+    @Inject
+    private Heartbeat heartbeat;
+
     private String clientId;
 
     String defaultElementName()
@@ -117,7 +124,7 @@ public class Zone implements ClientEleme
 
     void beginRender(MarkupWriter writer)
     {
-        clientId = resources.isBound("id") ? idParameter : renderSupport.allocateClientId(resources);
+        clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);
 
         Element e = writer.element(elementName, "id", clientId);
 
@@ -134,10 +141,14 @@ public class Zone implements ClientEleme
         spec.put("div", clientId);
 
         clientBehaviorSupport.addZone(clientId, show, update);
+
+        heartbeat.begin();
     }
 
     void afterRender(MarkupWriter writer)
     {
+        heartbeat.end();
+
         writer.end(); // div
     }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.xdoc?rev=928117&r1=928116&r2=928117&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.xdoc Sat Mar 27 01:24:14 2010
@@ -32,7 +32,8 @@
                 </p>
 
                 <p>
-                    Binding the zone parameter of the ActionLink is what triggers the partial-render and update logic.
+                    Binding the zone parameter of the ActionLink, EventLink or Form (the "trigger"
+                    component) is what triggers the partial-render and update logic.
                 </p>
 
             </subsection>