Author: jcompagner
Date: Tue Aug 26 01:29:32 2008
New Revision: 688992

URL: http://svn.apache.org/viewvc?rev=688992&view=rev
Log:
showListOnFocusGained setting

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

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/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.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java?rev=688992&r1=688991&r2=688992&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
 Tue Aug 26 01:29:32 2008
@@ -73,6 +73,7 @@
         sb.append(",maxHeight: ").append(settings.getMaxHeightInPx());
         sb.append(",adjustInputWidth: ").append(settings.isAdjustInputWidth());
         sb.append(",showListOnEmptyInput: 
").append(settings.getShowListOnEmptyInput());
+        sb.append(",showListOnFocusGain: 
").append(settings.getShowListOnFocusGain());
         if(settings.getCssClassName() != null)
             sb.append(",className: 
'").append(settings.getCssClassName()).append('\'');
         sb.append('}');

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/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.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java?rev=688992&r1=688991&r2=688992&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteSettings.java
 Tue Aug 26 01:29:32 2008
@@ -57,6 +57,8 @@
     private String cssClassName = null;
 
     private boolean adjustInputWidth = true;
+    
+    private boolean showListOnFocusGain = false;
 
   /**
         * Indicates whether the first item in the list is automatically 
selected when the autocomplete
@@ -188,4 +190,25 @@
     {
         this.adjustInputWidth = adjustInputWidth;
     }
-}
\ No newline at end of file
+    
+    /**
+        * Indicates whether the autocomplete list will be shown when the input 
field receives focus.
+        * 
+        * @return true if the autocomplete list will be shown when the input 
field receives focus, false
+        *         otherwise
+        */
+    public boolean getShowListOnFocusGain()
+    {
+        return this.showListOnFocusGain;
+    }
+    
+    /**
+        * Sets whether the list should be shown when the input field receives 
focus.
+        * 
+        * @param showListOnEmptyInput the flag
+        */
+    public void setShowListOnFocusGain(final boolean showListOnFocusGain)
+    {
+        this.showListOnFocusGain = showListOnFocusGain;
+    }
+}

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/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.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js?rev=688992&r1=688991&r2=688992&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 Tue Aug 26 01:29:32 2008
@@ -52,6 +52,7 @@
        var objonkeypress;
        var objonchange;
        var objonchangeoriginal;
+       var objonfocus;
        
        // holds the eventual margins, padding, etc. of the menu container.
        // it is computed when the menu is first rendered, and then reused.
@@ -78,6 +79,7 @@
         objonblur=obj.onblur;
         objonkeyup=obj.onkeyup;
         objonkeypress=obj.onkeypress;
+        objonfocus = obj.onfocus;
         
         // WICKET-1280
         objonchangeoriginal=obj.onchange; 
@@ -174,6 +176,12 @@
             }
                        if(typeof 
objonkeypress=="function")objonkeypress(event);
         }
+
+        obj.onfocus=function(event){
+            if (cfg.showListOnFocusGain)
+                updateChoices();
+            if(typeof objonfocus=="function")objonfocus();             
+        }
     }
 
     function handleSelection(input) {


Reply via email to