using AutoCompleteTextField in wicket without String as the generic type

Posted by Manuel on Stack Overflow See other posts from Stack Overflow or by Manuel
Published on 2011-03-07T23:17:50Z Indexed on 2011/03/08 0:10 UTC
Read the original article Hit count: 154

Hi! This question follows this: handling to onchange event of AutoCompleteTextField in wicket

I'm trying to use the AutoCompleteTextField with a custom class as the generic type, and to add an AjaxFormComponentUpdatingBehavior. What I mean is I want to have a

AutoCompleteTextField<SomeClass> myAutoComplete = ...;

and after that add a AjaxFormComponentUpdatingBehavior:

myAutoComplete.add(new AjaxFormComponentUpdatingBehavior("onchange") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            System.out.println( "Value: "+getValue() );

        }
    });

The problem is that for some reason, adding that behavior makes the form try to set the model object with a String (even though the AutoCompleteTextField has a generic type of SomeClass), causing a ClassCastException when the onchange event fires.

Is there a way to use AutoCompleteTextField without it being AutoCompleteTextField<String>? I couldn't find any example. Thanks for your time!

and thanks to the user biziclop for his help in this matter.

© Stack Overflow or respective owner

Related posts about java

Related posts about web-applications