From f596fea90a03df5191ff65aa82cf70a879809774 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 22 Apr 2013 14:06:54 +0300 Subject: Renamed UI.getLoadingIndicator -> getLoadingIndicatorConfiguration (#11665) Change-Id: If80abf821abd9c6c025e49b249339eb20d56f7ce --- server/src/com/vaadin/ui/LoadingIndicator.java | 159 --------------------- .../vaadin/ui/LoadingIndicatorConfiguration.java | 159 +++++++++++++++++++++ server/src/com/vaadin/ui/UI.java | 6 +- shared/src/com/vaadin/shared/ui/ui/UIState.java | 4 +- .../ui/LoadingIndicatorConfigurationTest.java | 6 +- 5 files changed, 167 insertions(+), 167 deletions(-) delete mode 100644 server/src/com/vaadin/ui/LoadingIndicator.java create mode 100644 server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java diff --git a/server/src/com/vaadin/ui/LoadingIndicator.java b/server/src/com/vaadin/ui/LoadingIndicator.java deleted file mode 100644 index 5740ee772d..0000000000 --- a/server/src/com/vaadin/ui/LoadingIndicator.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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.LoadingIndicatorConfiguration; - -/** - * Provides method for configuring the loading indicator. - * - * @author Vaadin Ltd - * @since 7.1 - */ -public interface LoadingIndicator 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 LoadingIndicatorImpl implements LoadingIndicator { - private UI ui; - - public LoadingIndicatorImpl(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 LoadingIndicatorConfiguration getState() { - return ui.getState().loadingIndicatorConfiguration; - } - - private LoadingIndicatorConfiguration getState(boolean markAsDirty) { - return ui.getState(markAsDirty).loadingIndicatorConfiguration; - } - -} 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; + } + +} diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index b6574fe1b2..837d793b19 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -118,7 +118,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements private Page page = new Page(this); - private LoadingIndicator loadingIndicator = new LoadingIndicatorImpl(this); + private LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfigurationImpl(this); /** * Scroll Y position. @@ -1132,8 +1132,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements * * @return The instance used for configuring the loading indicator */ - public LoadingIndicator getLoadingIndicator() { - return loadingIndicator; + public LoadingIndicatorConfiguration getLoadingIndicatorConfiguration() { + return loadingIndicatorConfiguration; } /** diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java index 9e9f179f0b..ee3478f0a0 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java @@ -22,12 +22,12 @@ import com.vaadin.shared.ui.TabIndexState; public class UIState extends TabIndexState { public TooltipConfigurationState tooltipConfiguration = new TooltipConfigurationState(); - public LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfiguration(); + public LoadingIndicatorConfigurationState loadingIndicatorConfiguration = new LoadingIndicatorConfigurationState(); public int pollInterval = -1; public PushMode pushMode = PushMode.DISABLED; - public static class LoadingIndicatorConfiguration implements Serializable { + public static class LoadingIndicatorConfigurationState implements Serializable { public int initialDelay = 300; public int delayStateDelay = 1500; public int waitStateDelay = 5000; diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java index 0f15ff2fe0..8917a1aa6d 100644 --- a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java @@ -41,7 +41,7 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog { initialDelay.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - getLoadingIndicator().setInitialDelay( + getLoadingIndicatorConfiguration().setInitialDelay( (Integer) initialDelay.getConvertedValue()); } }); @@ -51,7 +51,7 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog { .addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - getLoadingIndicator().setDelayStateDelay( + getLoadingIndicatorConfiguration().setDelayStateDelay( (Integer) delayStateDelay.getConvertedValue()); } }); @@ -61,7 +61,7 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog { .addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - getLoadingIndicator().setWaitStateDelay( + getLoadingIndicatorConfiguration().setWaitStateDelay( (Integer) waitStateDelay.getConvertedValue()); } }); -- cgit v1.2.3