On 5/10/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
Yeah, for sure. Everyone is more than welcome to help with this (and
I'll only be looking from the side line to see whether we can do more
in the core project to support this very interesting case further),
especially when you want to use it for real.
So officially Ryan and Bruno are working on this. Imho (as a lover of
anarchy) it works great to see a couple of competing implementations
in the same project so that we can grow to the best solution from
there. But that's all up to you guys. :)
I'm not sure I'll have time to help much, at least for the moment. But if my
choice about validation goes to hibernate validator, I'll be a good
candidate at least to provide some testing :-)
Xavier
Eelco
On 5/10/07, Xavier Hanin <[EMAIL PROTECTED]> wrote:
> On 5/10/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> >
> > > > Similarly, the Length element can and probably should be using a
> > > > StringValidator for a TextField and not setting maxlength. Maybe
it
> > > > should do both. ;-)
> > > I've thought about using validators here and "ideally" would use a
> > > StringValidatorWithBehavior that would automatically attach the
markup
> > > attributes. any thoughts?
> >
> > Yeah, something like that is now possible:
> >
> > private static class MaxLengthValidator extends
> > StringValidator.MaximumLengthValidator
> > implements
> > IBehaviorProvider
> > {
> > public MaxLengthValidator(int maximum)
> > {
> > super(maximum);
> > }
> >
> > /**
> > * @see
> > org.apache.wicket.validation.IBehaviorProvider#newValidationBehavior(
> > org.apache.wicket.Component)
> > */
> > public IBehavior newValidationBehavior(Component
> > component)
> > {
> > if (component instanceof
AbstractTextComponent)
> > {
> > return new
> > SimpleAttributeModifier("maxlength",
> > String.valueOf(getMaximum()));
> > }
> > return null;
> > }
> > }
> >
> > The API still is to be reviewed and tweaked, but this is the basic
idea.
> >
> > > > It strikes me we probably need a:
> > > >
> > > > Hibernate Validator Attribute + Component type -> Validator
mapping
> > > >
> > > > ...because what sort of validator you want to use will be
dependent on
> > > > the component type.
> > >
> > > I actually think I would like to create a application component
> > > listener for this (similar to the SpringBean component listener) so
> > > that an entire application will "just work" and you don't have to
> > > worry about manually adding validators at all. thoughts?
> > > Ryan
> >
> > That's an interesting idea; might work out pretty cool. Best thing
> > again is to create a first pass and see how it works.
> >
> > Any plans for creating an example application for this? If you ever
> > want this to get a good ammount of traction, it needs one.
>
>
> I still have to make further investigation but I think I'd be interested
in
> this implementation too. I'm working on an open source project which is
> still in very early stage, but if we use this Hibernate Validator
> integration it may be an option to show some part of the app as a real
live
> example. The drawback is that real live app is often much more difficult
to
> understand in a few minutes than an example app developed only for
showcase
> purpose, but I thought you might be interested in this.
>
> If you are interested, I'll keep you informed depending on my
investigation
> and my progress.
>
> Xavier
>
> Eelco
> >
>
>
>
> --
> Xavier Hanin - Independent Java Consultant
> Manage your dependencies with Ivy!
> http://incubator.apache.org/ivy/
>
--
Xavier Hanin - Independent Java Consultant
Manage your dependencies with Ivy!
http://incubator.apache.org/ivy/