Author: jcompagner
Date: Mon Sep 14 10:39:46 2009
New Revision: 814568

URL: http://svn.apache.org/viewvc?rev=814568&view=rev
Log:
throttle delay in the settings instead of hardcoded in the js file

Modified:
    
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
    
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java
    
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js

Modified: 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java?rev=814568&r1=814567&r2=814568&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
 Mon Sep 14 10:39:46 2009
@@ -84,6 +84,7 @@
                sb.append(",adjustInputWidth: 
").append(settings.isAdjustInputWidth());
                sb.append(",showListOnEmptyInput: 
").append(settings.getShowListOnEmptyInput());
                sb.append(",showListOnFocusGain: 
").append(settings.getShowListOnFocusGain());
+               sb.append(",throttleDelay: 
").append(settings.getThrottleDelay());
                sb.append(",showCompleteListOnFocusGain: ").append(
                        settings.getShowCompleteListOnFocusGain());
                if (settings.getCssClassName() != null)

Modified: 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java?rev=814568&r1=814567&r2=814568&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java
 Mon Sep 14 10:39:46 2009
@@ -63,6 +63,8 @@
 
        private boolean showCompleteListOnFocusGain = false;
 
+       private int throttleDelay = 300;
+
        /**
         * Indicates whether the first item in the list is automatically 
selected when the autocomplete
         * list is shown.
@@ -90,6 +92,29 @@
        }
 
        /**
+        * set the throttle delay how long the browser will wait before sending 
a request to the browser
+        * after the user released a key.
+        * 
+        * @param throttleDelay
+        *            The delay in milliseconds.
+        */
+       public void setThrottleDelay(int throttleDelay)
+       {
+               this.throttleDelay = throttleDelay;
+       }
+
+       /**
+        * get the throttle delay how long the browser will wait before sending 
a request to the browser
+        * after the user released a key.
+        * 
+        * @return the throttle delay in milliseconds (default 300)
+        */
+       public int getThrottleDelay()
+       {
+               return throttleDelay;
+       }
+
+       /**
         * Gets the maximum height of the autocomplete list in pixels. 
<code>-1</code> indicates that
         * the autocomplete list should have no maximum height.
         * 

Modified: 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js?rev=814568&r1=814567&r2=814568&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 Mon Sep 14 10:39:46 2009
@@ -59,7 +59,7 @@
        // holds a throttler, for not sending many requests if the user types
        // too quickly.
        var localThrottler = new Wicket.Throttler(true);
-       var throttleDelay = 300;
+       var throttleDelay = cfg.throttleDelay;
 
     function initialize(){
                // Remove the autocompletion menu if still present from


Reply via email to