From bfdc9b4bab98a06dd530204e45970370ce104871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 26 Sep 2011 11:13:48 +0200 Subject: vadin-app: add a field validator --- vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java index cb9a029..c516e55 100644 --- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java +++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java @@ -7,6 +7,7 @@ import com.vaadin.terminal.UserError; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.ObjectProperty; +import com.vaadin.data.validator.DoubleValidator; import com.vaadin.ui.FormLayout; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; @@ -37,6 +38,8 @@ class DataMappingLayout extends FormLayout { final ObjectProperty property = new ObjectProperty(trouble); final TextField tf2 = new TextField("ObjectProperty", property); tf2.setImmediate(true); + tf2.addValidator( new DoubleValidator("It should be a double") ); + //tf2.setValidationVisible(false); // nothing will happen addComponent(tf2); final Label lb2 = new Label(property); lb2.setCaption("The Value"); -- cgit v1.1-2-g2b99