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/05/06 21:50:49 UTC

git commit: make methods to generate callback functions public

Updated Branches:
  refs/heads/master 91c604d55 -> 40bdfd41d


make methods to generate callback functions public


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

Branch: refs/heads/master
Commit: 40bdfd41dcb7474f0a5fac3530da47af48762e18
Parents: 91c604d
Author: Emond Papegaaij <pa...@apache.org>
Authored: Sun May 6 21:50:02 2012 +0200
Committer: Emond Papegaaij <pa...@apache.org>
Committed: Sun May 6 21:50:02 2012 +0200

----------------------------------------------------------------------
 .../wicket/ajax/AbstractDefaultAjaxBehavior.java   |   28 ++++++++-------
 1 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/40bdfd41/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 25dae76..e17cf07 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
@@ -99,7 +99,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	 * @param response
 	 *            the current header response
 	 */
-	private void renderExtraHeaderContributors(final Component component, final IHeaderResponse response)
+	private void renderExtraHeaderContributors(final Component component,
+		final IHeaderResponse response)
 	{
 		AjaxRequestAttributes attributes = getAttributes();
 
@@ -374,15 +375,15 @@ 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.
-	 *
+	 * 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()
+	 *            the JSON object created by #renderAjaxAttributes()
 	 * @param component
-	 *      the component with the attached Ajax behavior
+	 *            the component with the attached Ajax behavior
 	 * @throws JSONException
-	 *      thrown if an error occurs while modifying {@literal attributesJson} argument
+	 *             thrown if an error occurs while modifying {@literal attributesJson} argument
 	 */
 	protected void postprocessConfiguration(JSONObject attributesJson, Component component)
 		throws JSONException
@@ -390,8 +391,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	}
 
 	/**
-	 * @return javascript that will generate an ajax GET request to this behavior
-	 *  with its assigned component
+	 * @return javascript that will generate an ajax GET request to this behavior with its assigned
+	 *         component
 	 */
 	public CharSequence getCallbackScript()
 	{
@@ -399,7 +400,8 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	}
 
 	/**
-	 * @param component the component to use when generating the attributes
+	 * @param component
+	 *            the component to use when generating the attributes
 	 * @return script that can be used to execute this Ajax behavior.
 	 */
 	// 'protected' because this method is intended to be called by other Behavior methods which
@@ -407,7 +409,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	protected CharSequence getCallbackScript(final Component component)
 	{
 		CharSequence ajaxAttributes = renderAjaxAttributes(component);
-		return "Wicket.Ajax.ajax("+ajaxAttributes+");";
+		return "Wicket.Ajax.ajax(" + ajaxAttributes + ");";
 	}
 
 	/**
@@ -426,7 +428,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	 * @param extraParameters
 	 * @return A function that can be used as a callback function in javascript
 	 */
-	protected CharSequence getCallbackFunction(String... extraParameters)
+	public CharSequence getCallbackFunction(String... extraParameters)
 	{
 		StringBuilder sb = new StringBuilder();
 		sb.append("function (");
@@ -453,7 +455,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 	 * @param extraParameters
 	 * @return The body of the {@linkplain #getCallbackFunction(String...) callback function}.
 	 */
-	protected CharSequence getCallbackFunctionBody(String... extraParameters)
+	public CharSequence getCallbackFunctionBody(String... extraParameters)
 	{
 		AjaxRequestAttributes attributes = getAttributes();
 		CharSequence attrsJson = renderAjaxAttributes(getComponent(), attributes);