summaryrefslogtreecommitdiffstats
path: root/vaadin-app
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-09-26 11:13:48 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-09-26 11:13:48 +0200
commitbfdc9b4bab98a06dd530204e45970370ce104871 (patch)
tree920013087812e1ac45b027d39ec9c8d6855e374f /vaadin-app
parenteeaca934a6851ea7d901a5692d81a53921ca6bb3 (diff)
downloadskeletons-bfdc9b4bab98a06dd530204e45970370ce104871.zip
skeletons-bfdc9b4bab98a06dd530204e45970370ce104871.tar.gz
vadin-app: add a field validator
Diffstat (limited to 'vaadin-app')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java3
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");