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/11/14 07:20:28 UTC

svn commit: r1034939 - in /wicket/branches/wicket-1.4.x/wicket/src: main/java/org/apache/wicket/Component.java test/java/org/apache/wicket/ajax/AjaxHeaderContributionPage2_ajax_expected.html

Author: ivaynberg
Date: Sun Nov 14 06:20:28 2010
New Revision: 1034939

URL: http://svn.apache.org/viewvc?rev=1034939&view=rev
Log:
hieararchy checks should test parent first
Issue: WICKET-3166

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/AjaxHeaderContributionPage2_ajax_expected.html

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java?rev=1034939&r1=1034938&r2=1034939&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java Sun Nov 14 06:20:28 2010
@@ -2210,19 +2210,13 @@ public abstract class Component implemen
 	 */
 	public final boolean isVisibleInHierarchy()
 	{
-		Component component = this;
-		while (component != null)
+		Component parent = getParent();
+		if (parent != null && !parent.isVisibleInHierarchy())
 		{
-			if (component.determineVisibility())
-			{
-				component = component.getParent();
-			}
-			else
-			{
-				return false;
-			}
+			return false;
 		}
-		return true;
+
+		return determineVisibility();
 	}
 
 	/**
@@ -3546,9 +3540,9 @@ public abstract class Component implemen
 	{
 		if (!tag.getName().equalsIgnoreCase(name))
 		{
-			String msg = String.format("Component [%s] (path = [%s]) must be " +
-					                     "applied to a tag of type [%s], not: %s",
-			                           getId(), getPath(), name, tag.toUserDebugString());
+			String msg = String.format("Component [%s] (path = [%s]) must be "
+				+ "applied to a tag of type [%s], not: %s", getId(), getPath(), name,
+				tag.toUserDebugString());
 
 			findMarkupStream().throwMarkupException(msg);
 		}
@@ -3574,9 +3568,9 @@ public abstract class Component implemen
 			final String tagAttributeValue = tag.getAttributes().getString(key);
 			if (tagAttributeValue == null || !value.equalsIgnoreCase(tagAttributeValue))
 			{
-				String msg = String.format("Component [%s] (path = [%s]) must be applied to a tag " +
-						                     "with [%s] attribute matching [%s], not [%s]",
-				                           getId(), getPath(), key, value, tagAttributeValue);
+				String msg = String.format("Component [%s] (path = [%s]) must be applied to a tag "
+					+ "with [%s] attribute matching [%s], not [%s]", getId(), getPath(), key,
+					value, tagAttributeValue);
 
 				findMarkupStream().throwMarkupException(msg);
 			}
@@ -4693,14 +4687,14 @@ public abstract class Component implemen
 		Boolean state = getMetaData(ENABLED_IN_HIERARCHY_CACHE_KEY);
 		if (state == null)
 		{
-			state = isEnabled() && isEnableAllowed();
-			if (state)
+			Component parent = getParent();
+			if (parent != null && !parent.isEnabledInHierarchy())
 			{
-				Component parent = getParent();
-				if (parent != null)
-				{
-					state = state && parent.isEnabledInHierarchy();
-				}
+				state = false;
+			}
+			else
+			{
+				state = isEnabled() && isEnableAllowed();
 			}
 			setMetaData(ENABLED_IN_HIERARCHY_CACHE_KEY, state);
 		}

Modified: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/AjaxHeaderContributionPage2_ajax_expected.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/AjaxHeaderContributionPage2_ajax_expected.html?rev=1034939&r1=1034938&r2=1034939&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/AjaxHeaderContributionPage2_ajax_expected.html (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/AjaxHeaderContributionPage2_ajax_expected.html Sun Nov 14 06:20:28 2010
@@ -9,7 +9,6 @@ test
 test
 </span>]]></component><header-contribution><![CDATA[<head xmlns:wicket="http://wicket.apache.org">
 <link href="../test2"/>
-<script type="text/javascript" src="javascripturlB"></script>
 </head>]]></header-contribution><component id="btest14" ><![CDATA[<span id="btest14">
 test
 </span>]]></component><component id="btest25" ><![CDATA[<span id="btest25">