You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2016/04/25 11:48:42 UTC

[04/17] wicket git commit: WICKET-6137 remove method paramter from canCallListenerInterface - it is not needed any longer

WICKET-6137 remove method paramter from canCallListenerInterface - it is not needed any longer


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

Branch: refs/heads/master
Commit: c5194b4af9c578708398832224722e6f3436e50e
Parents: d171029
Author: Sven Meier <sv...@apache.org>
Authored: Sun Mar 27 22:43:44 2016 +0200
Committer: Sven Meier <sv...@apache.org>
Committed: Mon Apr 25 11:44:37 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/wicket/Component.java  | 23 +++++---------------
 .../org/apache/wicket/behavior/Behavior.java    | 12 ++++------
 .../ListenerInterfaceRequestHandler.java        |  4 ++--
 .../apache/wicket/markup/html/image/Image.java  |  5 ++---
 .../java/org/apache/wicket/ComponentTest.java   |  7 +++---
 .../apache/wicket/util/time/TimeOfDayTest.java  |  2 +-
 6 files changed, 18 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/c5194b4a/wicket-core/src/main/java/org/apache/wicket/Component.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 877e963..2c8150d 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -17,7 +17,6 @@
 package org.apache.wicket;
 
 import java.io.Serializable;
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -2065,13 +2064,9 @@ public abstract class Component
 	 */
 	public final boolean isStateless()
 	{
-		if (
-		// the component is either invisible or disabled
-		(isVisibleInHierarchy() && isEnabledInHierarchy()) == false &&
-
-		// and it can't call listener interfaces
-			canCallListenerInterface(null) == false)
+		if ((isVisibleInHierarchy() && isEnabledInHierarchy()) == false && canCallListenerInterface() == false)
 		{
+			// the component is either invisible or disabled and it can't call listener interfaces
 			// then pretend the component is stateless
 			return true;
 		}
@@ -4431,9 +4426,7 @@ public abstract class Component
 
 	/**
 	 * Checks whether or not a listener method can be invoked on this component. Usually components
-	 * deny these invocations if they are either invisible or disabled in hierarchy. Components can
-	 * examine which listener interface is being invoked by examining the declaring class of the
-	 * passed in {@literal method} parameter.
+	 * deny these invocations if they are either invisible or disabled in hierarchy.
 	 * <p>
 	 * WARNING: be careful when overriding this method because it may open security holes - such as
 	 * allowing a user to click on a link that should be disabled.
@@ -4442,18 +4435,14 @@ public abstract class Component
 	 * Example usecase for overriding: Suppose you are building an component that displays images.
 	 * The component generates a callback to itself using {@link IRequestListener} interface and
 	 * uses this callback to stream image data. If such a component is placed inside a disabled
-	 * webmarkupcontainer we still want to allow the invocation of the request listener callback
+	 * {@code WebMarkupContainer} we still want to allow the invocation of the request listener callback
 	 * method so that image data can be streamed. Such a component would override this method and
-	 * return {@literal true} if the listener method belongs to {@link IRequestListener}.
+	 * return {@literal true}.
 	 * </p>
 	 * 
-	 * @param method
-	 *            listener method about to be invoked on this component. Could be {@code null} - in
-	 *            this case it means <em>any</em> method.
-	 * 
 	 * @return {@literal true} iff the listener method can be invoked on this component
 	 */
-	public boolean canCallListenerInterface(Method method)
+	public boolean canCallListenerInterface()
 	{
 		return isEnabledInHierarchy() && isVisibleInHierarchy();
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/c5194b4a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
index 2267e74..51e5143 100644
--- a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java
@@ -16,8 +16,6 @@
  */
 package org.apache.wicket.behavior;
 
-import java.lang.reflect.Method;
-
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.IComponentAwareEventSink;
@@ -205,21 +203,19 @@ public abstract class Behavior
 
 	/**
 	 * Checks whether or not a listener interface can be invoked on this behavior. For further
-	 * information please read the javadoc on {@link Component#canCallListenerInterface(Method)},
+	 * information please read the javadoc on {@link Component#canCallListenerInterface()},
 	 * this method has the same semantics.
 	 * 
-	 * WARNING: Read the javadoc of {@link Component#canCallListenerInterface(Method)} for important
+	 * WARNING: Read the javadoc of {@link Component#canCallListenerInterface()} for important
 	 * security-related information.
 	 * 
 	 * @param component
 	 *            component this behavior is attached to
-	 * @param method
-	 *            listener method being invoked
 	 * @return {@literal true} iff the listener method can be invoked
 	 */
-	public boolean canCallListenerInterface(Component component, Method method)
+	public boolean canCallListenerInterface(Component component)
 	{
-		return isEnabled(component) && component.canCallListenerInterface(method);
+		return isEnabled(component) && component.canCallListenerInterface();
 	}
 
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/c5194b4a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
index a098f02..71696ce 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
@@ -251,7 +251,7 @@ public class ListenerInterfaceRequestHandler
 		// we are in Wicket core land
 		final Component component = (Component)rcomponent;
 
-		if (!component.canCallListenerInterface(null))
+		if (!component.canCallListenerInterface())
 		{
 			// just return so that we have a silent fail and just re-render the
 			// page
@@ -277,7 +277,7 @@ public class ListenerInterfaceRequestHandler
 		// we are in Wicket core land
 		final Component component = (Component)rcomponent;
 
-		if (!behavior.canCallListenerInterface(component, null))
+		if (!behavior.canCallListenerInterface(component))
 		{
 			LOG.warn("behavior not enabled; ignore call. Behavior {} at component {}", behavior,
 				component);

http://git-wip-us.apache.org/repos/asf/wicket/blob/c5194b4a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
index 28f17ee..bbe5bc1 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket.markup.html.image;
 
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -586,7 +585,7 @@ public class Image extends WebComponent implements IRequestListener
 	}
 
 	@Override
-	public boolean canCallListenerInterface(Method method)
+	public boolean canCallListenerInterface()
 	{
 		if (isVisibleInHierarchy())
 		{
@@ -597,7 +596,7 @@ public class Image extends WebComponent implements IRequestListener
 		}
 		else
 		{
-			return super.canCallListenerInterface(method);
+			return super.canCallListenerInterface();
 		}
 	}
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/c5194b4a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java b/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java
index 496718b..ca59d80 100644
--- a/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/ComponentTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket;
 
-import java.lang.reflect.Method;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.wicket.ajax.AjaxEventBehavior;
@@ -143,7 +142,7 @@ public class ComponentTest extends WicketTestCase
 		// methods no matter whether it is visible or enabled
 		component = new WebComponent("someId") {
 			@Override
-			public boolean canCallListenerInterface(Method method)
+			public boolean canCallListenerInterface()
 			{
 				return true;
 			}
@@ -181,8 +180,8 @@ public class ComponentTest extends WicketTestCase
 		link = new Link<Void>("someId") {
 
 		    @Override
-		    public boolean canCallListenerInterface(Method method) {
-			return true;
+		    public boolean canCallListenerInterface() {
+		    	return true;
 		    }
 
 		    @Override

http://git-wip-us.apache.org/repos/asf/wicket/blob/c5194b4a/wicket-util/src/test/java/org/apache/wicket/util/time/TimeOfDayTest.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/test/java/org/apache/wicket/util/time/TimeOfDayTest.java b/wicket-util/src/test/java/org/apache/wicket/util/time/TimeOfDayTest.java
index 2dc7949..b4e3a17 100644
--- a/wicket-util/src/test/java/org/apache/wicket/util/time/TimeOfDayTest.java
+++ b/wicket-util/src/test/java/org/apache/wicket/util/time/TimeOfDayTest.java
@@ -20,7 +20,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Test cases for this object
+ * Test cases for {@link TimeOfDay}.
  * 
  * @author Jonathan Locke
  */