diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-09-26 10:42:04 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-09-26 10:42:04 +0200 |
commit | ac74040841dfafac499d6ac71579630d7415047c (patch) | |
tree | 59ed53d85516e6c5b6a9f5f5430c43abf5136fef /vaadin-app/src/ch | |
parent | 366703522be6b533383c1b330c1e5f8ccd1ded66 (diff) | |
download | skeletons-ac74040841dfafac499d6ac71579630d7415047c.zip skeletons-ac74040841dfafac499d6ac71579630d7415047c.tar.gz |
vaadin-app: extend VerticalLayout
Diffstat (limited to 'vaadin-app/src/ch')
-rw-r--r-- | vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java index 17deb07..9a4ecf0 100644 --- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java +++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java @@ -4,40 +4,47 @@ import java.util.Date; import com.vaadin.Application; import com.vaadin.terminal.UserError; +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; +class MainLayout extends VerticalLayout { -public class HelloWorldApp extends Application { - - private static final long serialVersionUID = 1L; - - @Override - public void init() { - final Window mainWindow = new Window("Hello World Application"); + public MainLayout() { Label label = new Label("Hello world"); - mainWindow.addComponent(label); + addComponent(label); // - mainWindow.addComponent( new Button("What is the time?", new Button.ClickListener() { + addComponent( new Button("What is the time?", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - mainWindow.showNotification("The time is " + new Date(), "<i>italic</i> <b>bold</b> description",Window.Notification.TYPE_WARNING_MESSAGE); + getApplication().getMainWindow().showNotification("The time is " + new Date(), "<i>italic</i> <b>bold</b> description",Window.Notification.TYPE_WARNING_MESSAGE); event.getButton().setComponentError( new UserError("Stop pressing this button !!") ); } })); // Button closeButton = new Button("close the application"); closeButton.setDescription("This will close the application"); - mainWindow.addComponent(closeButton ); + addComponent(closeButton ); closeButton.addListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { - getMainWindow().getApplication().close(); + getApplication().getMainWindow().getApplication().close(); } }); - // + } + +} + +public class HelloWorldApp extends Application { + + private static final long serialVersionUID = 1L; + + @Override + public void init() { + final Window mainWindow = new Window("Hello World Application"); + mainWindow.setContent( new MainLayout() ); setMainWindow(mainWindow); setLogoutURL("http://asynk.ch"); } |