Re: [Wicket-user] Autocomplete - selecting (higlighting)firstoption by default.

2007-05-29 Thread Eelco Hillenius
0 +80,20 @@
>
>   /**
>* @param id
> +  * @param preselect
> +  */
> + public AutoCompleteTextField(String id,boolean preselect)
> + {
> +  this(id, (IModel)null,preselect);
> +
> + }
> +
> + /**
> +  * @param id
>*/
>   public AutoCompleteTextField(String id)
>   {
> -  this(id, (IModel)null);
> +  this(id, (IModel)null,false);
>
>   }
>
> @@ -91,7 +113,7 @@
>*/
>   public AutoCompleteTextField(String id, Class type, IAutoCompleteRenderer
> renderer)
>   {
> -  this(id, null, type, renderer);
> +  this(id, null, type, renderer,false);
>   }
>
>   /**
> @@ -101,7 +123,7 @@
>*/
>   public AutoCompleteTextField(String id, IModel model,
> IAutoCompleteRenderer renderer)
>   {
> -  this(id, model, (Class)null, renderer);
> +  this(id, model, (Class)null, renderer,false);
>   }
>
>   /**
> @@ -109,8 +131,9 @@
>* @param model
>* @param type
>* @param renderer
> +  * @param preselect
>*/
> - public AutoCompleteTextField(String id, IModel model, Class type,
> IAutoCompleteRenderer renderer)
> + public AutoCompleteTextField(String id, IModel model, Class type,
> IAutoCompleteRenderer renderer,boolean preselect)
>   {
>super(id, model, type);
>
> @@ -117,7 +140,7 @@
>// this disables Firefox autocomplete
>add(new SimpleAttributeModifier("autocomplete","off"));
>
> -  add(new AutoCompleteBehavior(renderer)
> +  add(new AutoCompleteBehavior(renderer,preselect)
>{
>
> private static final long serialVersionUID = 1L;
> Index:
> C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
> ===
> ---
> C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
> (revision 541579)
> +++
> C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
> (working copy)
> @@ -7,7 +7,7 @@
>  if (typeof(Wicket) == "undefined")
>   Wicket = { };
>
> -Wicket.AutoComplete=function(elementId,callbackUrl){
> +Wicket.AutoComplete=function(elementId,callbackUrl,preselect){
>  var KEY_BACKSPACE=8;
>  var KEY_TAB=9;
>  var KEY_ENTER=13;
> @@ -167,8 +167,12 @@
>  }
>
>  function updateChoices(){
> -selected=-1;
> -
> +if(preselect==true){
> + selected = 0;
> +}
> +else{
> + selected=-1;
> +}
>  var value = wicketGet(elementId).value;
>  var request = new
> Wicket.Ajax.Request(callbackUrl+"&q="+processValue(value),
> doUpdateChoices, false, true, false, "wicket-autocomplete|d");
>  request.get();
>
>
>
>
> - Original Message -
> From: Ryan Gravener
> To: wicket-user@lists.sourceforge.net
>
> Sent: Tuesday, May 29, 2007 12:57 PM
> Subject: Re: [Wicket-user] Autocomplete - selecting (higlighting)firstoption
> by default.
>
> If you can, submit a patch.  I think most of the community would like that
> functionality.
>
>
> On 29/05/07, Dipu < [EMAIL PROTECTED]> wrote:
> >
> >
> > I agree, it will be nice to have the ability control this.
> > In my case i had to hard code it in the autocomplete js file and i had to
> rebuild the wicket extensions.
> >
> > Regards
> > Dipu
> >
> >
> >
> >
> > - Original Message -
> > From: Sean Sullivan
> > To: wicket-user@lists.sourceforge.net
> > Sent: Saturday, May 26, 2007 6:57 AM
> > Subject: Re: [Wicket-user] Autocomplete - selecting (higlighting)
> firstoption by default.
> >
> >
> >
> > IMHO, it would be nice if Java programmers could control this behavior
> with a Java API.
> >
> >
> >
> > On 5/25/07, Dipu <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > >
> > > At the moment with Wicket's auto complete list  we need to scroll down
> to select an option from the Autocomplete list.
> > > It would be nice to have the first item highlighted by default.
> > >
> > > I tried changing selected to 0 where its declared and it didn't work for
> me.
> > >
> > > On setting selected to 0 a doUpdateChoices(resp) worked,
> > >
> > > function doUpdateChoices(resp){
> > > var element = getAutocompleteMenu();
> > > element.innerHTML=resp;
> > &g

Re: [Wicket-user] Autocomplete - selecting (higlighting)firstoption by default.

2007-05-29 Thread Dipu
 model
   * @param type
   * @param renderer
+  * @param preselect 
   */
- public AutoCompleteTextField(String id, IModel model, Class type, 
IAutoCompleteRenderer renderer)
+ public AutoCompleteTextField(String id, IModel model, Class type, 
IAutoCompleteRenderer renderer,boolean preselect)
  {
   super(id, model, type);
 
@@ -117,7 +140,7 @@
   // this disables Firefox autocomplete
   add(new SimpleAttributeModifier("autocomplete","off"));
   
-  add(new AutoCompleteBehavior(renderer)
+  add(new AutoCompleteBehavior(renderer,preselect)
   {
 
private static final long serialVersionUID = 1L;
Index: 
C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
===
--- 
C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 (revision 541579)
+++ 
C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 (working copy)
@@ -7,7 +7,7 @@
 if (typeof(Wicket) == "undefined")
  Wicket = { };
 
-Wicket.AutoComplete=function(elementId,callbackUrl){
+Wicket.AutoComplete=function(elementId,callbackUrl,preselect){
 var KEY_BACKSPACE=8;
 var KEY_TAB=9;
 var KEY_ENTER=13;
@@ -167,8 +167,12 @@
 }
 
 function updateChoices(){
-selected=-1;
-
+if(preselect==true){
+ selected = 0;
+}
+else{
+ selected=-1;
+}
 var value = wicketGet(elementId).value;
 var request = new 
Wicket.Ajax.Request(callbackUrl+"&q="+processValue(value), doUpdateChoices, 
false, true, false, "wicket-autocomplete|d");
 request.get();



  - Original Message - 
  From: Ryan Gravener 
  To: wicket-user@lists.sourceforge.net 
  Sent: Tuesday, May 29, 2007 12:57 PM
  Subject: Re: [Wicket-user] Autocomplete - selecting (higlighting)firstoption 
by default.


  If you can, submit a patch.  I think most of the community would like that 
functionality.


  On 29/05/07, Dipu < [EMAIL PROTECTED]> wrote:
I agree, it will be nice to have the ability control this.
In my case i had to hard code it in the autocomplete js file and i had to 
rebuild the wicket extensions.

    Regards
Dipu


  ----- Original Message - 
      From: Sean Sullivan 
  To: wicket-user@lists.sourceforge.net 
  Sent: Saturday, May 26, 2007 6:57 AM
  Subject: Re: [Wicket-user] Autocomplete - selecting (higlighting) 
firstoption by default.



  IMHO, it would be nice if Java programmers could control this behavior 
with a Java API.


   
  On 5/25/07, Dipu <[EMAIL PROTECTED]> wrote: 


At the moment with Wicket's auto complete list  we need to scroll down 
to select an option from the Autocomplete list. 
It would be nice to have the first item highlighted by default.

I tried changing selected to 0 where its declared and it didn't work 
for me.

On setting selected to 0 a doUpdateChoices(resp) worked,

function doUpdateChoices(resp){
var element = getAutocompleteMenu();
element.innerHTML=resp;
if(element.firstChild && element.firstChild.childNodes) {
selected = 0;

Can anyone please confirm if this is the right way to go.

Regards
Dipu





--


  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/ 


--


  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now. 
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list 
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





  -- 
  Ryan Gravener
  fbb55c59d619f3cd68ac4f70ebeca372 


--


  -

Re: [Wicket-user] Autocomplete - selecting (higlighting) firstoption by default.

2007-05-29 Thread Eelco Hillenius
Yeah. Please open up a JIRA issue (feature request) for it as well.

Eelco

On 5/29/07, Ryan Gravener <[EMAIL PROTECTED]> wrote:
> If you can, submit a patch.  I think most of the community would like that
> functionality.
>
>
> On 29/05/07, Dipu < [EMAIL PROTECTED]> wrote:
> >
> >
> > I agree, it will be nice to have the ability control this.
> > In my case i had to hard code it in the autocomplete js file and i had to
> rebuild the wicket extensions.
> >
> > Regards
> > Dipu
> >
> >
> >
> >
> > - Original Message -
> > From: Sean Sullivan
> > To: wicket-user@lists.sourceforge.net
> > Sent: Saturday, May 26, 2007 6:57 AM
> > Subject: Re: [Wicket-user] Autocomplete - selecting (higlighting)
> firstoption by default.
> >
> >
> >
> > IMHO, it would be nice if Java programmers could control this behavior
> with a Java API.
> >
> >
> >
> > On 5/25/07, Dipu <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > >
> > > At the moment with Wicket's auto complete list  we need to scroll down
> to select an option from the Autocomplete list.
> > > It would be nice to have the first item highlighted by default.
> > >
> > > I tried changing selected to 0 where its declared and it didn't work for
> me.
> > >
> > > On setting selected to 0 a doUpdateChoices(resp) worked,
> > >
> > > function doUpdateChoices(resp){
> > > var element = getAutocompleteMenu();
> > > element.innerHTML=resp;
> > > if(element.firstChild && element.firstChild.childNodes) {
> > > selected = 0;
> > >
> > > Can anyone please confirm if this is the right way to go.
> > >
> > > Regards
> > > Dipu
> > >
> >
> >
> >
> > 
>
> >
> >
> -
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> >
> > 
>
> >
> > ___
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
> >
> >
> >
> >
> -
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > ___
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
>
>
> --
> Ryan Gravener
> fbb55c59d619f3cd68ac4f70ebeca372
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Autocomplete - selecting (higlighting) firstoption by default.

2007-05-29 Thread Erik van Oosten

Yes please!

other things that would be great:
-1- immediate open of the dropdown window upon entering the field
-2- control over the width of the dropdown window

I implemented -1- by adding a special class to the field 'immediateOpen' and
adapting the javascript (code available for download at 
http://day-to-day-stuff.blogspot.com/2006/10/wicket-autocompletion-improvements.html
my blok ).

I also implemented -2- with a horrible kludge. It's in the same download,
but please do not use this, its too ugly.

Regards,
Erik.



Ryan Gravener wrote:
> 
> If you can, submit a patch.  I think most of the community would like that
> functionality.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Autocomplete---selecting-%28higlighting%29-first-option-by-default.-tf3815241.html#a10852897
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Autocomplete - selecting (higlighting) firstoption by default.

2007-05-29 Thread Ryan Gravener

If you can, submit a patch.  I think most of the community would like that
functionality.

On 29/05/07, Dipu <[EMAIL PROTECTED]> wrote:


 I agree, it will be nice to have the ability control this.
In my case i had to hard code it in the autocomplete js file and i had to
rebuild the wicket extensions.

Regards
Dipu



- Original Message -
 *From:* Sean Sullivan <[EMAIL PROTECTED]>
*To:* wicket-user@lists.sourceforge.net
*Sent:* Saturday, May 26, 2007 6:57 AM
*Subject:* Re: [Wicket-user] Autocomplete - selecting (higlighting)
firstoption by default.


IMHO, it would be nice if Java programmers could control this behavior
with a Java API.



On 5/25/07, Dipu <[EMAIL PROTECTED]> wrote:
>
>
>
> At the moment with Wicket's auto complete list  we need to scroll down
> to select an option from the Autocomplete list.
> It would be nice to have the first item highlighted by default.
>
> I tried changing selected to 0 where its declared and it didn't work for
> me.
>
> On setting selected to 0 a doUpdateChoices(resp) worked,
>
> function doUpdateChoices(resp){
> var element = getAutocompleteMenu();
> element.innerHTML=resp;
> if(element.firstChild && element.firstChild.childNodes) {
> selected = 0;
>
> Can anyone please confirm if this is the right way to go.
>
> Regards
> Dipu
>
>

 --

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

--

___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Ryan Gravener
fbb55c59d619f3cd68ac4f70ebeca372
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Autocomplete - selecting (higlighting) firstoption by default.

2007-05-29 Thread Dipu
I agree, it will be nice to have the ability control this.
In my case i had to hard code it in the autocomplete js file and i had to 
rebuild the wicket extensions.

Regards
Dipu

 
  - Original Message - 
  From: Sean Sullivan 
  To: wicket-user@lists.sourceforge.net 
  Sent: Saturday, May 26, 2007 6:57 AM
  Subject: Re: [Wicket-user] Autocomplete - selecting (higlighting) firstoption 
by default.



  IMHO, it would be nice if Java programmers could control this behavior with a 
Java API.


   
  On 5/25/07, Dipu <[EMAIL PROTECTED]> wrote: 


At the moment with Wicket's auto complete list  we need to scroll down to 
select an option from the Autocomplete list. 
It would be nice to have the first item highlighted by default.

I tried changing selected to 0 where its declared and it didn't work for me.

On setting selected to 0 a doUpdateChoices(resp) worked,

function doUpdateChoices(resp){
var element = getAutocompleteMenu();
element.innerHTML=resp;
if(element.firstChild && element.firstChild.childNodes) {
selected = 0;

Can anyone please confirm if this is the right way to go.

Regards
Dipu





--


  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/


--


  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user