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 2009/08/15 18:58:54 UTC

svn commit: r804486 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java

Author: ivaynberg
Date: Sat Aug 15 16:58:54 2009
New Revision: 804486

URL: http://svn.apache.org/viewvc?rev=804486&view=rev
Log:
WICKET-2410 AjaxRequestTarget could skip component when its ancestor is added too
Issue: WICKET-2410

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java?rev=804486&r1=804485&r2=804486&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java Sat Aug 15 16:58:54 2009
@@ -664,8 +664,31 @@
 			final Component component = entry.getValue();
 			final String markupId = entry.getKey();
 
-			respondComponent(response, markupId, component);
+			if (!containsAncestorFor(component))
+			{
+				respondComponent(response, markupId, component);
+			}
+		}
+	}
+
+	/**
+	 * Checks if the target contains an ancestor for the given component
+	 * 
+	 * @param component
+	 * @return <code>true</code> if target contains an ancestor for the given component
+	 */
+	private boolean containsAncestorFor(Component component)
+	{
+		Component cursor = component.getParent();
+		while (cursor != null)
+		{
+			if (markupIdToComponent.containsValue(cursor))
+			{
+				return true;
+			}
+			cursor = cursor.getParent();
 		}
+		return false;
 	}
 
 	/**