You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2012/09/05 12:11:19 UTC

[1/2] git commit: reformat file

Updated Branches:
  refs/heads/master d8d47dd0e -> 20be712c0


reformat file


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

Branch: refs/heads/master
Commit: 20be712c0d4a0f1ac6be8a6040891d969101b60e
Parents: 452789c
Author: Emond Papegaaij <pa...@apache.org>
Authored: Wed Sep 5 12:04:48 2012 +0200
Committer: Emond Papegaaij <pa...@apache.org>
Committed: Wed Sep 5 12:04:48 2012 +0200

----------------------------------------------------------------------
 .../wicket/ajax/AbstractDefaultAjaxBehavior.java   |   73 ++++++++-------
 1 files changed, 40 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/20be712c/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 7d6c8bf..c0d6e38 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
@@ -47,11 +47,11 @@ import org.apache.wicket.util.time.Duration;
 
 /**
  * The base class for Wicket's default AJAX implementation.
- *
+ * 
  * @since 1.2
- *
+ * 
  * @author Igor Vaynberg (ivaynberg)
- *
+ * 
  */
 public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 {
@@ -62,17 +62,17 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 		AbstractDefaultAjaxBehavior.class, "indicator.gif");
 
 	private static final String DYNAMIC_PARAMETER_FUNCTION_TEMPLATE = "function(attrs){%s}";
-	private static final String PRECONDITION_FUNCTION_TEMPLATE      = "function(attrs){%s}";
-	private static final String COMPLETE_HANDLER_FUNCTION_TEMPLATE  = "function(attrs, jqXHR, textStatus){%s}";
-	private static final String FAILURE_HANDLER_FUNCTION_TEMPLATE   = "function(attrs, jqXHR, errorMessage, textStatus){%s}";
-	private static final String SUCCESS_HANDLER_FUNCTION_TEMPLATE   = "function(attrs, jqXHR, data, textStatus){%s}";
-	private static final String AFTER_HANDLER_FUNCTION_TEMPLATE     = "function(attrs){%s}";
-	private static final String BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE    = "function(attrs, jqXHR, settings){%s}";
-	private static final String BEFORE_HANDLER_FUNCTION_TEMPLATE    = "function(attrs){%s}";
+	private static final String PRECONDITION_FUNCTION_TEMPLATE = "function(attrs){%s}";
+	private static final String COMPLETE_HANDLER_FUNCTION_TEMPLATE = "function(attrs, jqXHR, textStatus){%s}";
+	private static final String FAILURE_HANDLER_FUNCTION_TEMPLATE = "function(attrs, jqXHR, errorMessage, textStatus){%s}";
+	private static final String SUCCESS_HANDLER_FUNCTION_TEMPLATE = "function(attrs, jqXHR, data, textStatus){%s}";
+	private static final String AFTER_HANDLER_FUNCTION_TEMPLATE = "function(attrs){%s}";
+	private static final String BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE = "function(attrs, jqXHR, settings){%s}";
+	private static final String BEFORE_HANDLER_FUNCTION_TEMPLATE = "function(attrs){%s}";
 
 	/**
 	 * Subclasses should call super.onBind()
-	 *
+	 * 
 	 * @see org.apache.wicket.behavior.AbstractAjaxBehavior#onBind()
 	 */
 	@Override
@@ -104,7 +104,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	/**
 	 * Renders header contribution by IAjaxCallListener instances which additionally implement
 	 * IComponentAwareHeaderContributor interface.
-	 *
+	 * 
 	 * @param component
 	 *            the component assigned to this behavior
 	 * @param response
@@ -140,7 +140,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 
 	/**
 	 * Gives a chance to the specializations to modify the attributes.
-	 *
+	 * 
 	 * @param attributes
 	 * @since 6.0
 	 */
@@ -150,7 +150,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 
 	/**
 	 * The code below handles backward compatibility.
-	 *
+	 * 
 	 * @param attributes
 	 */
 	private void updateAjaxAttributesBackwardCompatibility(final AjaxRequestAttributes attributes)
@@ -185,7 +185,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	 * 					ad: true,           // allow default
 	 * 				}
 	 * </pre>
-	 *
+	 * 
 	 * @param component
 	 *            the component with that behavior
 	 * @return the attributes as string in JSON format
