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 2013/05/22 17:09:33 UTC

git commit: WICKET-5198 Change AjaxRequestAttributes#eventPropagation to BUBBLE initially

Updated Branches:
  refs/heads/master c029a4c8d -> 8c9e15dc6


WICKET-5198 Change AjaxRequestAttributes#eventPropagation to BUBBLE
initially

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

Branch: refs/heads/master
Commit: 8c9e15dc61c73fad6e63bb02464e22f02c74cf21
Parents: c029a4c
Author: svenmeier <sv...@meiers.net>
Authored: Wed May 22 17:08:52 2013 +0200
Committer: svenmeier <sv...@meiers.net>
Committed: Wed May 22 17:08:52 2013 +0200

----------------------------------------------------------------------
 .../wicket/ajax/AbstractDefaultAjaxBehavior.java   |   26 ++++++++-------
 .../ajax/attributes/AjaxRequestAttributes.java     |   26 +++++++-------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |    2 +-
 3 files changed, 28 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/8c9e15dc/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
index 30e177b..a6a6edd 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
@@ -97,8 +97,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 		RequestCycle requestCycle = component.getRequestCycle();
 		Url baseUrl = requestCycle.getUrlRenderer().getBaseUrl();
 		CharSequence ajaxBaseUrl = Strings.escapeMarkup(baseUrl.toString());
-		response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl +
-			"\";", "wicket-ajax-base-url"));
+		response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl
+			+ "\";", "wicket-ajax-base-url"));
 
 		renderExtraHeaderContributors(component, response);
 	}
@@ -136,7 +136,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	{
 		AjaxRequestAttributes attributes = new AjaxRequestAttributes();
 		WebApplication application = (WebApplication)getComponent().getApplication();
-		AjaxRequestTargetListenerCollection ajaxRequestTargetListeners = application.getAjaxRequestTargetListeners();
+		AjaxRequestTargetListenerCollection ajaxRequestTargetListeners = application
+			.getAjaxRequestTargetListeners();
 		for (AjaxRequestTarget.IListener listener : ajaxRequestTargetListeners)
 		{
 			if (listener instanceof AjaxRequestTarget.AbstractListener)
@@ -266,7 +267,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 						AjaxAttributeName.BEFORE_HANDLER.jsonName(),
 						BEFORE_HANDLER_FUNCTION_TEMPLATE);
 
-					CharSequence beforeSendHandler = ajaxCallListener.getBeforeSendHandler(component);
+					CharSequence beforeSendHandler = ajaxCallListener
+						.getBeforeSendHandler(component);
 					appendListenerHandler(beforeSendHandler, attributesJson,
 						AjaxAttributeName.BEFORE_SEND_HANDLER.jsonName(),
 						BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE);
@@ -345,11 +347,13 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 				attributesJson.put(AjaxAttributeName.IS_PREVENT_DEFAULT.jsonName(), true);
 			}
 
-			if (AjaxRequestAttributes.EventPropagation.BUBBLE.equals(attributes.getEventPropagation()))
+			if (AjaxRequestAttributes.EventPropagation.STOP
+				.equals(attributes.getEventPropagation()))
 			{
-				attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "bubble");
+				attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "stop");
 			}
-			else if (AjaxRequestAttributes.EventPropagation.STOP_IMMEDIATE.equals(attributes.getEventPropagation()))
+			else if (AjaxRequestAttributes.EventPropagation.STOP_IMMEDIATE.equals(attributes
+				.getEventPropagation()))
 			{
 				attributesJson.put(AjaxAttributeName.EVENT_PROPAGATION.jsonName(), "stopImmediate");
 			}
@@ -524,9 +528,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 					sb.append(',');
 				else
 					first = false;
-				sb.append('\'')
-					.append(curExtraParameter.getAjaxParameterName())
-					.append("': ")
+				sb.append('\'').append(curExtraParameter.getAjaxParameterName()).append("': ")
 					.append(curExtraParameter.getAjaxParameterCode());
 			}
 		}
