summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-04-25 16:02:20 +0300
committerArtur Signell <artur@vaadin.com>2015-07-13 17:19:09 +0300
commit04100c62ac45550f12f8c631fb83140a0af0a48b (patch)
tree9e873b28b0df9b57c0ff5290d9662265d927b91a /server/src/com/vaadin/ui/ReconnectDialogConfiguration.java
parentd193814bb5dd920bc402997c41cbd34771d09b51 (diff)
downloadvaadin-framework-04100c62ac45550f12f8c631fb83140a0af0a48b.tar.gz
vaadin-framework-04100c62ac45550f12f8c631fb83140a0af0a48b.zip
Allow configuration of reconnect dialog parameters (#11733)
Change-Id: Ibf60ef8cdd21204e8ccfbb0a7d93cf88c4d8468a
Diffstat (limited to 'server/src/com/vaadin/ui/ReconnectDialogConfiguration.java')
-rw-r--r--server/src/com/vaadin/ui/ReconnectDialogConfiguration.java142
1 files changed, 142 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java b/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java
new file mode 100644
index 0000000000..9c40b27da8
--- /dev/null
+++ b/server/src/com/vaadin/ui/ReconnectDialogConfiguration.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.ui;
+
+import java.io.Serializable;
+
+/**
+ * Provides method for configuring the reconnect dialog.
+ *
+ * @since 7.6
+ * @author Vaadin Ltd
+ */
+public interface ReconnectDialogConfiguration extends Serializable {
+ /**
+ * Gets the text to show in the reconnect dialog when trying to re-establish
+ * the server connection
+ *
+ * @return the text to show in the reconnect dialog
+ */
+ public String getDialogText();
+
+ /**
+ * Sets the text to show in the reconnect dialog when trying to re-establish
+ * the server connection
+ *
+ * @param dialogText
+ * the text to show in the reconnect dialog
+ */
+ public void setDialogText(String dialogText);
+
+ /**
+ * Gets the text to show in the reconnect dialog after giving up trying to
+ * reconnect ({@link #getReconnectAttempts()} reached)
+ *
+ * @return the text to show in the reconnect dialog after giving up
+ */
+ public String getDialogTextGaveUp();
+
+ /**
+ * Sets the text to show in the reconnect dialog after giving up trying to
+ * reconnect ({@link #getReconnectAttempts()} reached)
+ *
+ * @param dialogText
+ * the text to show in the reconnect dialog after giving up
+ */
+ public void setDialogTextGaveUp(String dialogTextGaveUp);
+
+ /**
+ * Gets the number of times to try to reconnect to the server before giving
+ * up
+ *
+ * @return the number of times to try to reconnect
+ */
+ public int getReconnectAttempts();
+
+ /**
+ * Sets the number of times to try to reconnect to the server before giving
+ * up
+ *
+ * @param reconnectAttempts
+ * the number of times to try to reconnect
+ */
+ public void setReconnectAttempts(int reconnectAttempts);
+
+ /**
+ * Gets the interval (in milliseconds) between reconnect attempts
+ *
+ * @return the interval (in ms) between reconnect attempts
+ */
+ public int getReconnectInterval();
+
+ /**
+ * Sets the interval (in milliseconds) between reconnect attempts
+ *
+ * @param reconnectInterval
+ * the interval (in ms) between reconnect attempts
+ */
+ public void setReconnectInterval(int reconnectInterval);
+}
+
+class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration {
+ private UI ui;
+
+ public ReconnectDialogConfigurationImpl(UI ui) {
+ this.ui = ui;
+ }
+
+ @Override
+ public String getDialogText() {
+ return ui.getState(false).reconnectDialog.dialogText;
+ }
+
+ @Override
+ public void setDialogText(String dialogText) {
+ ui.getState().reconnectDialog.dialogText = dialogText;
+ }
+
+ @Override
+ public String getDialogTextGaveUp() {
+ return ui.getState(false).reconnectDialog.dialogTextGaveUp;
+ }
+
+ @Override
+ public void setDialogTextGaveUp(String dialogTextGaveUp) {
+ ui.getState().reconnectDialog.dialogTextGaveUp = dialogTextGaveUp;
+ }
+
+ @Override
+ public int getReconnectAttempts() {
+ return ui.getState(false).reconnectDialog.reconnectAttempts;
+ }
+
+ @Override
+ public void setReconnectAttempts(int reconnectAttempts) {
+ ui.getState().reconnectDialog.reconnectAttempts = reconnectAttempts;
+ }
+
+ @Override
+ public int getReconnectInterval() {
+ return ui.getState(false).reconnectDialog.reconnectInterval;
+ }
+
+ @Override
+ public void setReconnectInterval(int reconnectInterval) {
+ ui.getState().reconnectDialog.reconnectInterval = reconnectInterval;
+ }
+
+}