From 8aa1929613aae88b2669cd764bad3e2400290f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 26 Sep 2011 15:26:42 +0200 Subject: vaadin-app: add EndLayout --- .../src/ch/asynk/helloworld/HelloWorldApp.java | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java index ec7ac94..19f9fbd 100644 --- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java +++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java @@ -25,6 +25,26 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.TextField; import com.vaadin.ui.AbstractComponent; +class EndLayout extends VerticalLayout { + + public EndLayout() { + // + final Label lb1 = new Label(); + lb1.setCaption("That's all folks"); + addComponent(lb1); + // + 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 DataMappingLayout extends FormLayout { public DataMappingLayout() { @@ -140,13 +160,13 @@ class DataMappingLayout extends FormLayout { }); addComponent(tf4); // - 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("end layout"); + nextButton.setDescription("Go to end layout"); + addComponent(nextButton ); + nextButton.addListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - getApplication().getMainWindow().getApplication().close(); + getApplication().getMainWindow().setContent( new EndLayout() ); } }); } -- cgit v1.1-2-g2b99