@@ -534,8 +536,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 		if (attributes.getExtraParameters().isEmpty())
 			sb.append("attrs." + AjaxAttributeName.EXTRA_PARAMETERS + " = params;\n");
 		else
-			sb.append("attrs." + AjaxAttributeName.EXTRA_PARAMETERS + " = Wicket.merge(attrs." +
-				AjaxAttributeName.EXTRA_PARAMETERS + ", params);\n");
+			sb.append("attrs." + AjaxAttributeName.EXTRA_PARAMETERS + " = Wicket.merge(attrs."
+				+ AjaxAttributeName.EXTRA_PARAMETERS + ", params);\n");
 		sb.append("Wicket.Ajax.ajax(attrs);\n");
 		return sb;
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/8c9e15dc/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
index 676c907..df01b01 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
@@ -61,8 +61,8 @@ public final class AjaxRequestAttributes
 		STOP,
 
 		/**
-		 * Stops the propagation of the JavaScript event to the parent of its target
-		 * and all other event listeners registered on the same target
+		 * Stops the propagation of the JavaScript event to the parent of its target and all other
+		 * event listeners registered on the same target
 		 */
 		STOP_IMMEDIATE,
 
@@ -82,7 +82,7 @@ public final class AjaxRequestAttributes
 
 	private boolean preventDefault = false;
 
-	private EventPropagation eventPropagation = EventPropagation.STOP;
+	private EventPropagation eventPropagation = EventPropagation.BUBBLE;
 
 	/**
 	 * The names of the events which will trigger the Ajax call
@@ -291,10 +291,10 @@ public final class AjaxRequestAttributes
 	/**
 	 * Only applies for event behaviors. Returns whether the behavior should allow the default event
 	 * handler to be invoked. For example if the behavior is attached to a link and
-	 * {@link #isPreventDefault()} returns <code>false</code> (which is default value), the link's URL
-	 * will not be followed. If the Ajax behavior is attached to a checkbox or a radio button then
-	 * the default behavior should be allowed to actually check the box or radio button, i.e. this
-	 * method should return <code>true</code>.
+	 * {@link #isPreventDefault()} returns <code>false</code> (which is default value), the link's
+	 * URL will not be followed. If the Ajax behavior is attached to a checkbox or a radio button
+	 * then the default behavior should be allowed to actually check the box or radio button, i.e.
+	 * this method should return <code>true</code>.
 	 * 
 	 * @return {@code true} if the default event handler should be invoked, {@code false} otherwise.
 	 */
@@ -304,8 +304,8 @@ public final class AjaxRequestAttributes
 	}
 
 	/**
-	 * Only applies for event behaviors. Returns whether the behavior should allow the JavaScript event
-	 * to propagate to the parent of its target.
+	 * Only applies for event behaviors. Returns whether the behavior should allow the JavaScript
+	 * event to propagate to the parent of its target.
 	 */
 	public EventPropagation getEventPropagation()
 	{
@@ -329,11 +329,11 @@ public final class AjaxRequestAttributes
 	}
 
 	/**
-	 * Only applies to event behaviors. Determines whether the behavior should allow the
-	 * JavaScript event to propagate to the parent of its target.
-	 *
+	 * Only applies to event behaviors. Determines whether the behavior should allow the JavaScript
+	 * event to propagate to the parent of its target.
+	 * 
 	 * @param eventPropagation
-	 *      the type of the stop
+	 *            the type of the stop
 	 * @return {@code this} object, for chaining
 	 */
 	public AjaxRequestAttributes setEventPropagation(EventPropagation eventPropagation)

http://git-wip-us.apache.org/repos/asf/wicket/blob/8c9e15dc/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 9fe2d37..b45b46b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -363,7 +363,7 @@
 			}
 
 			if (!attrs.sp) {
-				attrs.sp = "stop";
+				attrs.sp = "bubble";
 			}
 		},