aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-11-20 08:35:46 +0200
committerVaadin Code Review <review@vaadin.com>2012-11-21 11:54:50 +0000
commit416b8a6d6b9eb580454f006b38a72ffe7f484638 (patch)
treefe40f3e3525550dece85816ec5a4983c5ee2ae1f /client
parent8b9b30134cecd0162548dd7e655f783f22715c82 (diff)
downloadvaadin-framework-416b8a6d6b9eb580454f006b38a72ffe7f484638.tar.gz
vaadin-framework-416b8a6d6b9eb580454f006b38a72ffe7f484638.zip
Renamed communication event related classes (#10243)
Change-Id: Ia4ddb8e6937f5902b50b8c88c93f7955a653c025
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java64
1 files changed, 46 insertions, 18 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 8bfd7ee747..ede16b8125 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -266,17 +266,21 @@ public class ApplicationConnection {
* track of different aspects of the communication.
*/
public interface CommunicationHandler extends EventHandler {
- void onRequestStarted(RequestStartedEvent e);
+ void onRequestStarting(RequestStartingEvent e);
- void onRequestEnded(RequestEndedEvent e);
+ void onResponseHandlingStarted(ResponseHandlingStartedEvent e);
- void onResponseReceived(ResponseReceivedEvent e);
+ void onResponseHandlingEnded(ResponseHandlingEndedEvent e);
}
- public static class RequestStartedEvent extends
- GwtEvent<CommunicationHandler> {
+ public static class RequestStartingEvent extends ApplicationConnectionEvent {
+
public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();
+ public RequestStartingEvent(ApplicationConnection connection) {
+ super(connection);
+ }
+
@Override
public com.google.gwt.event.shared.GwtEvent.Type<CommunicationHandler> getAssociatedType() {
return TYPE;
@@ -284,14 +288,19 @@ public class ApplicationConnection {
@Override
protected void dispatch(CommunicationHandler handler) {
- handler.onRequestStarted(this);
+ handler.onRequestStarting(this);
}
}
- public static class RequestEndedEvent extends
- GwtEvent<CommunicationHandler> {
+ public static class ResponseHandlingEndedEvent extends
+ ApplicationConnectionEvent {
+
public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();
+ public ResponseHandlingEndedEvent(ApplicationConnection connection) {
+ super(connection);
+ }
+
@Override
public com.google.gwt.event.shared.GwtEvent.Type<CommunicationHandler> getAssociatedType() {
return TYPE;
@@ -299,12 +308,32 @@ public class ApplicationConnection {
@Override
protected void dispatch(CommunicationHandler handler) {
- handler.onRequestEnded(this);
+ handler.onResponseHandlingEnded(this);
}
}
- public static class ResponseReceivedEvent extends
+ public static abstract class ApplicationConnectionEvent extends
GwtEvent<CommunicationHandler> {
+
+ private ApplicationConnection connection;
+
+ protected ApplicationConnectionEvent(ApplicationConnection connection) {
+ this.connection = connection;
+ }
+
+ public ApplicationConnection getConnection() {
+ return connection;
+ }
+
+ }
+
+ public static class ResponseHandlingStartedEvent extends
+ ApplicationConnectionEvent {
+
+ public ResponseHandlingStartedEvent(ApplicationConnection connection) {
+ super(connection);
+ }
+
public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();
@Override
@@ -314,14 +343,14 @@ public class ApplicationConnection {
@Override
protected void dispatch(CommunicationHandler handler) {
- handler.onResponseReceived(this);
+ handler.onResponseHandlingStarted(this);
}
}
/**
* Allows custom handling of communication errors.
*/
- public interface CommunicationErrorDelegate {
+ public interface CommunicationErrorHandler {
/**
* Called when a communication error has occurred. Returning
* <code>true</code> from this method suppresses error handling.
@@ -336,7 +365,7 @@ public class ApplicationConnection {
public boolean onError(String details, int statusCode);
}
- private CommunicationErrorDelegate communicationErrorDelegate = null;
+ private CommunicationErrorHandler communicationErrorDelegate = null;
public static class MultiStepDuration extends Duration {
private int previousStep = elapsedMillis();
@@ -1063,7 +1092,7 @@ public class ApplicationConnection {
// First one kicks in at 300ms
}
loadTimer.schedule(300);
- eventBus.fireEvent(new RequestStartedEvent());
+ eventBus.fireEvent(new RequestStartingEvent(this));
}
protected void endRequest() {
@@ -1100,7 +1129,7 @@ public class ApplicationConnection {
}
}
});
- eventBus.fireEvent(new RequestEndedEvent());
+ eventBus.fireEvent(new ResponseHandlingEndedEvent(this));
}
/**
@@ -1254,7 +1283,7 @@ public class ApplicationConnection {
}
VConsole.log("Handling message from server");
- eventBus.fireEvent(new ResponseReceivedEvent());
+ eventBus.fireEvent(new ResponseHandlingStartedEvent(this));
// Handle redirect
if (json.containsKey("redirect")) {
@@ -3140,8 +3169,7 @@ public class ApplicationConnection {
* @param delegate
* the delegate.
*/
- public void setCommunicationErrorDelegate(
- CommunicationErrorDelegate delegate) {
+ public void setCommunicationErrorDelegate(CommunicationErrorHandler delegate) {
communicationErrorDelegate = delegate;
}