summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src/ch/asynk/helloworld/MainLayout.java
diff options
context:
space:
mode:
Diffstat (limited to 'vaadin-app/src/ch/asynk/helloworld/MainLayout.java')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/MainLayout.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/MainLayout.java b/vaadin-app/src/ch/asynk/helloworld/MainLayout.java
new file mode 100644
index 0000000..e5e364e
--- /dev/null
+++ b/vaadin-app/src/ch/asynk/helloworld/MainLayout.java
@@ -0,0 +1,47 @@
+package ch.asynk.helloworld;
+
+
+import java.util.Date;
+
+import com.vaadin.terminal.UserError;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Window.Notification;
+
+public class MainLayout extends VerticalLayout {
+
+ public MainLayout() {
+ Label label = new Label("Hello world");
+ addComponent(label);
+ //
+ addComponent( new Button("What is the time?", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ getApplication().getMainWindow().showNotification("The time is " + new Date(), "<i>italic</i> <b>bold</b> description",Notification.TYPE_WARNING_MESSAGE);
+ event.getButton().setComponentError( new UserError("Stop pressing this button !!") );
+ }
+ }));
+ ///
+ Button exceptionButton = new Button("throw an exception");
+ addComponent(exceptionButton );
+ exceptionButton.addListener( new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ throw new RuntimeException("Wahou !! : exception");
+ }
+ });
+ //
+ 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().setContent( new DataMappingLayout() );
+ }
+ });
+ }
+
+}