summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src/ch/asynk
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-09-26 10:44:41 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-09-26 10:44:41 +0200
commitd7f316ef205ac5617bd9ac6473ee6a1f563896c2 (patch)
tree1c6d0414f5d5ebf323d5f4c3cadd693a6524b8c9 /vaadin-app/src/ch/asynk
parentac74040841dfafac499d6ac71579630d7415047c (diff)
downloadskeletons-d7f316ef205ac5617bd9ac6473ee6a1f563896c2.zip
skeletons-d7f316ef205ac5617bd9ac6473ee6a1f563896c2.tar.gz
vaadin-app: use Property.ValueChangeListener
Diffstat (limited to 'vaadin-app/src/ch/asynk')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java44
1 files changed, 39 insertions, 5 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
index 9a4ecf0..8abd99d 100644
--- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
+++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
@@ -4,11 +4,45 @@ import java.util.Date;
import com.vaadin.Application;
import com.vaadin.terminal.UserError;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.ui.FormLayout;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Label;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.TextField;
+
+class DataMappingLayout extends FormLayout {
+
+ public DataMappingLayout() {
+ //
+ final TextField tf1 = new TextField("Property.ValueChangeListener");
+ tf1.setImmediate(true);
+ addComponent(tf1);
+ final Label lb1 = new Label();
+ lb1.setCaption("The Value");
+ addComponent(lb1);
+ tf1.addListener( new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ String value = (String) tf1.getValue();
+ lb1.setValue(value);
+ }
+ });
+ //
+ Button closeButton = new Button("close the application");
+ closeButton.setDescription("This will close the application");
+ addComponent(closeButton );
+ closeButton.addListener( new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getApplication().getMainWindow().getApplication().close();
+ }
+ });
+ }
+}
class MainLayout extends VerticalLayout {
@@ -24,13 +58,13 @@ class MainLayout extends VerticalLayout {
}
}));
//
- Button closeButton = new Button("close the application");
- closeButton.setDescription("This will close the application");
- addComponent(closeButton );
- closeButton.addListener( new Button.ClickListener() {
+ Button nextButton = new Button("next layout");
+ nextButton.setDescription("Go to next layout");
+ addComponent(nextButton );
+ nextButton.addListener( new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- getApplication().getMainWindow().getApplication().close();
+ getApplication().getMainWindow().setContent( new DataMappingLayout() );
}
});
}