Hello All,
I am also having a problem with custom converter, convertToString method is
never called.
Thanks
igor.vaynberg wrote:
>
> afik ddcs dont use converters because they use a choice renderer.
> see ddc.setchoicerenderer();
> -igor
>
>
> On 8/13/07, Benjamin Ernst <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I implemented a custom Converter. It looks like this:
>>
>> public class AnredeConverter implements IConverter {
>>
>> public Object convertToObject(String arg0, Locale arg1) {
>> if(arg0 == null) return null;
>> return Anrede.fromString(arg0);
>> }
>>
>> public String convertToString(Object obj, Locale locale) {
>> Anrede an = (Anrede) obj;
>> return an.getValue();
>> }
>> }
>>
>>
>> The I added it to the apllication:
>>
>> @Override
>> protected IConverterLocator newConverterLocator() {
>> ConverterLocator converterLocator = new ConverterLocator();
>> converterLocator.set(Anrede.class, new AnredeConverter());
>> return converterLocator;
>> }
>>
>> I use it for a DropDownChoice
>>
>> DropDownChoice anrede = new DropDownChoice("anrede", new
>> PropertyModel(ma,
>> "anrede"), Anrede.literals());
>> add(anrede);
>>
>> My problem is that the convertToString-Method is never called, so that
>> the
>> DropDownChoice is not set to the right value.The convertToObject-Method
>> works fine.
>>
>> How can I tell the DropDownChoice to use the Converter to get the right
>> value.
>>
>> Thanks in advance,
>> Benjamin
>>
>
>
--
View this message in context:
http://www.nabble.com/convertToString-in-custom-Converter-is-not-called-tf4260835.html#a13847626
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]