Johan Compagner wrote:
this constructor can be deleted yes:
public TextField(final String id, final Class type)
{
super(id);
setType(type);
}
but i don't know about this one:
public TextField(final String id, IModel model, Class type)
{
super(id, model);
setType(type);
}
because if you don't use the propertymodel here then that type is pretty
needed
But you can just call setType() yourself, which is the whole point of
this thread, I thought? (Note that we can possibly improve this further
with generic models in the future, as they are effectively like an
IObjectClassAwareModel.)
And bigger problem here, if you override
public IConverter getConverter(Class type)
and you don't set the type then that converter isn't used.
This sucks. It's totally counter-intuitive.
In my opinion, if you override getConverter() then it should always be
used, even if that means we have to call it with a null type parameter.
(Normally when you're overriding it for a particular component you don't
care about the type parameter anyway).
I did a live demo at the last London Wicket event where I temporarily
overlooked this and couldn't make it work, which was silly of me. Just
goes to show it's not obvious, though. ;-)
Regards,
Al
--
Alastair Maw
Wicket-biased blog at http://herebebeasties.com