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 2012/02/02 03:12:31 UTC

[2/9] git commit: fixes a bug where border's getbodycontainer is left as a child of border even if it was added to another container

fixes a bug where border's getbodycontainer is left as a child of border even if it was added to another container


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/835db0bf
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/835db0bf
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/835db0bf

Branch: refs/heads/sandbox/feedback
Commit: 835db0bf267a6c1b713f9801237c68cba043e9af
Parents: 36bb487
Author: Igor Vaynberg <iv...@apache.org>
Authored: Wed Feb 1 15:57:01 2012 -0800
Committer: Igor Vaynberg <iv...@apache.org>
Committed: Wed Feb 1 15:57:01 2012 -0800

----------------------------------------------------------------------
 .../apache/wicket/markup/html/border/Border.java   |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/835db0bf/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
index 844db13..af5f0f3 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java
@@ -222,7 +222,17 @@ public abstract class Border extends WebMarkupContainer implements IComponentRes
 	@Override
 	public Border remove(final Component component)
 	{
-		getBodyContainer().remove(component);
+		if (component == body)
+		{
+			// when the user calls foo.add(getBodyContainer()) this method will be called with it to
+			// clear body container's old parent, in which case we do not want to redirect to body
+			// container but to border's old remove.
+			super.remove(body);
+		}
+		else
+		{
+			getBodyContainer().remove(component);
+		}
 		return this;
 	}