From 09565f6536570811767998b950dc60a4e37c54b6 Mon Sep 17 00:00:00 2001
From: Artur Signell
Date: Mon, 19 Nov 2012 13:40:14 +0200
Subject: [PATCH] Removed com.vaadin.server.Terminal (#10230)
Moved Terminal.ErrorEvent and Terminal.ErrorListener to com.vaadin.server
Change-Id: I4ce67722b88abc38fd740c5980836b24e511a63b
---
.../server/AbstractCommunicationManager.java | 2 -
.../vaadin/server/DefaultErrorListener.java | 3 +-
server/src/com/vaadin/server/ErrorEvent.java | 30 ++++++++++
.../src/com/vaadin/server/ErrorListener.java | 32 ++++++++++
.../src/com/vaadin/server/FileResource.java | 1 -
.../com/vaadin/server/LegacyApplication.java | 2 -
server/src/com/vaadin/server/Terminal.java | 58 -------------------
.../src/com/vaadin/server/VaadinPortlet.java | 2 +-
.../src/com/vaadin/server/VaadinServlet.java | 2 +-
.../src/com/vaadin/server/VaadinSession.java | 8 +--
.../src/com/vaadin/server/VariableOwner.java | 2 +-
.../src/com/vaadin/ui/AbstractComponent.java | 3 +-
.../vaadin/tests/appengine/GAESyncTest.java | 3 +-
.../TerminalErrorNotification.java | 3 +-
.../components/AbstractComponentTest.java | 3 +-
.../button/ShortCutListenerModification.java | 3 +-
16 files changed, 79 insertions(+), 78 deletions(-)
create mode 100644 server/src/com/vaadin/server/ErrorEvent.java
create mode 100644 server/src/com/vaadin/server/ErrorListener.java
delete mode 100644 server/src/com/vaadin/server/Terminal.java
diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java
index 57878bef31..b0199a3886 100644
--- a/server/src/com/vaadin/server/AbstractCommunicationManager.java
+++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java
@@ -67,8 +67,6 @@ import com.vaadin.server.ComponentSizeValidator.InvalidLayout;
import com.vaadin.server.RpcManager.RpcInvocationException;
import com.vaadin.server.StreamVariable.StreamingEndEvent;
import com.vaadin.server.StreamVariable.StreamingErrorEvent;
-import com.vaadin.server.Terminal.ErrorEvent;
-import com.vaadin.server.Terminal.ErrorListener;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.Connector;
import com.vaadin.shared.JavaScriptConnectorState;
diff --git a/server/src/com/vaadin/server/DefaultErrorListener.java b/server/src/com/vaadin/server/DefaultErrorListener.java
index f007bdad63..71fccf8d0c 100644
--- a/server/src/com/vaadin/server/DefaultErrorListener.java
+++ b/server/src/com/vaadin/server/DefaultErrorListener.java
@@ -20,10 +20,9 @@ import java.net.SocketException;
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.vaadin.server.Terminal.ErrorEvent;
import com.vaadin.ui.AbstractComponent;
-public class DefaultErrorListener implements Terminal.ErrorListener {
+public class DefaultErrorListener implements ErrorListener {
@Override
public void terminalError(ErrorEvent event) {
doDefault(event);
diff --git a/server/src/com/vaadin/server/ErrorEvent.java b/server/src/com/vaadin/server/ErrorEvent.java
new file mode 100644
index 0000000000..b570271cf7
--- /dev/null
+++ b/server/src/com/vaadin/server/ErrorEvent.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.server;
+
+import java.io.Serializable;
+
+/**
+ * An error event implementation for Terminal.
+ */
+public interface ErrorEvent extends Serializable {
+
+ /**
+ * Gets the contained throwable, the cause of the error.
+ */
+ public Throwable getThrowable();
+
+}
\ No newline at end of file
diff --git a/server/src/com/vaadin/server/ErrorListener.java b/server/src/com/vaadin/server/ErrorListener.java
new file mode 100644
index 0000000000..07400852e0
--- /dev/null
+++ b/server/src/com/vaadin/server/ErrorListener.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.server;
+
+import java.io.Serializable;
+
+/**
+ * Interface for listening to Terminal errors.
+ */
+public interface ErrorListener extends Serializable {
+
+ /**
+ * Invoked when a terminal error occurs.
+ *
+ * @param event
+ * the fired event.
+ */
+ public void terminalError(ErrorEvent event);
+}
\ No newline at end of file
diff --git a/server/src/com/vaadin/server/FileResource.java b/server/src/com/vaadin/server/FileResource.java
index 737299da8e..c413bb471d 100644
--- a/server/src/com/vaadin/server/FileResource.java
+++ b/server/src/com/vaadin/server/FileResource.java
@@ -20,7 +20,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import com.vaadin.server.Terminal.ErrorEvent;
import com.vaadin.util.FileTypeResolver;
/**
diff --git a/server/src/com/vaadin/server/LegacyApplication.java b/server/src/com/vaadin/server/LegacyApplication.java
index 10e8791be6..6307b9f0c2 100644
--- a/server/src/com/vaadin/server/LegacyApplication.java
+++ b/server/src/com/vaadin/server/LegacyApplication.java
@@ -23,8 +23,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import com.vaadin.server.Terminal.ErrorEvent;
-import com.vaadin.server.Terminal.ErrorListener;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.UI;
diff --git a/server/src/com/vaadin/server/Terminal.java b/server/src/com/vaadin/server/Terminal.java
deleted file mode 100644
index 265668aa42..0000000000
--- a/server/src/com/vaadin/server/Terminal.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import java.io.Serializable;
-
-/**
- * An interface that provides information about the user's terminal.
- * Implementors typically provide additional information using methods not in
- * this interface.
- *
- * @author Vaadin Ltd.
- * @since 3.0
- * @deprecated Currently only a container for ErrorEvent and ErrorListener
- */
-@Deprecated
-public interface Terminal extends Serializable {
-
- /**
- * An error event implementation for Terminal.
- */
- public interface ErrorEvent extends Serializable {
-
- /**
- * Gets the contained throwable, the cause of the error.
- */
- public Throwable getThrowable();
-
- }
-
- /**
- * Interface for listening to Terminal errors.
- */
- public interface ErrorListener extends Serializable {
-
- /**
- * Invoked when a terminal error occurs.
- *
- * @param event
- * the fired event.
- */
- public void terminalError(Terminal.ErrorEvent event);
- }
-}
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java
index b3ec6ba312..caa15b7ffd 100644
--- a/server/src/com/vaadin/server/VaadinPortlet.java
+++ b/server/src/com/vaadin/server/VaadinPortlet.java
@@ -674,7 +674,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
}
@SuppressWarnings("serial")
- public class RequestError implements Terminal.ErrorEvent, Serializable {
+ public class RequestError implements ErrorEvent, Serializable {
private final Throwable throwable;
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index 23378e4c20..47c2944b10 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -1217,7 +1217,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
return u;
}
- public class RequestError implements Terminal.ErrorEvent, Serializable {
+ public class RequestError implements ErrorEvent, Serializable {
private final Throwable throwable;
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 08b408fa28..74e3bd360d 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -90,7 +90,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* Session wide error handler which is used by default if an error is left
* unhandled.
*/
- private Terminal.ErrorListener errorHandler = new DefaultErrorListener();
+ private ErrorListener errorHandler = new DefaultErrorListener();
/**
* The converter factory that is used to provide default converters for the
@@ -338,7 +338,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
*
* @return the current error handler
*/
- public Terminal.ErrorListener getErrorHandler() {
+ public ErrorListener getErrorHandler() {
return errorHandler;
}
@@ -347,7 +347,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
*
* @param errorHandler
*/
- public void setErrorHandler(Terminal.ErrorListener errorHandler) {
+ public void setErrorHandler(ErrorListener errorHandler) {
this.errorHandler = errorHandler;
}
@@ -395,7 +395,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* should be used. This indicates that the problem is caused by the
* application - not by the user.
*/
- public class ApplicationError implements Terminal.ErrorEvent {
+ public class ApplicationError implements ErrorEvent {
private final Throwable throwable;
public ApplicationError(Throwable throwable) {
diff --git a/server/src/com/vaadin/server/VariableOwner.java b/server/src/com/vaadin/server/VariableOwner.java
index 704b4cdae9..e4319cfaf3 100644
--- a/server/src/com/vaadin/server/VariableOwner.java
+++ b/server/src/com/vaadin/server/VariableOwner.java
@@ -84,7 +84,7 @@ public interface VariableOwner extends Serializable {
/**
* VariableOwner error event.
*/
- public interface ErrorEvent extends Terminal.ErrorEvent {
+ public interface ErrorEvent extends com.vaadin.server.ErrorEvent {
/**
* Gets the source VariableOwner.
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index f1924692ba..0902924e4b 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -32,7 +32,6 @@ import com.vaadin.server.ClientConnector;
import com.vaadin.server.ComponentSizeValidator;
import com.vaadin.server.ErrorMessage;
import com.vaadin.server.Resource;
-import com.vaadin.server.Terminal;
import com.vaadin.server.VaadinSession;
import com.vaadin.shared.ComponentConstants;
import com.vaadin.shared.AbstractComponentState;
@@ -892,7 +891,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
}
}
- public interface ComponentErrorEvent extends Terminal.ErrorEvent {
+ public interface ComponentErrorEvent extends com.vaadin.server.ErrorEvent {
}
public interface ComponentErrorHandler extends Serializable {
diff --git a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java
index 5feb904873..ea462dbaae 100644
--- a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java
+++ b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java
@@ -5,6 +5,7 @@ import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.ClassResource;
import com.vaadin.server.DownloadStream;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -29,7 +30,7 @@ public class GAESyncTest extends LegacyApplication {
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
Throwable t = event.getThrowable();
// Was this caused by a GAE timeout?
while (t != null) {
diff --git a/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java b/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java
index 0dcf0a6fa8..7ab552a96b 100644
--- a/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java
+++ b/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.tests.application;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -38,7 +39,7 @@ public class TerminalErrorNotification extends TestBase {
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
event.getThrowable().printStackTrace();
UI mainWindow = getMainWindow();
diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
index ece40f5b00..0cde43119a 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
@@ -14,6 +14,7 @@ import com.vaadin.event.FieldEvents.BlurNotifier;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.event.FieldEvents.FocusNotifier;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.tests.util.Log;
@@ -715,7 +716,7 @@ public abstract class AbstractComponentTest
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
String logMsg = "Exception occured, "
+ event.getThrowable().getClass().getName();
diff --git a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
index 3c7a9a40ea..646b8f67f7 100644
--- a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
+++ b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.button;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.event.ShortcutAction.ModifierKey;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -57,7 +58,7 @@ public class ShortCutListenerModification extends TestBase implements
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
super.terminalError(event);
getMainWindow().showNotification("Failed!",
Notification.TYPE_ERROR_MESSAGE);
--
2.39.5