@@ -197,7 +197,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	}
 
 	/**
-	 *
+	 * 
 	 * @param component
 	 * @param attributes
 	 * @return the attributes as string in JSON format
@@ -250,25 +250,32 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 				if (ajaxCallListener != null)
 				{
 					CharSequence beforeHandler = ajaxCallListener.getBeforeHandler(component);
-					appendListenerHandler(beforeHandler, attributesJson, "bh", BEFORE_HANDLER_FUNCTION_TEMPLATE);
+					appendListenerHandler(beforeHandler, attributesJson, "bh",
+						BEFORE_HANDLER_FUNCTION_TEMPLATE);
 
 					CharSequence beforeSendHandler = ajaxCallListener.getBeforeSendHandler(component);
-					appendListenerHandler(beforeSendHandler, attributesJson, "bsh", BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE);
+					appendListenerHandler(beforeSendHandler, attributesJson, "bsh",
+						BEFORE_SEND_HANDLER_FUNCTION_TEMPLATE);
 
 					CharSequence afterHandler = ajaxCallListener.getAfterHandler(component);
-					appendListenerHandler(afterHandler, attributesJson, "ah", AFTER_HANDLER_FUNCTION_TEMPLATE);
+					appendListenerHandler(afterHandler, attributesJson, "ah",
+						AFTER_HANDLER_FUNCTION_TEMPLATE);
 
 					CharSequence successHandler = ajaxCallListener.getSuccessHandler(component);
-					appendListenerHandler(successHandler, attributesJson, "sh", SUCCESS_HANDLER_FUNCTION_TEMPLATE);
+					appendListenerHandler(successHandler, attributesJson, "sh",
+						SUCCESS_HANDLER_FUNCTION_TEMPLATE);
 
 					CharSequence failureHandler = ajaxCallListener.getFailureHandler(component);
-					appendListenerHandler(failureHandler, attributesJson, "fh", FAILURE_HANDLER_FUNCTION_TEMPLATE);
+					appendListenerHandler(failureHandler, attributesJson, "fh",
+						FAILURE_HANDLER_FUNCTION_TEMPLATE);
 
 					CharSequence completeHandler = ajaxCallListener.getCompleteHandler(component);
-					appendListenerHandler(completeHandler, attributesJson, "coh", COMPLETE_HANDLER_FUNCTION_TEMPLATE);
+					appendListenerHandler(completeHandler, attributesJson, "coh",
+						COMPLETE_HANDLER_FUNCTION_TEMPLATE);
 
 					CharSequence precondition = ajaxCallListener.getPrecondition(component);
-					appendListenerHandler(precondition, attributesJson, "pre", PRECONDITION_FUNCTION_TEMPLATE);
+					appendListenerHandler(precondition, attributesJson, "pre",
+						PRECONDITION_FUNCTION_TEMPLATE);
 				}
 			}
 
@@ -284,7 +291,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 			{
 				for (CharSequence dynamicExtraParameter : dynamicExtraParameters)
 				{
-					String func = String.format(DYNAMIC_PARAMETER_FUNCTION_TEMPLATE, dynamicExtraParameter);
+					String func = String.format(DYNAMIC_PARAMETER_FUNCTION_TEMPLATE,
+						dynamicExtraParameter);
 					JsonFunction function = new JsonFunction(func);
 					attributesJson.append("dep", function);
 				}
@@ -363,15 +371,14 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	}
 
 	private void appendListenerHandler(final CharSequence handler, final JSONObject attributesJson,
-			final String propertyName, final String functionTemplate)
-		throws JSONException
+		final String propertyName, final String functionTemplate) throws JSONException
 	{
 		if (Strings.isEmpty(handler) == false)
 		{
 			final JsonFunction function;
 			if (handler instanceof JsonFunction)
 			{
-				function = (JsonFunction) handler;
+				function = (JsonFunction)handler;
 			}
 			else
 			{
@@ -385,7 +392,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	/**
 	 * Gives a chance to modify the JSON attributesJson that is going to be used as attributes for
 	 * the Ajax call.
-	 *
+	 * 
 	 * @param attributesJson
 	 *            the JSON object created by #renderAjaxAttributes()
 	 * @param component
@@ -423,7 +430,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	/**
 	 * Generates a javascript function that can take parameters and performs an AJAX call which
 	 * includes these parameters. The generated code looks like this:
-	 *
+	 * 
 	 * <pre>
 	 * function(param1, param2) {
 	 *    var attrs = attrsJson;
@@ -432,7 +439,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	 *    Wicket.Ajax.ajax(attrs);
 	 * }
 	 * </pre>
-	 *
+	 * 
 	 * @param extraParameters
 	 * @return A function that can be used as a callback function in javascript
 	 */
@@ -462,7 +469,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	 * Generates the body the {@linkplain #getCallbackFunction(CallbackParameter...) callback
 	 * function}. To embed this code directly into a piece of javascript, make sure any context
 	 * parameters are available as local variables, global variables or within the closure.
-	 *
+	 * 
 	 * @param extraParameters
 	 * @return The body of the {@linkplain #getCallbackFunction(CallbackParameter...) callback
 	 *         function}.
@@ -532,7 +539,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 
 	/**
 	 * Provides an AjaxChannel for this Behavior.
-	 *
+	 * 
 	 * @return an AjaxChannel - Defaults to null.
 	 * @deprecated Use {@link org.apache.wicket.ajax.attributes.AjaxRequestAttributes}
 	 */
@@ -545,7 +552,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	/**
 	 * Finds the markup id of the indicator. The default search order is: component, behavior,
 	 * component's parent hierarchy.
-	 *
+	 * 
 	 * @return markup id or <code>null</code> if no indicator found
 	 */
 	protected String findIndicatorId()