summaryrefslogtreecommitdiffstats
path: root/vaadin-app/src/ch/asynk/helloworld
diff options
context:
space:
mode:
Diffstat (limited to 'vaadin-app/src/ch/asynk/helloworld')
-rw-r--r--vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
index 1185f65..3dfe515 100644
--- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
+++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java
@@ -5,6 +5,12 @@ import java.util.Date;
import com.vaadin.Application;
import com.vaadin.terminal.UserError;
import com.vaadin.terminal.Terminal;
+import com.vaadin.terminal.SystemError;
+import com.vaadin.terminal.ErrorMessage;
+import com.vaadin.terminal.VariableOwner;
+import com.vaadin.terminal.URIHandler;
+import com.vaadin.terminal.ParameterHandler;
+import com.vaadin.terminal.gwt.server.ChangeVariablesErrorEvent;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.ObjectProperty;
@@ -16,6 +22,7 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.AbstractComponent;
class DataMappingLayout extends FormLayout {
@@ -108,7 +115,27 @@ public class HelloWorldApp extends Application {
@Override
public void terminalError(Terminal.ErrorEvent event) {
// Call the default implementation.
- super.terminalError(event);
+ //super.terminalError(event);
+ // http://dev.vaadin.com/browser/releases/6.6.6/src/com/vaadin/Application.java#L1190
+ final Throwable t = event.getThrowable();
+ Object owner = null;
+ if (event instanceof VariableOwner.ErrorEvent) {
+ owner = ((VariableOwner.ErrorEvent) event).getVariableOwner();
+ } else if (event instanceof URIHandler.ErrorEvent) {
+ owner = ((URIHandler.ErrorEvent) event).getURIHandler();
+ } else if (event instanceof ParameterHandler.ErrorEvent) {
+ owner = ((ParameterHandler.ErrorEvent) event).getParameterHandler();
+ } else if (event instanceof ChangeVariablesErrorEvent) {
+ owner = ((ChangeVariablesErrorEvent) event).getComponent();
+ }
+ if (owner instanceof AbstractComponent) {
+ if (t instanceof ErrorMessage) {
+ ((AbstractComponent) owner).setComponentError((ErrorMessage)t);
+ } else {
+ //((AbstractComponent) owner).setComponentError(new SystemError(t));
+ ((AbstractComponent) owner).setComponentError(new UserError("User Error!"));
+ }
+ }
// Some custom behaviour.
if (getMainWindow() != null) {
getMainWindow().showNotification("An unchecked exception occured!", event.getThrowable().toString(), Window.Notification.TYPE_ERROR_MESSAGE);