Example usage for org.apache.wicket.bean.validation PropertyValidator PropertyValidator

List of usage examples for org.apache.wicket.bean.validation PropertyValidator PropertyValidator

Introduction

In this page you can find the example usage for org.apache.wicket.bean.validation PropertyValidator PropertyValidator.

Prototype

public PropertyValidator(IModel<Class<?>[]> groups) 

Source Link

Usage

From source file:de.effectivetrainings.HomePage.java

public HomePage(final PageParameters parameters) {
    super(parameters);
    IModel<Trainer> trainerModel = Model.of(new Trainer());
    add(new FeedbackPanel("feedback"));
    Form<Trainer> form = new Form<Trainer>("form", new CompoundPropertyModel<Trainer>(trainerModel));
    form.add(new TextField("name").add(new PropertyValidator(new Property(Trainer.class, "name"))));
    form.add(new TextField("email").add(new PropertyValidator(new Property(Trainer.class, "email"))));
    form.add(new TextField("phone").add(new PropertyValidator(new Property(Trainer.class, "phone"))));
    form.add(new TextField("birthDay").add(new PropertyValidator(new Property(Trainer.class, "birthDay"))));
    form.add(new DropDownChoice<License>("license", Arrays.asList(License.values()))
            .add(new PropertyValidator(new Property(Trainer.class, "license"), TrainerGroupSequence.class)));
    add(form);//  w  w  w. j a v a 2s. c o  m
}