From my earlier email:
To do that, we have a couple of things to tackle:
1) Validators are currently server side all-the-way. But they don't
have to be imho. If you combine a behavior and validator, you can
create a validator that checks on the server side (imo, *always* do
that, even if you have the client side covered well) and additionally
write out some client side validation script.
So, it's not directly related to solving hiberate validation
integration, but I think this is a good time to look at how we can
improve validation overall. Also, you were already adding a behavior,
and this triggered me to look for a more generic solution. Doesn't
have to let you hold back though. I think I can commit something in a
few hours. Then if you want, Bruno and you can decide to pick this up
or not.
The second point I was making is more useful for this case. You need
enough tools to introspect on models for your validation needs. Like I
said before, I don't think I agree with using a behavior for
validation. It might work well, especialy as the behavior(s) can add
additional validators etc, but compared to just having one validator
(on the form, which is the main case I'm thinking about), it's a lot
more state for the same result.
Eelco
On 5/9/07, Ryan Sonnek <[EMAIL PROTECTED]> wrote:
I'm a little confused on how these changes would impact the hibernate
integration. anyone care to spell out how this changes the code?
On 5/9/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> Sounds good to me.
>
> Eelco
>
> On 5/9/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > what about making iformvalidator extend ivalidator. and ibehaviorprovider
> > extend ivalidator.
> >
> > in formvalidator validatable.value can be form.modelobject() and
> > validatable.error reports an error on form.
> >
> > -igor
> >
> >
> > On 5/9/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > >
> > > > no. dont forget that the idea of IValidator is to be decoupled from
> > > wicket,
> > > > to allow the reuse of validators in service layer. i do that all the
> > > time
> > > > now and it rocks! my service layer and my ui layer are validated by the
> > > same
> > > > code. adding ivalidator.getbehavior() will break all that nice
> > > decoupling.
> > > >
> > > > i always thought that something like this would work
> > > >
> > > > IClientSideValidator extends IValidator { /** rerturn a js func to
> > > validate
> > > > the value */ CharSequence getValidationScript(); }
> > >
> > > /**
> > > * Validator that provides a behavior, e.g. for rendering client-side or
> > > ajax
> > > * validation. This interface can be implemented by either
> > > * [EMAIL PROTECTED] IValidator validators} or [EMAIL PROTECTED]
IFormValidator form validators}.
> > > */
> > > public interface IBehaviorProvider extends IClusterable
> > > {
> > > /**
> > > * Gets behavior for validation.
> > > *
> > > * @param component
> > > * component currently using the validator
> > > * @return The behavior, which can be used for rendering e.g.
> > > */
> > > IBehavior getValidationBehavior(Component component);
> > > }
> > >
> > > same here, instanceof check and ready. Not extra code as how to
> > > interpret it, and all the flexibility that behaviors provide.
> > >
> > > Eelco
> > >
> >
>