diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-09-26 11:13:48 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-09-26 11:13:48 +0200 |
commit | bfdc9b4bab98a06dd530204e45970370ce104871 (patch) | |
tree | 920013087812e1ac45b027d39ec9c8d6855e374f /vaadin-app/src | |
parent | eeaca934a6851ea7d901a5692d81a53921ca6bb3 (diff) | |
download | skeletons-bfdc9b4bab98a06dd530204e45970370ce104871.zip skeletons-bfdc9b4bab98a06dd530204e45970370ce104871.tar.gz |
vadin-app: add a field validator
Diffstat (limited to 'vaadin-app/src')
-rw-r--r-- | vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java | 3 |
1 files changed, 3 insertions, 0 deletions
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<Double> property = new ObjectProperty<Double>(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"); |