Updated Branches:
  refs/heads/master 330e655e6 -> 8efe82075

WICKET-3367
Rewrite all JavaScript inline event handlers to be proper attached event 
handlers

Implement throttling of Ajax calls with the new AjaxRequestAttributes


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

Branch: refs/heads/master
Commit: 8efe8207589fbaea93f54cfae97d6512d2677953
Parents: 330e655
Author: martin-g <[email protected]>
Authored: Tue Jan 3 17:08:11 2012 +0200
Committer: martin-g <[email protected]>
Committed: Tue Jan 3 17:08:11 2012 +0200

----------------------------------------------------------------------
 .../ajax/form/AjaxFormValidatingBehavior.java      |   21 +++++++++++---
 1 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/8efe8207/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java
 
b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java
index 9eae9d9..20a4d25 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java
@@ -18,6 +18,8 @@ package org.apache.wicket.ajax.form;
 
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.ajax.attributes.ThrottlingSettings;
 import org.apache.wicket.feedback.IFeedback;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.FormComponent;
@@ -114,11 +116,20 @@ public class AjaxFormValidatingBehavior extends 
AjaxFormSubmitBehavior
                        @Override
                        public void component(final Component component, final 
IVisit<Void> visit)
                        {
-                               AjaxFormValidatingBehavior behavior = new 
AjaxFormValidatingBehavior(form, event);
-                               if (throttleDelay != null)
-                               {
-                                       
behavior.setThrottleDelay(throttleDelay);
-                               }
+                               AjaxFormValidatingBehavior behavior = new 
AjaxFormValidatingBehavior(form, event) {
+                                       @Override
+                                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes)
+                                       {
+                                               
super.updateAjaxAttributes(attributes);
+
+                                               if (throttleDelay != null)
+                                               {
+                                                       String id = "throttle-" 
+ component.getMarkupId();
+                                                       ThrottlingSettings 
throttlingSettings = new ThrottlingSettings(id, throttleDelay);
+                                                       
attributes.setThrottlingSettings(throttlingSettings);
+                                               }
+                                       }
+                               };
                                component.add(behavior);
                                visit.dontGoDeeper();
                        }

Reply via email to