summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/ui/VProgressBar.java85
-rw-r--r--client/src/com/vaadin/client/ui/VProgressIndicator.java62
-rw-r--r--client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java56
-rw-r--r--client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java21
-rw-r--r--server/src/com/vaadin/ui/ProgressBar.java152
-rw-r--r--server/src/com/vaadin/ui/ProgressIndicator.java105
-rw-r--r--shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java33
-rw-r--r--shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html62
-rw-r--r--uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java125
10 files changed, 552 insertions, 156 deletions
diff --git a/client/src/com/vaadin/client/ui/VProgressBar.java b/client/src/com/vaadin/client/ui/VProgressBar.java
new file mode 100644
index 0000000000..3eb8725520
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/VProgressBar.java
@@ -0,0 +1,85 @@
+/*
+ * 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.client.ui;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.HasEnabled;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Widget for showing the current progress of a long running task.
+ * <p>
+ * The default mode is to show the current progress internally represented by a
+ * floating point value between 0 and 1 (inclusive). The progress bar can also
+ * be in an indeterminate mode showing an animation indicating that the task is
+ * running but without providing any information about the current progress.
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class VProgressBar extends Widget implements HasEnabled {
+
+ public static final String CLASSNAME = "v-progressindicator";
+ Element wrapper = DOM.createDiv();
+ Element indicator = DOM.createDiv();
+
+ protected boolean indeterminate = false;
+ protected float state = 0.0f;
+ private boolean enabled;
+
+ public VProgressBar() {
+ setElement(DOM.createDiv());
+ getElement().appendChild(wrapper);
+ setStyleName(CLASSNAME);
+ wrapper.appendChild(indicator);
+ indicator.setClassName(CLASSNAME + "-indicator");
+ wrapper.setClassName(CLASSNAME + "-wrapper");
+ }
+
+ public void setIndeterminate(boolean indeterminate) {
+ this.indeterminate = indeterminate;
+ setStyleName(CLASSNAME + "-indeterminate", indeterminate);
+ }
+
+ public void setState(float state) {
+ final int size = Math.round(100 * state);
+ indicator.getStyle().setWidth(size, Unit.PCT);
+ }
+
+ public boolean isIndeterminate() {
+ return indeterminate;
+ }
+
+ public float getState() {
+ return state;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ setStyleName("v-disabled", !enabled);
+
+ }
+
+}
diff --git a/client/src/com/vaadin/client/ui/VProgressIndicator.java b/client/src/com/vaadin/client/ui/VProgressIndicator.java
index d6b25cb016..500a5def30 100644
--- a/client/src/com/vaadin/client/ui/VProgressIndicator.java
+++ b/client/src/com/vaadin/client/ui/VProgressIndicator.java
@@ -16,59 +16,13 @@
package com.vaadin.client.ui;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.HasEnabled;
-import com.google.gwt.user.client.ui.Widget;
-
-public class VProgressIndicator extends Widget implements HasEnabled {
-
- public static final String CLASSNAME = "v-progressindicator";
- Element wrapper = DOM.createDiv();
- Element indicator = DOM.createDiv();
-
- protected boolean indeterminate = false;
- protected float state = 0.0f;
- private boolean enabled;
-
- public VProgressIndicator() {
- setElement(DOM.createDiv());
- getElement().appendChild(wrapper);
- setStyleName(CLASSNAME);
- wrapper.appendChild(indicator);
- indicator.setClassName(CLASSNAME + "-indicator");
- wrapper.setClassName(CLASSNAME + "-wrapper");
- }
-
- public void setIndeterminate(boolean indeterminate) {
- this.indeterminate = indeterminate;
- setStyleName(CLASSNAME + "-indeterminate", indeterminate);
- }
-
- public void setState(float state) {
- final int size = Math.round(100 * state);
- indicator.getStyle().setWidth(size, Unit.PCT);
- }
-
- public boolean isIndeterminate() {
- return indeterminate;
- }
-
- public float getState() {
- return state;
- }
-
- @Override
- public boolean isEnabled() {
- return enabled;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- setStyleName("v-disabled", !enabled);
-
- }
+/**
+ *
+ * @author Vaadin Ltd
+ *
+ * @deprecated as of 7.1, renamed to VProgressBar
+ */
+@Deprecated
+public class VProgressIndicator extends VProgressBar {
}
diff --git a/client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java b/client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
new file mode 100644
index 0000000000..91f3da5323
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
@@ -0,0 +1,56 @@
+/*
+ * 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.client.ui.progressindicator;
+
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.VProgressBar;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.progressindicator.ProgressBarState;
+import com.vaadin.ui.ProgressBar;
+
+/**
+ * Connector for {@link VProgressBar}.
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+@Connect(ProgressBar.class)
+public class ProgressBarConnector extends AbstractFieldConnector {
+
+ public ProgressBarConnector() {
+ super();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ getWidget().setIndeterminate(getState().indeterminate);
+ getWidget().setState(getState().state);
+ }
+
+ @Override
+ public ProgressBarState getState() {
+ return (ProgressBarState) super.getState();
+ }
+
+ @Override
+ public VProgressBar getWidget() {
+ return (VProgressBar) super.getWidget();
+ }
+
+} \ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java b/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
index ac5c3f5f6b..9e14f082e0 100644
--- a/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
+++ b/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
@@ -18,15 +18,23 @@ package com.vaadin.client.ui.progressindicator;
import com.google.gwt.user.client.Timer;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractFieldConnector;
-import com.vaadin.client.ui.VProgressIndicator;
+import com.vaadin.client.ui.VProgressBar;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState;
import com.vaadin.ui.ProgressIndicator;
+/**
+ * Connector for {@link VProgressBar} with polling support.
+ *
+ * @since 7.0
+ * @author Vaadin Ltd
+ * @deprecated as of 7.1, use {@link ProgressBarConnector} combined with server
+ * push or UI polling.
+ */
@Connect(ProgressIndicator.class)
-public class ProgressIndicatorConnector extends AbstractFieldConnector {
+@Deprecated
+public class ProgressIndicatorConnector extends ProgressBarConnector {
@Override
public ProgressIndicatorState getState() {
@@ -45,8 +53,6 @@ public class ProgressIndicatorConnector extends AbstractFieldConnector {
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
- getWidget().setIndeterminate(getState().indeterminate);
- getWidget().setState(getState().state);
if (isEnabled()) {
poller.scheduleRepeating(getState().pollingInterval);
@@ -60,9 +66,4 @@ public class ProgressIndicatorConnector extends AbstractFieldConnector {
super.onUnregister();
poller.cancel();
}
-
- @Override
- public VProgressIndicator getWidget() {
- return (VProgressIndicator) super.getWidget();
- }
}
diff --git a/server/src/com/vaadin/ui/ProgressBar.java b/server/src/com/vaadin/ui/ProgressBar.java
new file mode 100644
index 0000000000..3f8aab6d7c
--- /dev/null
+++ b/server/src/com/vaadin/ui/ProgressBar.java
@@ -0,0 +1,152 @@
+/*
+ * 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 com.vaadin.data.Property;
+import com.vaadin.shared.ui.progressindicator.ProgressBarState;
+
+/**
+ * Shows the current progress of a long running task.
+ * <p>
+ * The default mode is to show the current progress internally represented by a
+ * floating point value between 0 and 1 (inclusive). The progress bar can also
+ * be in an indeterminate mode showing an animation indicating that the task is
+ * running but without providing any information about the current progress.
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class ProgressBar extends AbstractField<Float> implements
+ Property.Viewer, Property.ValueChangeListener {
+
+ /**
+ * Creates a new progress bar initially set to 0% progress.
+ */
+ public ProgressBar() {
+ this(0);
+ }
+
+ /**
+ * Creates a new progress bar with the given initial value.
+ *
+ * @param progress
+ * the initial progress value
+ */
+ public ProgressBar(float progress) {
+ setValue(Float.valueOf(progress));
+ }
+
+ /**
+ * Creates a new progress bar bound to the given data source.
+ *
+ * @param dataSource
+ * the property to bind this progress bar to
+ */
+ public ProgressBar(Property<?> dataSource) {
+ setPropertyDataSource(dataSource);
+ }
+
+ @Override
+ public void beforeClientResponse(boolean initial) {
+ super.beforeClientResponse(initial);
+
+ // Update value in state even if the property hasn't fired any event
+ getState().state = getValue();
+ }
+
+ /**
+ * Gets the value of this progress bar. The value is a <code>float</code>
+ * between 0 and 1 where 0 represents no progress at all and 1 represents
+ * fully completed.
+ *
+ * @return the current progress value
+ */
+ @Override
+ public Float getValue() {
+ return super.getValue();
+ }
+
+ /**
+ * Sets the value of this progress bar. The value is a <code>float</code>
+ * between 0 and 1 where 0 represents no progress at all and 1 represents
+ * fully completed.
+ *
+ * @param newValue
+ * the current progress value
+ */
+ @Override
+ public void setValue(Float newValue) {
+ super.setValue(newValue);
+ }
+
+ @Override
+ public Class<Float> getType() {
+ return Float.class;
+ }
+
+ @Override
+ protected ProgressBarState getState() {
+ return (ProgressBarState) super.getState();
+ }
+
+ @Override
+ protected ProgressBarState getState(boolean markAsDirty) {
+ return (ProgressBarState) super.getState(markAsDirty);
+ }
+
+ /**
+ * Sets whether or not this progress indicator is indeterminate. In
+ * indeterminate mode there is an animation indicating that the task is
+ * running but without providing any information about the current progress.
+ *
+ * @param indeterminate
+ * <code>true</code> to set to indeterminate mode; otherwise
+ * <code>false</code>
+ */
+ public void setIndeterminate(boolean indeterminate) {
+ getState().indeterminate = indeterminate;
+ }
+
+ /**
+ * Gets whether or not this progress indicator is indeterminate. In
+ * indeterminate mode there is an animation indicating that the task is
+ * running but without providing any information about the current progress.
+ *
+ * @return <code>true</code> if set to indeterminate mode; otherwise
+ * <code>false</code>
+ */
+ public boolean isIndeterminate() {
+ return getState(false).indeterminate;
+ }
+
+ /*
+ * Overridden to keep the shared state in sync with the AbstractField
+ * internal value. Should be removed once AbstractField is refactored to use
+ * shared state.
+ *
+ * See tickets #10921 and #11064.
+ */
+ @Override
+ protected void setInternalValue(Float newValue) {
+ super.setInternalValue(newValue);
+ if (newValue == null) {
+ newValue = Float.valueOf(0);
+ }
+ getState().state = newValue;
+ }
+
+} \ No newline at end of file
diff --git a/server/src/com/vaadin/ui/ProgressIndicator.java b/server/src/com/vaadin/ui/ProgressIndicator.java
index c481aa1e8f..6da18fc29d 100644
--- a/server/src/com/vaadin/ui/ProgressIndicator.java
+++ b/server/src/com/vaadin/ui/ProgressIndicator.java
@@ -17,24 +17,27 @@
package com.vaadin.ui;
import com.vaadin.data.Property;
+import com.vaadin.shared.communication.PushMode;
import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState;
/**
- * <code>ProgressIndicator</code> is component that shows user state of a
- * process (like long computing or file upload)
- *
- * <code>ProgressIndicator</code> has two main modes. One for indeterminate
- * processes and other (default) for processes which progress can be measured
- *
- * May view an other property that indicates progress 0...1
+ * A {@link ProgressBar} which polls the server for updates.
+ * <p>
+ * Polling in this way is generally not recommended since there is no
+ * centralized management of when messages are sent to the server. Furthermore,
+ * polling might not be needed at all if {@link UI#setPushMode(PushMode)} or
+ * {@link UI#setPollInterval(int)} is used.
*
* @author Vaadin Ltd.
* @since 4
+ * @deprecated as of 7.1, use {@link ProgressBar} combined with
+ * {@link UI#setPushMode(PushMode)} or
+ * {@link UI#setPollInterval(int)} instead.
*/
+@Deprecated
@SuppressWarnings("serial")
-public class ProgressIndicator extends AbstractField<Float> implements
- Property.Viewer, Property.ValueChangeListener {
+public class ProgressIndicator extends ProgressBar {
private ProgressIndicatorServerRpc rpc = new ProgressIndicatorServerRpc() {
@@ -57,7 +60,7 @@ public class ProgressIndicator extends AbstractField<Float> implements
* @param value
*/
public ProgressIndicator(float value) {
- setValue(value);
+ super(value);
registerRpc(rpc);
}
@@ -68,74 +71,18 @@ public class ProgressIndicator extends AbstractField<Float> implements
* @param contentSource
*/
public ProgressIndicator(Property contentSource) {
- setPropertyDataSource(contentSource);
+ super(contentSource);
registerRpc(rpc);
}
@Override
- public void beforeClientResponse(boolean initial) {
- super.beforeClientResponse(initial);
-
- getState().state = getValue();
- }
-
- /**
- * Gets the value of the ProgressIndicator. Value of the ProgressIndicator
- * is Float between 0 and 1.
- *
- * @return the Value of the ProgressIndicator.
- * @see com.vaadin.ui.AbstractField#getValue()
- */
- @Override
- public Float getValue() {
- return super.getValue();
- }
-
- /**
- * Sets the value of the ProgressIndicator. Value of the ProgressIndicator
- * is the Float between 0 and 1.
- *
- * @param newValue
- * the New value of the ProgressIndicator.
- * @see com.vaadin.ui.AbstractField#setValue()
- */
- @Override
- public void setValue(Float newValue) {
- super.setValue(newValue);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.ui.AbstractField#getType()
- */
- @Override
- public Class<Float> getType() {
- return Float.class;
- }
-
- @Override
protected ProgressIndicatorState getState() {
return (ProgressIndicatorState) super.getState();
}
- /**
- * Sets whether or not the ProgressIndicator is indeterminate.
- *
- * @param indeterminate
- * true to set to indeterminate mode.
- */
- public void setIndeterminate(boolean indeterminate) {
- getState().indeterminate = indeterminate;
- }
-
- /**
- * Gets whether or not the ProgressIndicator is indeterminate.
- *
- * @return true to set to indeterminate mode.
- */
- public boolean isIndeterminate() {
- return getState().indeterminate;
+ @Override
+ protected ProgressIndicatorState getState(boolean markAsDirty) {
+ return (ProgressIndicatorState) super.getState(markAsDirty);
}
/**
@@ -154,22 +101,6 @@ public class ProgressIndicator extends AbstractField<Float> implements
* @return the interval in milliseconds.
*/
public int getPollingInterval() {
- return getState().pollingInterval;
- }
-
- /*
- * Overridden to keep the shared state in sync with the AbstractField
- * internal value. Should be removed once AbstractField is refactored to use
- * shared state.
- *
- * See tickets #10921 and #11064.
- */
- @Override
- protected void setInternalValue(Float newValue) {
- super.setInternalValue(newValue);
- if (newValue == null) {
- newValue = 0.0f;
- }
- getState().state = newValue;
+ return getState(false).pollingInterval;
}
}
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
new file mode 100644
index 0000000000..fef1030c63
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
@@ -0,0 +1,33 @@
+/*
+ * 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.shared.ui.progressindicator;
+
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.communication.SharedState;
+
+/**
+ * {@link SharedState} for {@link com.vaadin.ui.ProgressBar}
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class ProgressBarState extends AbstractFieldState {
+
+ public boolean indeterminate = false;
+ public Float state = 0.0f;
+
+} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
index 4126b994d8..f555476be8 100644
--- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
@@ -15,10 +15,7 @@
*/
package com.vaadin.shared.ui.progressindicator;
-import com.vaadin.shared.AbstractFieldState;
-
-public class ProgressIndicatorState extends AbstractFieldState {
- public boolean indeterminate = false;
+@Deprecated
+public class ProgressIndicatorState extends ProgressBarState {
public int pollingInterval = 1000;
- public Float state = 0.0f;
}
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html
new file mode 100644
index 0000000000..b7add101f9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.progressindicator.ProgressBarTest?restartApplication</td>
+ <td></td>
+</tr>
+<!--Add ProgressBar and wait-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td></td>
+</tr>
+<!--Text should not have changed-->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+ <td>0</td>
+</tr>
+<!--Add ProgressIndicator and wait-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td></td>
+</tr>
+<!--Text should have changed-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+ <td>0</td>
+</tr>
+<!--Stop thread right away if we get this far (would otherwise continue running until the UI is detached)-->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java
new file mode 100644
index 0000000000..5afa874220
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.tests.components.progressindicator;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.ProgressBar;
+import com.vaadin.ui.ProgressIndicator;
+
+public class ProgressBarTest extends AbstractTestUI {
+
+ private Label updatedFromBackround;
+ private Thread updateThread = new Thread() {
+ @Override
+ public void run() {
+ Runnable updateTask = new Runnable() {
+ @Override
+ public void run() {
+ counter++;
+ updateLabel();
+ }
+ };
+
+ while (true) {
+ access(updateTask);
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ }
+ };
+ private ProgressBar progressBar;
+ private int counter = 0;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ updatedFromBackround = new Label();
+ updatedFromBackround.setCaption("Updated from background thread");
+ updateLabel();
+ addComponent(updatedFromBackround);
+
+ addComponent(new Button("Use ProgressBar", new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ useComponent(new ProgressBar());
+ }
+ }));
+
+ addComponent(new Button("Use ProgressIndicator",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ useComponent(new ProgressIndicator());
+ }
+ }));
+
+ addComponent(new Button("Stop background thread",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ stopUpdateThread();
+ }
+ }));
+ updateThread.setDaemon(true);
+ updateThread.start();
+ }
+
+ private void useComponent(ProgressBar progressBar) {
+ if (this.progressBar != null) {
+ removeComponent(this.progressBar);
+ }
+ this.progressBar = progressBar;
+ addComponent(progressBar);
+
+ counter = 0;
+ updateLabel();
+ }
+
+ @Override
+ public void detach() {
+ super.detach();
+ stopUpdateThread();
+ }
+
+ private void stopUpdateThread() {
+ if (updateThread != null) {
+ updateThread.interrupt();
+ updateThread = null;
+ }
+ }
+
+ private void updateLabel() {
+ updatedFromBackround.setValue(String.valueOf(counter));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "ProgressBar should work just as ProgressIndicator, just without the polling";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(11925);
+ }
+
+}