summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-11-05 16:18:21 +0200
committerArtur Signell <artur@vaadin.com>2012-11-05 16:18:51 +0200
commit2cc6f64aa085e471219567c6d53603b284e6ba71 (patch)
treeaf081c22704124e4a4df03c0f57a55cd9268b7bb
parent5cd3f64548037908979f740626022c88504fd701 (diff)
downloadvaadin-framework-2cc6f64aa085e471219567c6d53603b284e6ba71.tar.gz
vaadin-framework-2cc6f64aa085e471219567c6d53603b284e6ba71.zip
ProgressIndicator now stops polling when removed (#10130)
Change-Id: I9f422d387a95f3f711c575d15973c101792769e7
-rw-r--r--client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java59
2 files changed, 56 insertions, 9 deletions
diff --git a/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java b/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
index 40b3a227c4..a92fea55f9 100644
--- a/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
+++ b/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
@@ -59,6 +59,12 @@ public class ProgressIndicatorConnector extends AbstractFieldConnector {
}
@Override
+ public void onUnregister() {
+ super.onUnregister();
+ poller.cancel();
+ }
+
+ @Override
public VProgressIndicator getWidget() {
return (VProgressIndicator) super.getWidget();
}
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java
index 2c58e9226a..4542d0c6c8 100644
--- a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.progressindicator;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.ProgressIndicator;
import com.vaadin.ui.VerticalLayout;
@@ -18,22 +19,62 @@ public class ProgressIndicatorInvisible extends TestBase {
pi.setPollingInterval(400);
lo.addComponent(pi);
+ Button hideProgressIndicator = new Button("Hide progress indicator",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ pi.setVisible(!pi.isVisible());
+ event.getButton().setCaption(
+ (pi.isVisible() ? "Hide" : "Show")
+ + " progress indicator");
+
+ }
+ });
+ addComponent(hideProgressIndicator);
+
+ Button disableProgressIndicator = new Button(
+ "Disable progress indicator", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ pi.setEnabled(!pi.isEnabled());
+ event.getButton().setCaption(
+ (pi.isEnabled() ? "Disable" : "Enable")
+ + " progress indicator");
+
+ }
+ });
+
+ addComponent(disableProgressIndicator);
+ Button removeProgressIndicator = new Button(
+ "Remove progress indicator", new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (pi.getParent() != null) {
+ lo.removeComponent(pi);
+ event.getButton().setCaption(
+ "Add progress indicator");
+ } else {
+ lo.addComponent(pi);
+ event.getButton().setCaption(
+ "Remove progress indicator");
+ }
+
+ }
+ });
+
+ addComponent(removeProgressIndicator);
final Button b = new Button("Hide container of progress indicator");
addComponent(b);
b.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
- // If we skip hiding the layout, hiding the ProgressIndicator
- // will stop the polling
lo.setVisible(!lo.isVisible());
- // Not even this works
- pi.setVisible(!lo.isVisible());
- if (!lo.isVisible()) {
- b.setCaption("Still polling");
- } else {
- b.setCaption("Hide container of progress indicator");
- }
+ b.setCaption((lo.isVisible() ? "Hide" : "Show")
+ + " container of progress indicator");
}