ChangeScreen2: Poll for updates in the background

Poll every 30 seconds for updates made to the currently open
change. If a modification is detected show a small butter
bar in the bottom right corner advising the user they are
viewing a stale version of the change.

To be efficient this relies on the recently added support to
reply "304 Not Modified" when there are no updates.

change.updateDelay can be configured by the site administrator
to manage the polling frequency.

Change-Id: Ib3f3acf513193bf1f1f92c472cd586999f3cad5d
This commit is contained in:
Shawn Pearce
2013-07-19 19:45:25 -07:00
parent cd5035d179
commit b9ebb668f6
12 changed files with 555 additions and 32 deletions

View File

@@ -18,16 +18,20 @@ import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
import com.google.gwt.event.dom.client.HasMouseMoveHandlers;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.dom.client.MouseMoveEvent;
import com.google.gwt.event.dom.client.MouseMoveHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
class DocWidget extends Widget implements HasKeyPressHandlers {
public class DocWidget extends Widget
implements HasKeyPressHandlers, HasMouseMoveHandlers {
private static DocWidget me;
static DocWidget get() {
public static DocWidget get() {
if (me == null) {
me = new DocWidget();
}
@@ -45,6 +49,11 @@ class DocWidget extends Widget implements HasKeyPressHandlers {
return addDomHandler(handler, KeyPressEvent.getType());
}
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
return addDomHandler(handler, MouseMoveEvent.getType());
}
private static Node docnode() {
return Document.get();
}