You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by ta...@apache.org on 2011/11/04 14:39:40 UTC

svn commit: r1197559 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/components/ test/app1/ test/java/org/apache/tapestry5/corelib/components/ test/java/org/apache/tapestry5/integration/app1/ test/java/org/apach...

Author: tawus
Date: Fri Nov  4 13:39:39 2011
New Revision: 1197559

URL: http://svn.apache.org/viewvc?rev=1197559&view=rev
Log:
Fixes TAP5-1742: AfterRender returns null instead of true when the loop is done iterating

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LoopWithMixinDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LoopWithMixinDemo.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java?rev=1197559&r1=1197558&r2=1197559&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.java Fri Nov  4 13:39:39 2011
@@ -422,7 +422,7 @@ public class Loop<T>
      * Ends the current heartbeat.
      */
     @AfterRender
-    boolean after(MarkupWriter writer)
+    Boolean after(MarkupWriter writer)
     {
         if (element != null)
             writer.end();
@@ -434,7 +434,7 @@ public class Loop<T>
             formSupport.store(this, END_HEARTBEAT);
         }
 
-        return !iterator.hasNext();
+        return iterator.hasNext() ? false : null;
     }
 
     private void endHeartbeat()

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LoopWithMixinDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LoopWithMixinDemo.tml?rev=1197559&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LoopWithMixinDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LoopWithMixinDemo.tml Fri Nov  4 13:39:39 2011
@@ -0,0 +1,6 @@
+<html t:type='border' xmlns:t='http://tapestry.apache.org/schema/tapestry_5_3.xsd'>
+    <h1>Loop with Mixin Demo</h1>
+    <span t:type='loop' t:source='123456..123457' t:value='value' t:mixins='tracerMixin'>
+        ${value}
+    </span>
+</html>
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java?rev=1197559&r1=1197558&r2=1197559&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java Fri Nov  4 13:39:39 2011
@@ -65,7 +65,7 @@ public class LoopTest extends InternalBa
         assertEquals(loop.getValue(), "gamma");
         assertEquals(loop.getIndex(), 2);
 
-        assertTrue(loop.after(writer));
+        assertNull(loop.after(writer));
 
         verify();
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java?rev=1197559&r1=1197558&r2=1197559&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java Fri Nov  4 13:39:39 2011
@@ -98,4 +98,14 @@ public class LoopTests extends TapestryC
         assertFieldValue("title_1", "Cure Common Cold - post haste");
         assertFieldValue("title_2", "Conquer World");
     }
+
+    @Test
+    public void after_render_does_not_shortcut_other_after_render_phase_methods() throws Exception{
+        openLinks("Loop With Mixin Demo");
+
+        assertTextPresent("BEGIN-TRACER-MIXIN");
+        assertTextPresent("123456");
+        assertTextPresent("123457");
+        assertTextPresent("AFTER-TRACER-MIXIN");
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java?rev=1197559&r1=1197558&r2=1197559&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java Fri Nov  4 13:39:39 2011
@@ -175,6 +175,9 @@ public class Index
                     new Item("GenericLoopDemo", "Generic Loop Demo",
                             "Use of generic parameters with the Loop component."),
 
+                    new Item("LoopWithMixinDemo", "Loop With Mixin Demo",
+                        "Use a mixin with a Loop component."),
+
                     new Item("BlankPasswordDemo", "Blank Password Demo",
                             "Show that a blank value in a PasswordField does not update the server side value."),
 

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LoopWithMixinDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LoopWithMixinDemo.java?rev=1197559&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LoopWithMixinDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LoopWithMixinDemo.java Fri Nov  4 13:39:39 2011
@@ -0,0 +1,13 @@
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.Property;
+
+/**
+ * Testing loop with mixins
+ */
+public class LoopWithMixinDemo
+{
+    @Property
+    private int value;
+
+}