tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r547028 - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/components/ java/org/apache/tapestry/services/impl/ js/tapestry/ test/org/apache/tapestry/components/
Date Wed, 13 Jun 2007 20:55:30 GMT
Author: jkuhnert
Date: Wed Jun 13 13:55:29 2007
New Revision: 547028

URL: http://svn.apache.org/viewvc?view=rev&rev=547028
Log:
Fixes TAPESTRY-1569.  If component wasn't rendering a clientId when tag rendering was enabled.


Added better check for DojoAjaxResponseBuilder exception detections while slowly debugging
and eventually figuring out firebug has a big nasty bug ...bastards

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java?view=diff&rev=547028&r1=547027&r2=547028
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java
Wed Jun 13 13:55:29 2007
@@ -18,13 +18,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.HiveMind;
-import org.apache.tapestry.IActionListener;
-import org.apache.tapestry.IBinding;
-import org.apache.tapestry.IForm;
-import org.apache.tapestry.IMarkupWriter;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
-import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.*;
 import org.apache.tapestry.engine.NullWriter;
 import org.apache.tapestry.form.AbstractFormComponent;
 import org.apache.tapestry.services.DataSqueezer;
@@ -63,10 +57,12 @@
         
         // If the cycle is rewinding, but not this particular form,
         // then do nothing (don't even render the body).
+        
         if (cycleRewinding && form != null && !form.isRewinding())
             return;
         
         // get the condition. work with a hidden field if necessary
+        
         _conditionValue = evaluateCondition(cycle, form, cycleRewinding);
         _rendering = true;
         
@@ -90,9 +86,11 @@
                 if (render)
                 {
                     writer.begin(element);
+
                     renderInformalParameters(writer, cycle);
+                    renderIdAttribute(writer, cycle);
                 }
-                _log.debug("Condition was true so rendering body" + this);
+
                 renderBody(writer, cycle);
 
                 if (render)
@@ -153,9 +151,7 @@
         }
         catch (Exception ex)
         {
-            throw new ApplicationRuntimeException(Tapestry.format(
-                    "If.unable-to-convert-value",
-                    booleanValue), this, null, ex);
+            throw new ApplicationRuntimeException(Tapestry.format("If.unable-to-convert-value",booleanValue),
this, null, ex);
         }
 
         form.addHiddenValue(name, externalValue);
@@ -171,9 +167,7 @@
         {
             Object valueObject = getDataSqueezer().unsqueeze(submittedValue);
             if (!(valueObject instanceof Boolean))
-                throw new ApplicationRuntimeException(Tapestry.format(
-                        "If.invalid-condition-type",
-                        submittedValue));
+                throw new ApplicationRuntimeException(Tapestry.format("If.invalid-condition-type",
submittedValue));
 
             return ((Boolean) valueObject).booleanValue();
         }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java?view=diff&rev=547028&r1=547027&r2=547028
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
Wed Jun 13 13:55:29 2007
@@ -177,6 +177,14 @@
     public void renderResponse(IRequestCycle cycle)
         throws IOException
     {
+        // if response was already started
+
+        if (_responseStarted)
+        {
+            cycle.renderPage(this);
+            return;
+        }
+        
         _localeManager.persistLocale();
         
         _contentType = new ContentType(CONTENT_TYPE + ";charset=" + cycle.getInfrastructure().getOutputEncoding());

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=diff&rev=547028&r1=547027&r2=547028
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js Wed Jun 13 13:55:29
2007
@@ -229,6 +229,7 @@
 			dojo.raise("No valid form event found with argument: " + evt);
 			return;
 		}
+
         var id=evt.target.getAttribute("id");
 		if (!id) {
 			dojo.raise("Form had no id attribute.");
@@ -392,8 +393,8 @@
 			return;
 		}
 		var formId=form.getAttribute("id");
-		
-		if (!tapestry.form.validation.validateForm(form, this.forms[formId])) {
+
+        if (!tapestry.form.validation.validateForm(form, this.forms[formId])) {
 			dojo.log.debug("Form validation failed for form with id " + formId);
 			return;
 		}

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java?view=diff&rev=547028&r1=547027&r2=547028
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java
Wed Jun 13 13:55:29 2007
@@ -14,18 +14,11 @@
 
 package org.apache.tapestry.components;
 
-import static org.easymock.EasyMock.expect;
-
-import org.apache.tapestry.BaseComponentTestCase;
-import org.apache.tapestry.IBinding;
-import org.apache.tapestry.IForm;
-import org.apache.tapestry.IMarkupWriter;
-import org.apache.tapestry.IRender;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.*;
 import org.apache.tapestry.services.DataSqueezer;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.util.io.DataSqueezerUtil;
+import static org.easymock.EasyMock.expect;
 import org.testng.annotations.Test;
 
 /**
@@ -60,9 +53,7 @@
         ElseBean reverse = (ElseBean) newInstance(ElseBean.class);
         
         expect(cycle.renderStackPush(conditional)).andReturn(conditional);
-        
         expect(cycle.isRewinding()).andReturn(false);
-        
         expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(null);
         
         trainResponseBuilder(cycle, writer);
@@ -72,11 +63,8 @@
         cycle.setAttribute(IfBean.IF_VALUE_ATTRIBUTE, Boolean.TRUE);
         
         expect(cycle.renderStackPop()).andReturn(conditional);
-        
         expect(cycle.renderStackPush(reverse)).andReturn(reverse);
-        
         expect(cycle.getAttribute(IfBean.IF_VALUE_ATTRIBUTE)).andReturn(Boolean.TRUE);
-        
         expect(cycle.renderStackPop()).andReturn(reverse);
         
         IRender body2 = newRender();
@@ -104,19 +92,14 @@
         ElseBean reverse = (ElseBean) newInstance(ElseBean.class);
         
         expect(cycle.renderStackPush(conditional)).andReturn(conditional);
-        
         expect(cycle.isRewinding()).andReturn(false);
-        
         expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(null);
         
         cycle.setAttribute(IfBean.IF_VALUE_ATTRIBUTE, Boolean.FALSE);
         
         expect(cycle.renderStackPop()).andReturn(conditional);
-        
         expect(cycle.renderStackPush(reverse)).andReturn(reverse);
-        
         expect(cycle.getAttribute(IfBean.IF_VALUE_ATTRIBUTE)).andReturn(Boolean.FALSE);
-        
         expect(cycle.isRewinding()).andReturn(false);
         
         trainResponseBuilder(cycle, writer);
@@ -352,23 +335,21 @@
         
         IRequestCycle cycle = newCycle();
 
-        IfBean conditional = newInstance(TestIfBean.class, 
-                new Object[] { 
-            "condition", Boolean.TRUE, 
-            "element", "div", 
-            "specification", spec,
-            "renderTag", Boolean.TRUE
-        });
+        IfBean conditional = newInstance(TestIfBean.class,
+                                         "condition", Boolean.TRUE,
+                                         "element", "div",
+                                         "specification", spec,
+                                         "renderTag", Boolean.TRUE,
+                                         "clientId", "testIf");
         
         expect(cycle.renderStackPush(conditional)).andReturn(conditional);
-        
         expect(cycle.isRewinding()).andReturn(false);
-        
         expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(null);
         
         IRender body = newRender(writer, cycle);
 
         writer.begin("div");
+        writer.attribute("id", "testIf");
         writer.attribute("informal", "informal-value");
 
         writer.end("div");



Mime
View raw message