WICKET-5173 Make ThrottlingSettings mutable
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2ddf76fa Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2ddf76fa Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2ddf76fa Branch: refs/heads/wicket-4774 Commit: 2ddf76fab2b4b4a4ff79af18d10638e01b243adb Parents: b11bb19 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Thu May 2 20:56:56 2013 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Thu May 2 20:56:56 2013 +0200 ---------------------------------------------------------------------- .../wicket/ajax/attributes/ThrottlingSettings.java | 28 ++++++++++---- 1 files changed, 20 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/2ddf76fa/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 a737cfe..df830da 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 @@ -17,6 +17,7 @@ package org.apache.wicket.ajax.attributes; import org.apache.wicket.util.io.IClusterable; +import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Duration; /** @@ -28,9 +29,9 @@ public class ThrottlingSettings implements IClusterable { private static final long serialVersionUID = 1L; - private final Duration delay; + private Duration delay; private final String id; - private final boolean postponeTimerOnUpdate; + private boolean postponeTimerOnUpdate; /** * Construct. @@ -47,24 +48,29 @@ public class ThrottlingSettings implements IClusterable * Construct. * * @param id throttle id - * @param delay throttle delay + * @param delay the amount of time the action should be postponed * @param postponeTimerOnUpdate postpone timer */ public ThrottlingSettings(final String id, final Duration delay, final boolean postponeTimerOnUpdate) { - this.id = id; - this.delay = delay; + this.id = Args.notNull(id, "id"); + this.delay = Args.notNull(delay, "delay"); this.postponeTimerOnUpdate = postponeTimerOnUpdate; } /** - * @return throttle delay + * @return the amount of time the action should be postponed */ public Duration getDelay() { return delay; } + public void setDelay(Duration delay) + { + this.delay = Args.notNull(delay, "delay"); + } + /** * @return throttle id */ @@ -76,10 +82,16 @@ 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 *last* call to throttle. If the parameter is not set, or set to false, + * 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() { return postponeTimerOnUpdate; } -} \ No newline at end of file + + public void setPostponeTimerOnUpdate(boolean postponeTimerOnUpdate) + { + this.postponeTimerOnUpdate = postponeTimerOnUpdate; + } + +}
