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

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

Introduction

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

Prototype

public Property(Class<?> owner, String name) 

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 ava 2  s .c o m*/
}