You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/08/08 04:45:17 UTC

svn commit: r429547 - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/form/ test/org/apache/tapestry/form/ test/org/apache/tapestry/services/impl/ test/org/apache/tapestry/valid/

Author: jkuhnert
Date: Mon Aug  7 19:45:17 2006
New Revision: 429547

URL: http://svn.apache.org/viewvc?rev=429547&view=rev
Log:
Fixes TAPESTRY-1023. The ticket says it all. Pre-rendering of fields was causing the output of fields to be discarded if they 
were pre-rendered. 

The fix was changing one line in FormSupportImpl to use getResponseBuilder().render() instead of calling render directly. (thus 
breaking the new golden rule of not ever calling render on a component yourself.) Yes, if you were wondering...I ~am~ feeling a little smug
about my one line fix. 

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/valid/FieldLabelTest.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java?rev=429547&r1=429546&r2=429547&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/AbstractFormComponent.java Mon Aug  7 19:45:17 2006
@@ -128,7 +128,7 @@
                 form.setFormFieldUpdating(true);
             
             renderFormComponent(writer, cycle);
-
+            
             if (getCanTakeFocus() && !isDisabled())
             {
                 delegate.registerForFocus(

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=429547&r1=429546&r2=429547&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java Mon Aug  7 19:45:17 2006
@@ -741,7 +741,7 @@
         
         TapestryUtils.storePrerender(_cycle, field);
         
-        field.render(nested, _cycle);
+        _cycle.getResponseBuilder().render(nested, field, _cycle);
         
         TapestryUtils.removePrerender(_cycle);
         

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java?rev=429547&r1=429546&r2=429547&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java Mon Aug  7 19:45:17 2006
@@ -36,6 +36,7 @@
 import org.apache.tapestry.engine.ILink;
 import org.apache.tapestry.event.BrowserEvent;
 import org.apache.tapestry.listener.ListenerInvoker;
+import org.apache.tapestry.services.ResponseBuilder;
 import org.apache.tapestry.services.impl.ComponentEventInvoker;
 import org.apache.tapestry.valid.IValidationDelegate;
 import org.testng.annotations.Test;
@@ -110,7 +111,7 @@
         return component;
     }
 
-    public void testCancelRewind()
+    public void test_Cancel_Rewind()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -144,7 +145,7 @@
         verify();
     }
 
-    public void testComplexRender()
+    public void test_Complex_Render()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -216,7 +217,7 @@
         verify();
     }
 
-    public void testComplexRewind()
+    public void test_Complex_Rewind()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -261,7 +262,7 @@
         verify();
     }
 
-    public void testComplexSubmitEventHandler()
+    public void test_Complex_Submit_Event_Handler()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -334,7 +335,7 @@
         verify();
     }
 
-    public void testEncodingType()
+    public void test_Encoding_Type()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -402,13 +403,15 @@
         verify();
     }
 
-    public void testFieldPrerenderTwice()
+    public void test_Field_Prerender_Twice()
     {
         IFormComponent field = newField();
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
         IRequestCycle cycle = newCycle();
         Location l = newLocation();
+        
+        ResponseBuilder builder = newMock(ResponseBuilder.class);
 
         trainGetExtendedId(field, "foo.bar");
 
@@ -417,7 +420,9 @@
         expect(cycle.getAttribute(TapestryUtils.FIELD_PRERENDER)).andReturn(null);
         cycle.setAttribute(TapestryUtils.FIELD_PRERENDER, field);
         
-        field.render(nested, cycle);
+        expect(cycle.getResponseBuilder()).andReturn(builder);
+        
+        builder.render(nested, field, cycle);
         
         cycle.removeAttribute(TapestryUtils.FIELD_PRERENDER);
         
@@ -455,7 +460,7 @@
 
     }
 
-    public void testHiddenValues()
+    public void test_Hidden_Values()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -532,7 +537,7 @@
         verify();
     }
 
-    public void testInvalidEncodingType()
+    public void test_Invalid_Encoding_Type()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -591,7 +596,7 @@
         verify();
     }
 
-    public void testRefreshRewind()
+    public void test_Refresh_Rewind()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -631,7 +636,7 @@
         verify();
     }
 
-    public void testRenderExtraReservedIds()
+    public void test_Render_Extra_Reserved_Ids()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -704,7 +709,7 @@
         verify();
     }
 
-    public void testResetEventHandler()
+    public void test_Reset_Event_Handler()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -775,7 +780,7 @@
         verify();
     }
 
-    public void testRewindExtraReservedIds()
+    public void test_Rewind_Extra_Reserved_Ids()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -817,7 +822,7 @@
         verify();
     }
 
-    public void testRewindMismatch()
+    public void test_Rewind_Mismatch()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -872,7 +877,7 @@
         verify();
     }
 
-    public void testRewindTooLong()
+    public void test_Rewind_Too_Long()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -927,7 +932,7 @@
         verify();
     }
 
-    public void testRewindTooShort()
+    public void test_Rewind_Too_Short()
     {
         Location l = newLocation();
         IMarkupWriter writer = newWriter();
@@ -987,7 +992,7 @@
         verify();
     }
 
-    public void testSimpleRender()
+    public void test_Simple_Render()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -1060,7 +1065,7 @@
         verify();
     }
 
-    public void testSimpleRenderWithDeferredRunnable()
+    public void test_Simple_Render_With_Deferred_Runnable()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -1140,7 +1145,7 @@
         verify();
     }
 
-    public void testSimpleRenderWithScheme()
+    public void test_Simple_Render_With_Scheme()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();
@@ -1213,7 +1218,7 @@
         verify();
     }
 
-    public void testSimpleRewind()
+    public void test_Simple_Rewind()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -1254,7 +1259,7 @@
         verify();
     }
 
-    public void testSimpleRewindWithDeferredRunnable()
+    public void test_Simple_Rewind_With_Deferred_Runnable()
     {
         IMarkupWriter writer = newWriter();
         IRequestCycle cycle = newCycle();
@@ -1310,7 +1315,7 @@
         verify();
     }
 
-    public void testSimpleSubmitEventHandler()
+    public void test_Simple_Submit_Event_Handler()
     {
         IMarkupWriter writer = newWriter();
         NestedMarkupWriter nested = newNestedWriter();

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java?rev=429547&r1=429546&r2=429547&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java Mon Aug  7 19:45:17 2006
@@ -35,7 +35,7 @@
 import org.apache.tapestry.markup.MarkupWriterImpl;
 import org.apache.tapestry.markup.UTFMarkupFilter;
 import org.apache.tapestry.services.ResponseBuilder;
-import org.testng.annotations.Configuration;
+import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
 
 
@@ -61,7 +61,7 @@
         return new PrintWriter(_writer);
     }
 
-    @Configuration(afterTestClass = true)
+    @AfterClass
     protected void tearDown() throws Exception
     {
         _writer = null;

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/valid/FieldLabelTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/valid/FieldLabelTest.java?rev=429547&r1=429546&r2=429547&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/valid/FieldLabelTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/valid/FieldLabelTest.java Mon Aug  7 19:45:17 2006
@@ -231,7 +231,7 @@
 
         verify();
     }
-
+    
     public void testPrerenderOff()
     {
         IValidationDelegate delegate = new MockDelegate();
@@ -262,7 +262,7 @@
         verify();
     }
 
-    public void testFieldWithClientId()
+    public void test_Field_With_Client_Id()
     {
         IValidationDelegate delegate = new MockDelegate();