Re: Custom Component Converter not called

2013-09-08 Thread Malte Neumann

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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




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




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



Custom Component Converter not called

2013-09-07 Thread Malte Neumann

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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Custom Component Converter not called

2013-09-07 Thread Sven Meier

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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




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