> is there an API in wicket to know if a Validator instance has been
added to a form?
Two solutions:
1) Call iterator() and test with instanceof IValidator on each element
until you get true. This will only find validators on the form and not
on the subcomponents...
2) Make a Component.IVisitor that checks with instanceof and call
form.visitChildren(). This has the advantage that it will detect
validators on the components.
public class HasValidatorsVisitor implements IVisitor {
private boolean hasValidator;
public boolean hasValidator() { return hasValidator; }
public Component component(Component component) {
hasValidator = hasValidator || (component instanceof
IValidator);
// Make visitor stop if we found one
return hasValidator? component : CONTINUE_TRAVERSAL;
}
}
- Tor Iver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]