You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Malte Neumann <ma...@googlemail.com> on 2013/09/07 20:42:58 UTC
Custom Component Converter not called
Hello!
I've got a problem with a TextField and the depending CustomConverter.
The converter of the component is not been called. So the default
converter takes the task and fails.
In my case this problem occurs when my IModel.getObject returns null.
The problem arises in the FormComponent.convertInput method. Because of
the null value, the typeName is null and a generic typcast is made and
fails. Shouldn't there be a pre-examination wheter a component converter
is available?
If I explicitly set a type through TextField.setType my converter is
called correctly.
Is that behaviour intended this way?
Malte
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Custom Component Converter not called
Posted by Malte Neumann <ma...@googlemail.com>.
Am 07.09.2013 22:19, schrieb Sven Meier:
> if you don't specify the type, a TextField will try to resolve the
> type from its model, see AbstractTextComponent#resolveType() and
> IObjectClassAwareModel.
Thanks for this hint.
During further tests after my mail, I found a situtation where the
convertToString is called, but not the convertToObject. The initial
situation is the same as described in the first mail. Then the model is
updated by an ajax-call from null to a value, the output call my
ToString-Method, but a later form submit doesn't call the
ToObject-Method. It seems the problem occurs in
AbstractTextComponent.resolveType. This function tries only once to
resolve the type. In the first call the function sets type to null.
This is not my problem anymore. I can solve my special problem with the
IObjectClassAwareModel.
Malte
>
> >Shouldn't there be a pre-examination wheter a component converter is
> available?
>
> Without type there can't be a converter.
>
> Sven
>
> On 09/07/2013 08:42 PM, Malte Neumann wrote:
>> Hello!
>>
>> I've got a problem with a TextField and the depending
>> CustomConverter. The converter of the component is not been called.
>> So the default converter takes the task and fails.
>>
>> In my case this problem occurs when my IModel.getObject returns null.
>>
>> The problem arises in the FormComponent.convertInput method. Because
>> of the null value, the typeName is null and a generic typcast is made
>> and fails. Shouldn't there be a pre-examination wheter a component
>> converter is available?
>>
>> If I explicitly set a type through TextField.setType my converter is
>> called correctly.
>>
>> Is that behaviour intended this way?
>>
>> Malte
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Custom Component Converter not called
Posted by Sven Meier <sv...@meiers.net>.
Hi,
if you don't specify the type, a TextField will try to resolve the type
from its model, see AbstractTextComponent#resolveType() and
IObjectClassAwareModel.
>Shouldn't there be a pre-examination wheter a component converter is
available?
Without type there can't be a converter.
Sven
On 09/07/2013 08:42 PM, Malte Neumann wrote:
> Hello!
>
> I've got a problem with a TextField and the depending CustomConverter.
> The converter of the component is not been called. So the default
> converter takes the task and fails.
>
> In my case this problem occurs when my IModel.getObject returns null.
>
> The problem arises in the FormComponent.convertInput method. Because
> of the null value, the typeName is null and a generic typcast is made
> and fails. Shouldn't there be a pre-examination wheter a component
> converter is available?
>
> If I explicitly set a type through TextField.setType my converter is
> called correctly.
>
> Is that behaviour intended this way?
>
> Malte
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org