but a IModel.getObjectType(Component)
A model doesn't return one thing for a text field!
think about compound models.. So you can't type the IModel itself because that doesn't help
if the model can return multiply things.
Also getModelObject().getClass() doesn't really work because when you edit for example a new Person()
object that returns for its properties all null. Then suddenly types don't work but if they have a property then
it works? That looks really inconsistent to me.
I guess if we want to support it we need getObjectType(Component) and then walk the complete class property path
But i am not a big fan of this if i think about it, the developer knows it much better upfront.
johan
On 3/15/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
but i guess if there wasnt typeerasure we wouldnt have the wildmasks...
-IgorOn 3/15/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:type erasure sucks, dont think generics can help us there. and even if there wasnt type erasure what can you do for IModel<? extends SomeClass> :)
-IgorOn 3/15/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:For Wicket 2.0 we might be helped with generics. Or we might not, as
unfortunately, there is no such thing as T.getClass() or eq is there?
Eelco
On 3/15/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> yeah, implementing the Class getObjectType(). it is nasty if the model can
> hold different types, and it is only useful for a small subset of models.
>
> if you really really really want the automatic typing why not do
> getModelObject().getClass() - prob wont work very well if you return a null,
> but you cant have everything :)
>
>
> -Igor
>
>
> On 3/15/06, Eelco Hillenius < [EMAIL PROTECTED]> wrote:
> > Implementing the getObject method to return the proper type you mean?
> > Yeah, that wouldn't be the way to go. It would only be feasible with
> > special models then, which would suck too. I guess I change my mind;
> > it's not worth the little extra convenience it might get you
> > sometimes.
> >
> > Eelco
> >
> > On 3/15/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > > yuck. i implement IModel quiet often and it would really suck to have to
> > > implement this method also eventhough it is only useful for form
> components.
> > > besides, what about models that can hold different types of objects? i
> think
> > > this is a really bad idea.
> > >
> > > -Igor
> > >
> > >
> > >
> > > On 3/15/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > >
> > > We actually considered this last year, and decided against it. Besides
> > > the argument that it is more expensive - which probably isn't as valid
> > > today due to changes in how we handle those model updates - an
> > > explicit type gives you more flexibility over which converter should
> > > be used.
> > >
> > > I'm wondering now whether we should support and/ and in a future
> > > version of Wicket. Andre, if you please add a feature request to our
> > > SF tracker, we'll consider it for Wicket 1.3
> > >
> > > Eelco
> > >
> > >
> > > On 3/15/06, Andre Matheus < [EMAIL PROTECTED]> wrote:
> > > > I agree it will effect lots of things, but in the other side every
> > > component
> > > > would have its value automatically validated to the datatype... it
> would
> > > be
> > > > nice... :-)
> > > >
> > > > ___
> > > > Andre Matheus
> > > >
> > > >
> > > > On 3/15/06, Johan Compagner < [EMAIL PROTECTED]> wrote:
> > > > > I guess we could do that somehow.
> > > > > But then we need to specify that somehow in youre IModel interface.
> > > > >
> > > > > so instead of getObject(Component) we also should have
> > > getType(Component)
> > > > > That will effect a lot of things.
> > > > >
> > > > > johan
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On 3/15/06, Andre Matheus < [EMAIL PROTECTED]> wrote:
> > > > > > Why can't wicket discover the type using reflection?
> > > > > > ___
> > > > > > Andre Matheus
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 3/14/06, Igor Vaynberg < [EMAIL PROTECTED] > wrote:
> > > > > > > also look at FormComponent.setType (Class). wicket can perform
> type
> > > > conversion from the request parameter string to the type of your model
> > > > object. if the conversion fails it generates a validation error.
> > > > > > >
> > > > > > > so TextField tf=new TextField("id", model);
> > > > > > > tf.setType (Integer.class)
> > > > > > >
> > > > > > > will only accept values that can be converted to integers
> > > > > > >
> > > > > > > for explanation on how errors are constructed try searching the
> wiki
> > > > for "validation messages"
> > > > > > >
> > > > > > > -Igor
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 3/14/06, Jonathan Cone < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > >
> > > > > > > > Hey Vincent,
> > > > > > > >
> > > > > > > > In wicket, validators can be add()ed to components like
> anything
> > > > else. For example, one way to make a textfield required without using
> the
> > > > helper class would be to do something like:
> > > > > > > > TextField tf = new TextField("id",...);
> > > > > > > > tf.add(RequiredValidator.getInstance());
> > > > > > > >
> > > > > > > > Check out the javadoc for the
> > > > wicket.markup.html.form.validation package, there are
> > > some
> > > > common validators in there and its real easy to write a custom one
> > > yourself.
> > > > I think you'll find that validation in wicket is as easy as you were
> > > > hoping.
> > > > > > > >
> > > > > > > >
> > > > > > > > ----- Original Message -----
> > > > > > > > From: Vincent Jenks
> > > > > > > > To: wicket-user@lists.sourceforge.net
> > > > > > > > Sent: Tuesday, March 14, 2006 3:52 PM
> > > > > > > > Subject: [Wicket-user] validating input
> > > > > > > >
> > > > > > > > I just built a form that has a mixture of TextField, TextArea,
> and
> > > > CheckBox components in it. I am now adding validation to get a feel
> for
> > > how
> > > > it works but am confused.
> > > > > > > >
> > > > > > > > I found that I could substitute a TextField with a
> > > RequiredTextField
> > > > and validation was *extremely* simple to setup....if you're using
> <input>
> > > > form fields. However, it doesn't appear that these helper classes
> exist
> > > for
> > > > all types of form widgets...or am I mistaken?
> > > > > > > >
> > > > > > > >
> > > > > > > > ________________________________
> > > >
> > > > > > > >
> > > > > > > > No virus found in this incoming message.
> > > > > > > > Checked by AVG Free Edition.
> > > > > > > > Version: 7.1.385 / Virus Database: 268.2.2/280 - Release Date:
> > > > 3/13/2006
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > __> > > > > > Andr� Matheus
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > __
> > > > Andr� Matheus
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> > > that extends applications into web and mobile media. Attend the live
> webcast
> > > and join the prime developer group breaking into this new coding
> territory!
> > >
> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> > that extends applications into web and mobile media. Attend the live
> webcast
> > and join the prime developer group breaking into this new coding
> territory!
> >
> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user