summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-12-11 14:52:09 +0200
committerLeif Åstrand <leif@vaadin.com>2012-12-11 14:52:09 +0200
commitcde9d4684e3ddfba044bfa30645dcf7ee2ec0e16 (patch)
treea8834ffd069cdd3f3b30dc57a1980f14055c2208 /client
parentd1d2c6651a02b4bc12f661bb64fa08440094dca3 (diff)
downloadvaadin-framework-cde9d4684e3ddfba044bfa30645dcf7ee2ec0e16.tar.gz
vaadin-framework-cde9d4684e3ddfba044bfa30645dcf7ee2ec0e16.zip
Add getLastResponseId() (#10496)
Change-Id: I574844eabd9ba33ac7c5e967c734f6cc27d40e3e
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 5f90fe4c19..05cc88d0ee 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -260,6 +260,8 @@ public class ApplicationConnection {
/** Event bus for communication events */
private EventBus eventBus = GWT.create(SimpleEventBus.class);
+ private int lastResponseId = -1;
+
/**
* The communication handler methods are called at certain points during
* communication with the server. This allows for making add-ons that keep
@@ -1270,6 +1272,23 @@ public class ApplicationConnection {
handleUIDLMessage(start, jsonText, json);
}
+ /**
+ * Gets the id of the last received response. This id can be used by
+ * connectors to determine whether new data has been received from the
+ * server to avoid doing the same calculations multiple times.
+ * <p>
+ * No guarantees are made for the structure of the id other than that there
+ * will be a new unique value every time a new response with data from the
+ * server is received.
+ * <p>
+ * The initial id when no request has yet been processed is -1.
+ *
+ * @return and id identifying the response
+ */
+ public int getLastResponseId() {
+ return lastResponseId;
+ }
+
protected void handleUIDLMessage(final Date start, final String jsonText,
final ValueMap json) {
if (!responseHandlingLocks.isEmpty()) {
@@ -1294,6 +1313,8 @@ public class ApplicationConnection {
return;
}
+ lastResponseId++;
+
final MultiStepDuration handleUIDLDuration = new MultiStepDuration();
// Get security key