On Tue, 2006-08-08 at 08:36 -0700, Igor Vaynberg wrote:
> this only solves it partially though - added formvalidators are still
> going to be a problem for removed items - not sure about the best
> approach right now - we might have to open more api or make validation
> smarter - lets discuss this some more. 

I think the problem is that IFormValidators are pushed to a Form.
Pushing things do not work well when using pull models. What if Form
would pull FormValidators instead:

public Form extends WebMarkupContainer implements IFormSubmitListener 

    protected List<IFormValidator> formValidators() 
        List<IFormValidator> formValidators = new
        visitChildren(IFormValidatorProvider.class, new IVisitor()
                public Object component(final Component component)
                    IFormValidatorProvider provider =
(IFormValidatorProvider) component;
                    return CONTINUE_TRAVERSAL;

        return formValidators;

public interface IFormValidatorProvider 
    Collection<IFormValidator> formValidators();

This would allow IFormValidators to be encapsulated with components.

public DateRangePicker extends Panel implements IFormValidatorProvider 
    public DateRangePicker(String id) 
        start = new DateRange("start");
        end = new DateRange("end");

    public Collection<IFormValidator> formValidators() 
        return Arrays.asList(new DateRangePickerValidator(start, end));

    private class DateRangePickerValidator implements IFormValidator 
        public DateRangeFieldValidator(DatePicker start, DatePicker

This would also be more flexible than the current way since the decision
about whether to include a certain IFormValidator can be done at
onSubmit() phase.

Any comments?


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Wicket-user mailing list

Reply via email to