diff options
author | Artur Signell <artur@vaadin.com> | 2015-08-28 15:44:54 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-08-31 12:01:09 +0300 |
commit | df3e10d969ec976216a3d5578420f38bbf649589 (patch) | |
tree | 385889a2c4aac4360c0b1caed20ba7a4c4b952e5 /server | |
parent | d11b90c8ed3aa63f920e17675275c014f670f759 (diff) | |
download | vaadin-framework-df3e10d969ec976216a3d5578420f38bbf649589.tar.gz vaadin-framework-df3e10d969ec976216a3d5578420f38bbf649589.zip |
Add modality configuration option for reconnect dialog (#11733)
Leave the request state as open until reconnect is done and the message has
been delivered. This avoids flushing the rpc queue during reconnect, which
would cause two concurrent requests.
Change-Id: I320ffccd49c26acd16bd70b34ba28b465d17842c
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/ReconnectDialogConfiguration.java | 75 |
1 files changed, 67 insertions, 8 deletions
diff --git a/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java b/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java index 9c40b27da8..92eb1e785f 100644 --- a/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java +++ b/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java @@ -90,6 +90,45 @@ public interface ReconnectDialogConfiguration extends Serializable { * the interval (in ms) between reconnect attempts */ public void setReconnectInterval(int reconnectInterval); + + /** + * Gets the timeout (in milliseconds) between noticing a loss of connection + * and showing the dialog. + * + * @return the time to wait before showing a dialog + */ + public int getDialogGracePeriod(); + + /** + * Sets the timeout (in milliseconds) between noticing a loss of connection + * and showing the dialog. + * + * @param dialogGracePeriod + * the time to wait before showing a dialog + */ + public void setDialogGracePeriod(int dialogGracePeriod); + + /** + * Sets the modality of the dialog. + * <p> + * If the dialog is set to modal, it will prevent the usage of the + * application while the dialog is being shown. If not modal, the user can + * continue to use the application as normally and all server events will be + * queued until connection has been re-established. + * + * @param dialogModal + * true to make the dialog modal, false otherwise + */ + public void setDialogModal(boolean dialogModal); + + /** + * Checks the modality of the dialog. + * <p> + * + * @see #setDialogModal(boolean) + * @return true if the dialog is modal, false otherwise + */ + public boolean isDialogModal(); } class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration { @@ -101,42 +140,62 @@ class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration { @Override public String getDialogText() { - return ui.getState(false).reconnectDialog.dialogText; + return ui.getState(false).reconnectDialogConfiguration.dialogText; } @Override public void setDialogText(String dialogText) { - ui.getState().reconnectDialog.dialogText = dialogText; + ui.getState().reconnectDialogConfiguration.dialogText = dialogText; } @Override public String getDialogTextGaveUp() { - return ui.getState(false).reconnectDialog.dialogTextGaveUp; + return ui.getState(false).reconnectDialogConfiguration.dialogTextGaveUp; } @Override public void setDialogTextGaveUp(String dialogTextGaveUp) { - ui.getState().reconnectDialog.dialogTextGaveUp = dialogTextGaveUp; + ui.getState().reconnectDialogConfiguration.dialogTextGaveUp = dialogTextGaveUp; } @Override public int getReconnectAttempts() { - return ui.getState(false).reconnectDialog.reconnectAttempts; + return ui.getState(false).reconnectDialogConfiguration.reconnectAttempts; } @Override public void setReconnectAttempts(int reconnectAttempts) { - ui.getState().reconnectDialog.reconnectAttempts = reconnectAttempts; + ui.getState().reconnectDialogConfiguration.reconnectAttempts = reconnectAttempts; } @Override public int getReconnectInterval() { - return ui.getState(false).reconnectDialog.reconnectInterval; + return ui.getState(false).reconnectDialogConfiguration.reconnectInterval; } @Override public void setReconnectInterval(int reconnectInterval) { - ui.getState().reconnectDialog.reconnectInterval = reconnectInterval; + ui.getState().reconnectDialogConfiguration.reconnectInterval = reconnectInterval; + } + + @Override + public int getDialogGracePeriod() { + return ui.getState(false).reconnectDialogConfiguration.dialogGracePeriod; + } + + @Override + public void setDialogGracePeriod(int dialogGracePeriod) { + ui.getState().reconnectDialogConfiguration.dialogGracePeriod = dialogGracePeriod; + } + + @Override + public boolean isDialogModal() { + return ui.getState(false).reconnectDialogConfiguration.dialogModal; + } + + @Override + public void setDialogModal(boolean dialogModal) { + ui.getState().reconnectDialogConfiguration.dialogModal = dialogModal; } } |