aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2008-08-25 05:59:54 +0000
committerArtur Signell <artur.signell@itmill.com>2008-08-25 05:59:54 +0000
commit3a6e5a11210f1560a3b14b29803eac5386dacf98 (patch)
tree72369e0df2eb2ccf9d27194c980ee9f9b8607a3d /src
parent728f60409e3ca3dd8f85fff714b972cbd474b665 (diff)
downloadvaadin-framework-3a6e5a11210f1560a3b14b29803eac5386dacf98.tar.gz
vaadin-framework-3a6e5a11210f1560a3b14b29803eac5386dacf98.zip
Made #1642 fix more generic by moving implementation to AbstractComponent
svn changeset:5250/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/Application.java12
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java2
-rw-r--r--src/com/itmill/toolkit/ui/AbstractComponent.java52
-rw-r--r--src/com/itmill/toolkit/ui/AbstractField.java52
4 files changed, 61 insertions, 57 deletions
diff --git a/src/com/itmill/toolkit/Application.java b/src/com/itmill/toolkit/Application.java
index 1196891014..d2067b32ff 100644
--- a/src/com/itmill/toolkit/Application.java
+++ b/src/com/itmill/toolkit/Application.java
@@ -1088,10 +1088,7 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
System.err
.println("Warning: SocketException in CommunicationManager."
+ " Most likely client (browser) closed socket.");
-
- } else {
- // throw it to standard error stream too
- t.printStackTrace();
+ return;
}
// Finds the original source of the error/exception
@@ -1115,6 +1112,13 @@ public abstract class Application implements URIHandler, Terminal.ErrorListener
((AbstractComponent) owner)
.setComponentError(new SystemError(e));
}
+ } else {
+ /*
+ * Can't show it to the user in any way so we print to standard
+ * error
+ */
+ t.printStackTrace();
+
}
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java b/src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java
index 08182b7155..76bd1822c0 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java
@@ -3,7 +3,7 @@ package com.itmill.toolkit.terminal.gwt.server;
import java.util.Map;
import com.itmill.toolkit.ui.Component;
-import com.itmill.toolkit.ui.AbstractField.ComponentErrorEvent;
+import com.itmill.toolkit.ui.AbstractComponent.ComponentErrorEvent;
public class ChangeVariablesErrorEvent implements ComponentErrorEvent {
diff --git a/src/com/itmill/toolkit/ui/AbstractComponent.java b/src/com/itmill/toolkit/ui/AbstractComponent.java
index 83502aa40c..634f58dbac 100644
--- a/src/com/itmill/toolkit/ui/AbstractComponent.java
+++ b/src/com/itmill/toolkit/ui/AbstractComponent.java
@@ -19,6 +19,7 @@ import com.itmill.toolkit.terminal.ErrorMessage;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
import com.itmill.toolkit.terminal.Resource;
+import com.itmill.toolkit.terminal.Terminal;
/**
* An abstract class that defines default implementation for the
@@ -121,6 +122,8 @@ public abstract class AbstractComponent implements Component, MethodEventSource
private int widthUnit = UNITS_PIXELS;
private int heightUnit = UNITS_PIXELS;
+ private ComponentErrorHandler errorHandler = null;
+
/* Constructor */
/**
@@ -1170,4 +1173,53 @@ public abstract class AbstractComponent implements Component, MethodEventSource
return values;
}
+ public interface ComponentErrorEvent extends Terminal.ErrorEvent {
+ }
+
+ public interface ComponentErrorHandler {
+ /**
+ * Handle the component error
+ *
+ * @param event
+ * @return True if the error has been handled False, otherwise
+ */
+ public boolean handleComponentError(ComponentErrorEvent event);
+ }
+
+ /**
+ * Gets the error handler for the component.
+ *
+ * The error handler is dispatched whenever there is an error processing the
+ * data coming from the client.
+ *
+ * @return
+ */
+ public ComponentErrorHandler getErrorHandler() {
+ return errorHandler;
+ }
+
+ /**
+ * Sets the error handler for the component.
+ *
+ * The error handler is dispatched whenever there is an error processing the
+ * data coming from the client.
+ *
+ * If the error handler is not set, the application error handler is used to
+ * handle the exception.
+ *
+ * @param errorHandler
+ * AbstractField specific error handler
+ */
+ public void setErrorHandler(ComponentErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+ public boolean handleError(ComponentErrorEvent error) {
+ if (errorHandler != null) {
+ return errorHandler.handleComponentError(error);
+ }
+ return false;
+
+ }
+
} \ No newline at end of file
diff --git a/src/com/itmill/toolkit/ui/AbstractField.java b/src/com/itmill/toolkit/ui/AbstractField.java
index 70b17ad41a..98a001dd57 100644
--- a/src/com/itmill/toolkit/ui/AbstractField.java
+++ b/src/com/itmill/toolkit/ui/AbstractField.java
@@ -21,7 +21,6 @@ import com.itmill.toolkit.terminal.CompositeErrorMessage;
import com.itmill.toolkit.terminal.ErrorMessage;
import com.itmill.toolkit.terminal.PaintException;
import com.itmill.toolkit.terminal.PaintTarget;
-import com.itmill.toolkit.terminal.Terminal;
/**
* <p>
@@ -122,8 +121,6 @@ public abstract class AbstractField extends AbstractComponent implements Field,
*/
private boolean validationVisible = true;
- private ComponentErrorHandler errorHandler = null;
-
/* Component basics ************************************************ */
/*
@@ -1085,52 +1082,6 @@ public abstract class AbstractField extends AbstractComponent implements Field,
}
}
- public interface ComponentErrorHandler {
- /**
- * Handle the component error
- *
- * @param event
- * @return True if the error has been handled False, otherwise
- */
- public boolean handleComponentError(ComponentErrorEvent event);
- }
-
- /**
- * Gets the error handler for the component.
- *
- * The error handler is dispatched whenever there is an error processing the
- * data coming from the client.
- *
- * @return
- */
- public ComponentErrorHandler getErrorHandler() {
- return errorHandler;
- }
-
- /**
- * Sets the error handler for the component.
- *
- * The error handler is dispatched whenever there is an error processing the
- * data coming from the client.
- *
- * If the error handler is not set, the application error handler is used to
- * handle the exception.
- *
- * @param errorHandler
- * AbstractField specific error handler
- */
- public void setErrorHandler(ComponentErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- public boolean handleError(ComponentErrorEvent error) {
- if (errorHandler != null) {
- return errorHandler.handleComponentError(error);
- }
- return false;
-
- }
-
/**
* Sets the current buffered source exception.
*
@@ -1142,7 +1093,4 @@ public abstract class AbstractField extends AbstractComponent implements Field,
requestRepaint();
}
- public interface ComponentErrorEvent extends Terminal.ErrorEvent {
- }
-
} \ No newline at end of file