aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-04-22 14:06:54 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-23 07:46:25 +0000
commitf596fea90a03df5191ff65aa82cf70a879809774 (patch)
tree19b7f50b3ad209e107b02c54f7b4ba39000406f9 /server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
parent09cb9d88956b5c892d8dba9b1a3f3dd9cdfd078a (diff)
downloadvaadin-framework-f596fea90a03df5191ff65aa82cf70a879809774.tar.gz
vaadin-framework-f596fea90a03df5191ff65aa82cf70a879809774.zip
Renamed UI.getLoadingIndicator -> getLoadingIndicatorConfiguration (#11665)
Change-Id: If80abf821abd9c6c025e49b249339eb20d56f7ce
Diffstat (limited to 'server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java')
-rw-r--r--server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java159
1 files changed, 159 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java b/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
new file mode 100644
index 0000000000..ca6c158aa5
--- /dev/null
+++ b/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2000-2013 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;
+
+import com.vaadin.shared.ui.ui.UIState.LoadingIndicatorConfigurationState;
+
+/**
+ * Provides method for configuring the loading indicator.
+ *
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public interface LoadingIndicatorConfiguration extends Serializable {
+ /**
+ * Sets the delay before the loading indicator is shown. The default is
+ * 300ms.
+ *
+ * @param initialDelay
+ * The initial delay (in ms)
+ */
+ public void setInitialDelay(int initialDelay);
+
+ /**
+ * Returns the delay before the loading indicator is shown.
+ *
+ * @return The initial delay (in ms)
+ */
+ public int getInitialDelay();
+
+ /**
+ * Sets the delay before the loading indicator goes into the "delay" state.
+ * The delay is calculated from the time when the loading indicator was
+ * triggered. The default is 1500ms.
+ *
+ * @param delayStateDelay
+ * The delay before going into the "delay" state (in ms)
+ */
+ public void setDelayStateDelay(int delayStateDelay);
+
+ /**
+ * Returns the delay before the loading indicator goes into the "delay"
+ * state. The delay is calculated from the time when the loading indicator
+ * was triggered.
+ *
+ * @return The delay before going into the "delay" state (in ms)
+ */
+ public int getDelayStateDelay();
+
+ /**
+ * Sets the delay before the loading indicator goes into the "wait" state.
+ * The delay is calculated from the time when the loading indicator was
+ * triggered. The default is 5000ms.
+ *
+ * @param waitStateDelay
+ * The delay before going into the "wait" state (in ms)
+ */
+ public void setWaitStateDelay(int waitStateDelay);
+
+ /**
+ * Returns the delay before the loading indicator goes into the "wait"
+ * state. The delay is calculated from the time when the loading indicator
+ * was triggered.
+ *
+ * @return The delay before going into the "wait" state (in ms)
+ */
+ public int getWaitStateDelay();
+}
+
+class LoadingIndicatorConfigurationImpl implements LoadingIndicatorConfiguration {
+ private UI ui;
+
+ public LoadingIndicatorConfigurationImpl(UI ui) {
+ this.ui = ui;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.LoadingIndicator#setInitialDelay(int)
+ */
+ @Override
+ public void setInitialDelay(int initialDelay) {
+ getState().initialDelay = initialDelay;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.LoadingIndicator#getInitialDelay()
+ */
+ @Override
+ public int getInitialDelay() {
+ return getState(false).initialDelay;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.LoadingIndicator#setDelayStateDelay(int)
+ */
+ @Override
+ public void setDelayStateDelay(int delayStateDelay) {
+ getState().delayStateDelay = delayStateDelay;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.LoadingIndicator#getDelayStateDelay()
+ */
+ @Override
+ public int getDelayStateDelay() {
+ return getState(false).delayStateDelay;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.LoadingIndicator#setWaitStateDelay(int)
+ */
+ @Override
+ public void setWaitStateDelay(int waitStateDelay) {
+ getState().waitStateDelay = waitStateDelay;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.LoadingIndicator#getWaitStateDelay()
+ */
+ @Override
+ public int getWaitStateDelay() {
+ return getState(false).waitStateDelay;
+ }
+
+ private LoadingIndicatorConfigurationState getState() {
+ return ui.getState().loadingIndicatorConfiguration;
+ }
+
+ private LoadingIndicatorConfigurationState getState(boolean markAsDirty) {
+ return ui.getState(markAsDirty).loadingIndicatorConfiguration;
+ }
+
+}