You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/08/25 06:27:21 UTC

svn commit: r988788 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java

Author: ivaynberg
Date: Wed Aug 25 04:27:21 2010
New Revision: 988788

URL: http://svn.apache.org/viewvc?rev=988788&view=rev
Log:
Form.MULTIPART_HINT is not cleared correctly with nested forms
Issue: WICKET-2933

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java?rev=988788&r1=988787&r2=988788&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java Wed Aug 25 04:27:21 2010
@@ -1638,13 +1638,21 @@ public class Form<T> extends WebMarkupCo
 				if (component instanceof Form)
 				{
 					Form<?> form = (Form<?>)component;
-					isMultiPart = (form.multiPart != 0);
+
+					if (form.isVisibleInHierarchy() && form.isEnabledInHierarchy())
+					{
+						isMultiPart = (form.multiPart != 0);
+					}
 				}
 				else if (component instanceof FormComponent)
 				{
-					FormComponent<?> form = (FormComponent<?>)component;
-					isMultiPart = form.isMultiPart();
+					FormComponent<?> fc = (FormComponent<?>)component;
+					if (fc.isVisibleInHierarchy() && fc.isEnabledInHierarchy())
+					{
+						isMultiPart = fc.isMultiPart();
+					}
 				}
+
 				if (isMultiPart == true)
 				{
 					anyEmbeddedMultipart[0] = true;
@@ -1654,6 +1662,11 @@ public class Form<T> extends WebMarkupCo
 			}
 
 		});
+
+		if (anyEmbeddedMultipart[0])
+		{
+			multiPart |= MULTIPART_HINT;
+		}
 		return anyEmbeddedMultipart[0];
 	}
 
@@ -2015,29 +2028,13 @@ public class Form<T> extends WebMarkupCo
 	{
 	}
 
-	/**
-	 * @see org.apache.wicket.Component#onRender(MarkupStream)
-	 */
 	@Override
-	protected void onRender(final MarkupStream markupStream)
+	protected void onBeforeRender()
 	{
 		// clear multipart hint, it will be set if necessary by the visitor
 		this.multiPart &= ~MULTIPART_HINT;
 
-		// Force multi-part on if any child form component is multi-part
-		visitFormComponents(new FormComponent.AbstractVisitor()
-		{
-			@Override
-			public void onFormComponent(FormComponent<?> formComponent)
-			{
-				if (formComponent.isVisible() && formComponent.isMultiPart())
-				{
-					multiPart |= MULTIPART_HINT;
-				}
-			}
-		});
-
-		super.onRender(markupStream);
+		super.onBeforeRender();
 	}
 
 	/**