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 { private static final long serialVersionUID = 1L; 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(), "italic bold 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() ); } }); } }