Hello, 

I've just found working with 1.5.6 that DropDownChoice control that it
may be not calling Converters. 

Because the model is still a string while calling to
onSelectionChanged(Provincia provincia) and it fails:

    Caused by: java.lang.ClassCastException: java.lang.String cannot be
cast to generated.Provincia

I have something like this:

DropDownChoice<Provincia> provinciaChoice=new
DropDownChoice<Provincia>("provincia",new WSProvinceModel()){
    ...
protected void onSelectionChanged(Provincia provincia) {
                if(provincia!=null)
                {
                        if(cityModel!=null)
                                
cityModel.setProvinceId(provincia.getId().toString());
                }
}

...
};


---

In the application:
    @Override
    protected IConverterLocator newConverterLocator() {
            ConverterLocator converterLocator = new ConverterLocator();
            converterLocator.set(Provincia.class, new
ProvinciaEntryConverter());
            return converterLocator;
    }


It seems that it calls converter when setting the modelObject -> So it
converts from Provincia to String. 

But it does not when doing the oposite. Getting model does not get
converted from String to provincia.

This side of the converter never gets called.

For a shake of completeness:

The rederer.

                provinciaChoice.setChoiceRenderer(new 
IChoiceRenderer<Provincia>(){

                        /**
                         * 
                         */
                        private static final long serialVersionUID = 1L;

                        @Override
                        public Object getDisplayValue(Provincia provincia) {
                                return provincia.getDescripcion();
                        }

                        @Override
                        public String getIdValue(Provincia provincia, int 
index) {
                                return String.valueOf(provincia.getId());
                        }
                });

Where is the problem?

I think that onSelectionChanged in DropDownChoice should call converter.

        /**
         * Called when a selection changes.
         */
        public final void onSelectionChanged()
        {
                convertInput();
                updateModel();
                onSelectionChanged(getModelObject());
        }






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to