diff options
-rw-r--r-- | vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java | 44 |
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() ); } }); } |