import com.google.gwt.user.client.Window.Location;
import com.vaadin.client.ApplicationConfiguration;
import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent;
+import com.vaadin.client.ApplicationConnection.ApplicationStoppedHandler;
import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler;
import com.vaadin.client.ResourceLoader;
import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
this.connection = connection;
this.errorHandler = errorHandler;
+ connection.addHandler(ApplicationStoppedEvent.TYPE,
+ new ApplicationStoppedHandler() {
+
+ @Override
+ public void onApplicationStopped(
+ ApplicationStoppedEvent event) {
+ if (state == State.DISCONNECT_PENDING
+ || state == State.DISCONNECTED) {
+ return;
+ }
+
+ disconnect(new Command() {
+ @Override
+ public void execute() {
+ }
+ });
+
+ }
+ });
config = createConfig();
String debugParameter = Location.getParameter("debug");
if ("push".equals(debugParameter)) {
message = message.substring(9, message.length() - 1);
connection.handlePushMessage(message);
}
-
- if (!connection.isApplicationRunning()) {
- disconnect(new Command() {
- @Override
- public void execute() {
- }
- });
- }
}
/**