You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by cm...@apache.org on 2013/08/07 14:01:33 UTC

[1/2] git commit: WICKET-5305 make throttlesettings#id default to component's markup id

Updated Branches:
  refs/heads/master c276f09cc -> badf66819


WICKET-5305 make throttlesettings#id default to component's markup id


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

Branch: refs/heads/master
Commit: badf668195cce894ce7658557b231823da9083a8
Parents: db8f694
Author: Carl-Eric Menzel <cm...@wicketbuch.de>
Authored: Wed Aug 7 14:00:28 2013 +0200
Committer: Carl-Eric Menzel <cm...@wicketbuch.de>
Committed: Wed Aug 7 14:00:36 2013 +0200

----------------------------------------------------------------------
 .../ajax/AbstractDefaultAjaxBehavior.java       |  8 ++++--
 .../ajax/attributes/ThrottlingSettings.java     | 30 ++++++++++++++++++--
 2 files changed, 34 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/badf6681/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 8c7acaf..35605f1 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
@@ -356,8 +356,12 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 			if (throttlingSettings != null)
 			{
 				JSONObject throttlingSettingsJson = new JSONObject();
-				throttlingSettingsJson.put(AjaxAttributeName.THROTTLING_ID.jsonName(),
-					throttlingSettings.getId());
+				String throttleId = throttlingSettings.getId();
+				if (throttleId == null)
+				{
+					throttleId = component.getMarkupId();
+				}
+				throttlingSettingsJson.put(AjaxAttributeName.THROTTLING_ID.jsonName(), throttleId);
 				throttlingSettingsJson.put(AjaxAttributeName.THROTTLING_DELAY.jsonName(),
 					throttlingSettings.getDelay().getMilliseconds());
 				if (throttlingSettings.getPostponeTimerOnUpdate())

http://git-wip-us.apache.org/repos/asf/wicket/blob/badf6681/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
index 079b586..42c6d7d 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
@@ -35,6 +35,31 @@ public class ThrottlingSettings implements IClusterable
 	private boolean postponeTimerOnUpdate;
 
 	/**
+	 * Construct without id (will default to the component's markup ID) and postponeTimerOnUpdate
+	 * set to false.
+	 * 
+	 * @param delay
+	 *            throttle delay
+	 */
+	public ThrottlingSettings(final Duration delay)
+	{
+		this(null, delay, false);
+	}
+
+	/**
+	 * Construct without id (will default to the component's markup ID).
+	 * 
+	 * @param delay
+	 *            throttle delay
+	 * @param postponeTimerOnUpdate
+	 *            postpone timer
+	 */
+	public ThrottlingSettings(final Duration delay, boolean postponeTimerOnUpdate)
+	{
+		this(null, delay, postponeTimerOnUpdate);
+	}
+
+	/**
 	 * Construct.
 	 * 
 	 * @param id
@@ -58,7 +83,7 @@ public class ThrottlingSettings implements IClusterable
 	public ThrottlingSettings(final String id, final Duration delay,
 		final boolean postponeTimerOnUpdate)
 	{
-		this.id = Args.notNull(id, "id");
+		this.id = id;
 		this.delay = Args.notNull(delay, "delay");
 		this.postponeTimerOnUpdate = postponeTimerOnUpdate;
 	}
@@ -80,7 +105,8 @@ public class ThrottlingSettings implements IClusterable
 	 * This id is used by the client-side throttling code to keep track of the various event
 	 * throttles. Normally you can just use any unique ID here, such as the component's markupId (
 	 * {@link WebComponent#getMarkupId()}). To unite several different events with one throttle,
-	 * give them the same ID.
+	 * give them the same ID. If this is null, it will (on the client only) default to the
+	 * component's markupId.
 	 * 
 	 * @return throttle id
 	 */


Re: [2/2] git commit: formatting fixed

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Aug 7, 2013 at 2:01 PM, <cm...@apache.org> wrote:

> formatting fixed
>
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/db8f6942
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/db8f6942
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/db8f6942
>
> Branch: refs/heads/master
> Commit: db8f69429a194bfa26e32e68228952d3d0a7efae
> Parents: c276f09
> Author: Carl-Eric Menzel <cm...@wicketbuch.de>
> Authored: Wed Aug 7 13:59:43 2013 +0200
> Committer: Carl-Eric Menzel <cm...@wicketbuch.de>
> Committed: Wed Aug 7 14:00:36 2013 +0200
>
> ----------------------------------------------------------------------
>  .../ajax/AbstractDefaultAjaxBehavior.java       |  2 +-
>  .../ajax/attributes/ThrottlingSettings.java     | 31 ++++++++++++--------
>  2 files changed, 19 insertions(+), 14 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/db8f6942/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 85f950c..8c7acaf 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
> @@ -140,7 +140,7 @@ public abstract class AbstractDefaultAjaxBehavior
> extends AbstractAjaxBehavior
>                 for (AjaxRequestTarget.IListener listener :
> ajaxRequestTargetListeners)
>                 {
>                         listener.updateAjaxAttributes(attributes);
> -               }
> +                       }
>

Eclipse settings are wrong here.


