summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src
diff options
context:
space:
mode:
Diffstat (limited to 'vaadin-app/src')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java29
1 files changed, 24 insertions, 5 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
index c516e55..1185f65 100644
--- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
+++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
@@ -4,6 +4,7 @@ import java.util.Date;
import com.vaadin.Application;
import com.vaadin.terminal.UserError;
+import com.vaadin.terminal.Terminal;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.ObjectProperty;
@@ -70,6 +71,15 @@ class MainLayout extends VerticalLayout {
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");
@@ -85,14 +95,23 @@ class MainLayout extends VerticalLayout {
}
public class HelloWorldApp extends Application {
+ private static final long serialVersionUID = 1L;
- private static final long serialVersionUID = 1L;
-
- @Override
- public void init() {
+ @Override
+ public void init() {
final Window mainWindow = new Window("Hello World Application");
mainWindow.setContent( new MainLayout() );
setMainWindow(mainWindow);
setLogoutURL("http://asynk.ch");
- }
+ }
+
+ @Override
+ public void terminalError(Terminal.ErrorEvent event) {
+ // Call the default implementation.
+ super.terminalError(event);
+ // Some custom behaviour.
+ if (getMainWindow() != null) {
+ getMainWindow().showNotification("An unchecked exception occured!", event.getThrowable().toString(), Window.Notification.TYPE_ERROR_MESSAGE);
+ }
+ }
}