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/28 02:26:40 UTC

svn commit: r990309 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: Component.java MarkupContainer.java

Author: ivaynberg
Date: Sat Aug 28 00:26:40 2010
New Revision: 990309

URL: http://svn.apache.org/viewvc?rev=990309&view=rev
Log:

Issue: WICKET-2783

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=990309&r1=990308&r2=990309&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Sat Aug 28 00:26:40 2010
@@ -1126,7 +1126,7 @@ public abstract class Component
 
 			// clear the enabled in hierarchy cache as it may change as a result of form processing
 			// or other logic executed in onbeforerender (WICKET-2063)
-			setMetaData(Component.ENABLED_IN_HIERARCHY_CACHE_KEY, null);
+			clearEnabledInHierarchyCache();
 
 			onBeforeRender();
 			getApplication().notifyPostComponentOnBeforeRenderListeners(this);
@@ -1314,7 +1314,7 @@ public abstract class Component
 		}
 
 		// clear out enabled state metadata
-		setMetaData(ENABLED_IN_HIERARCHY_CACHE_KEY, null);
+		clearEnabledInHierarchyCache();
 
 		// notify any detach listener
 		IDetachListener detachListener = getApplication().getFrameworkSettings()
@@ -2930,10 +2930,21 @@ public abstract class Component
 
 			// Change visibility
 			setFlag(FLAG_ENABLED, enabled);
+			onEnabledStateChanged();
 		}
 		return this;
 	}
 
+	void clearEnabledInHierarchyCache()
+	{
+		setMetaData(ENABLED_IN_HIERARCHY_CACHE_KEY, null);
+	}
+
+	void onEnabledStateChanged()
+	{
+		clearEnabledInHierarchyCache();
+	}
+
 	/**
 	 * Sets whether model strings should be escaped.
 	 * 

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=990309&r1=990308&r2=990309&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Sat Aug 28 00:26:40 2010
@@ -987,8 +987,8 @@ public abstract class MarkupContainer ex
 	}
 
 	/**
-	 * Overrides {@link Component#initialize()} to call {@link Component#fireInitialize()} for itself
-	 * and for all its children.
+	 * Overrides {@link Component#initialize()} to call {@link Component#fireInitialize()} for
+	 * itself and for all its children.
 	 * 
 	 * @see org.apache.wicket.Component#fireInitialize()
 	 */
@@ -1765,6 +1765,19 @@ public abstract class MarkupContainer ex
 		}
 	}
 
+	@Override
+	void onEnabledStateChanged()
+	{
+		super.onEnabledStateChanged();
+		visitChildren(new IVisitor<Component, Void>()
+		{
+			public void component(Component component, IVisit<Void> visit)
+			{
+				component.clearEnabledInHierarchyCache();
+			}
+		});
+	}
+
 	/**
 	 * 
 	 * @see org.apache.wicket.Component#onAfterRenderChildren()