>                 updateAjaxAttributes(attributes);
>                 return attributes;
>         }
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/db8f6942/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
> b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
> index a724b3d..079b586 100644
> ---
> a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
> +++
> b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
> @@ -16,13 +16,14 @@
>   */
>  package org.apache.wicket.ajax.attributes;
>
> +import org.apache.wicket.markup.html.WebComponent;
>  import org.apache.wicket.util.io.IClusterable;
>  import org.apache.wicket.util.lang.Args;
>  import org.apache.wicket.util.time.Duration;
>
>  /**
>   * Class to keep track of throttling settings.
> - *
> + *
>   * @author ivaynberg
>   */
>  public class ThrottlingSettings implements IClusterable
> @@ -35,9 +36,11 @@ public class ThrottlingSettings implements IClusterable
>
>         /**
>          * Construct.
> -        *
> -        * @param id    throttle id
> -        * @param delay throttle delay
> +        *
> +        * @param id
> +        *            throttle id
> +        * @param delay
> +        *            throttle delay
>          */
>         public ThrottlingSettings(final String id, final Duration delay)
>         {
> @@ -46,12 +49,14 @@ public class ThrottlingSettings implements IClusterable
>
>         /**
>          * Construct.
> -        *
> -        * @param id    throttle id
> -        * @param delay the amount of time the action should be postponed
> -        * @param postponeTimerOnUpdate postpone timer
> +        *
> +        * @param id
> +        *            throttle id
> +        * @param delay
> +        *            the amount of time the action should be postponed
>          */
> -       public ThrottlingSettings(final String id, final Duration delay,
> final boolean postponeTimerOnUpdate)
> +       public ThrottlingSettings(final String id, final Duration delay,
> +               final boolean postponeTimerOnUpdate)
>         {
>                 this.id = Args.notNull(id, "id");
>                 this.delay = Args.notNull(delay, "delay");
> @@ -85,10 +90,10 @@ public class ThrottlingSettings implements IClusterable
>         }
>
>         /**
> -        * If it is set to true, then the timer is reset each time the
> throttle function
> -        * gets called. Use this behaviour if you want something to happen
> at X milliseconds
> -        * after the <strong>last</strong> call to throttle. If the
> parameter is not set, or set to false,
> -        * then the timer is not reset.
> +        * If it is set to true, then the timer is reset each time the
> throttle function gets called.
> +        * Use this behaviour if you want something to happen at X
> milliseconds after the
> +        * <strong>last</strong> call to throttle. If the parameter is not
> set, or set to false, then
> +        * the timer is not reset.
>          */
>         public boolean getPostponeTimerOnUpdate()
>         {
>
>

[2/2] git commit: formatting fixed

Posted by cm...@apache.org.
formatting fixed


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

Branch: refs/heads/master
Commit: db8f69429a194bfa26e32e68228952d3d0a7efae
Parents: c276f09
Author: Carl-Eric Menzel <cm...@wicketbuch.de>
Authored: Wed Aug 7 13:59:43 2013 +0200
Committer: Carl-Eric Menzel <cm...@wicketbuch.de>
Committed: Wed Aug 7 14:00:36 2013 +0200

----------------------------------------------------------------------
 .../ajax/AbstractDefaultAjaxBehavior.java       |  2 +-
 .../ajax/attributes/ThrottlingSettings.java     | 31 ++++++++++++--------
 2 files changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/db8f6942/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 85f950c..8c7acaf 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
@@ -140,7 +140,7 @@ public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
 		for (AjaxRequestTarget.IListener listener : ajaxRequestTargetListeners)
 		{
 			listener.updateAjaxAttributes(attributes);
-		}
+			}
 		updateAjaxAttributes(attributes);
 		return attributes;
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/db8f6942/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
index a724b3d..079b586 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java
@@ -16,13 +16,14 @@
  */
 package org.apache.wicket.ajax.attributes;
 
+import org.apache.wicket.markup.html.WebComponent;
 import org.apache.wicket.util.io.IClusterable;
 import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.time.Duration;
 
 /**
  * Class to keep track of throttling settings.
- *
+ * 
  * @author ivaynberg
  */
 public class ThrottlingSettings implements IClusterable
@@ -35,9 +36,11 @@ public class ThrottlingSettings implements IClusterable
 
 	/**
 	 * Construct.
-	 *
-	 * @param id    throttle id
-	 * @param delay throttle delay
+	 * 
+	 * @param id
+	 *            throttle id
+	 * @param delay
+	 *            throttle delay
 	 */
 	public ThrottlingSettings(final String id, final Duration delay)
 	{
@@ -46,12 +49,14 @@ public class ThrottlingSettings implements IClusterable
 
 	/**
 	 * Construct.
-	 *
-	 * @param id    throttle id
-	 * @param delay the amount of time the action should be postponed
-	 * @param postponeTimerOnUpdate postpone timer
+	 * 
+	 * @param id
+	 *            throttle id
+	 * @param delay
+	 *            the amount of time the action should be postponed
 	 */
-	public ThrottlingSettings(final String id, final Duration delay, final boolean postponeTimerOnUpdate)
+	public ThrottlingSettings(final String id, final Duration delay,
+		final boolean postponeTimerOnUpdate)
 	{
 		this.id = Args.notNull(id, "id");
 		this.delay = Args.notNull(delay, "delay");
@@ -85,10 +90,10 @@ public class ThrottlingSettings implements IClusterable
 	}
 
 	/**
-	 * If it is set to true, then the timer is reset each time the throttle function
-	 * gets called. Use this behaviour if you want something to happen at X milliseconds
-	 * after the <strong>last</strong> call to throttle. If the parameter is not set, or set to false,
-	 * then the timer is not reset.
+	 * If it is set to true, then the timer is reset each time the throttle function gets called.
+	 * Use this behaviour if you want something to happen at X milliseconds after the
+	 * <strong>last</strong> call to throttle. If the parameter is not set, or set to false, then
+	 * the timer is not reset.
 	 */
 	public boolean getPostponeTimerOnUpdate()
 	{