and that all makes perfect sense, however at its current state the
requried/null checks are considered syntactic checks. if not then every
ivalidator out there must first perform the null check, which is annoying.

how about:

class ConstraintValidator extends ... implments IValidatorAddListener {
...
onAdded(Component c) {
   FormComponent fc=(FormComponent)c;
   fc.setRequired(isrequired());
}
}

-igor


On 6/20/07, Jan Vermeulen <[EMAIL PROTECTED]> wrote:


Let me try to explain:

First, we have a way of gathering 'constraints' for bean properties, that
are based either on validator annotations on the bean, or on a settings
environment (the beanClass & propertyPath are derived from the model of
the
formComponent). The endresult is a list of IConstraint's:

        List<IConstraint> beanConstraints = EntityUtils.getConstraints(
                ModelUtils.findBeanClass(this), ModelUtils.getPropertyPath
(this));

On initialization of the formComponent, we gather these constraints, and
if
any are available, we add a ConstraintValidator to the component for each
constraint:

        for (IConstraint constraint : beanConstraints) {
                validators.add(new ConstraintValidator(this,constraint));
        }

So after initalization, the formComponent contains a list of validator
based
on constraints defined on the property on which it works.

The rest is done by Wicket, when calling the validators in
formComponent.validate().

Jan.
--
View this message in context:
http://www.nabble.com/Problem-with-latest-changes-in-FormComponent%3Avalidate%28%29-tf3945885.html#a11209048
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Reply via email to