diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-04-05 18:33:55 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-04-10 14:47:37 +0300 |
commit | 150352f64cdb49a27b110bd32e049c307fcf3486 (patch) | |
tree | 5a40f4a276d3f22d639ba2eb0cfd1e59e27b8049 /server/src/com/vaadin/ui | |
parent | 2700cd2fe6c48b29478f1b8e14fde1d405a6ab7d (diff) | |
download | vaadin-framework-150352f64cdb49a27b110bd32e049c307fcf3486.tar.gz vaadin-framework-150352f64cdb49a27b110bd32e049c307fcf3486.zip |
Implemented poll interval for UI (#11495)
Change-Id: Ic56b0123970f18e282c75d67863569ac55c72ea8
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r-- | server/src/com/vaadin/ui/UI.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 2d9f49b122..6160978542 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -148,6 +148,14 @@ public abstract class UI extends AbstractSingleComponentContainer implements UI.this.scrollTop = scrollTop; UI.this.scrollLeft = scrollLeft; } + + @Override + public void poll() { + /* + * No-op. This is only called to cause a server visit to check for + * changes. + */ + } }; /** @@ -1171,4 +1179,30 @@ public abstract class UI extends AbstractSingleComponentContainer implements public void setPushConnection(PushConnection connection) { pushConnection = connection; } + + /** + * Sets the interval with which the UI should poll the server to see if + * there are any changes. Polling is disabled by default. + * <p> + * Note that it is possible to enable push and polling at the same time but + * it should not be done to avoid excessive server traffic. + * </p> + * + * @param intervalInMillis + * The interval (in ms) with which the UI should poll the server + * or -1 to disable polling + */ + public void setPollInterval(int intervalInMillis) { + getState().pollInterval = intervalInMillis; + } + + /** + * Returns the interval with which the UI polls the server. + * + * @return The interval (in ms) with which the UI polls the server or -1 if + * polling is disabled + */ + public int getPollInterval() { + return getState(false).pollInterval; + } } |