You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProgressIndicatorInvisible.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package com.vaadin.tests.components.progressindicator;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.VerticalLayout;
  5. import com.vaadin.v7.ui.ProgressIndicator;
  6. public class ProgressIndicatorInvisible extends TestBase {
  7. @Override
  8. protected void setup() {
  9. final VerticalLayout lo = new VerticalLayout();
  10. addComponent(lo);
  11. final ProgressIndicator pi = new ProgressIndicator();
  12. pi.setPollingInterval(400);
  13. lo.addComponent(pi);
  14. Button hideProgressIndicator = new Button("Hide progress indicator",
  15. event -> {
  16. pi.setVisible(!pi.isVisible());
  17. event.getButton()
  18. .setCaption((pi.isVisible() ? "Hide" : "Show")
  19. + " progress indicator");
  20. });
  21. addComponent(hideProgressIndicator);
  22. Button disableProgressIndicator = new Button(
  23. "Disable progress indicator", event -> {
  24. pi.setEnabled(!pi.isEnabled());
  25. event.getButton()
  26. .setCaption((pi.isEnabled() ? "Disable" : "Enable")
  27. + " progress indicator");
  28. });
  29. addComponent(disableProgressIndicator);
  30. Button removeProgressIndicator = new Button("Remove progress indicator",
  31. event -> {
  32. if (pi.getParent() != null) {
  33. lo.removeComponent(pi);
  34. event.getButton().setCaption("Add progress indicator");
  35. } else {
  36. lo.addComponent(pi);
  37. event.getButton()
  38. .setCaption("Remove progress indicator");
  39. }
  40. });
  41. addComponent(removeProgressIndicator);
  42. final Button b = new Button("Hide container of progress indicator");
  43. addComponent(b);
  44. b.addClickListener(event -> {
  45. lo.setVisible(!lo.isVisible());
  46. b.setCaption((lo.isVisible() ? "Hide" : "Show")
  47. + " container of progress indicator");
  48. });
  49. }
  50. @Override
  51. protected String getDescription() {
  52. return "Progress indicator does not stop polling when its parent layout is made invisible";
  53. }
  54. @Override
  55. protected Integer getTicketNumber() {
  56. return 4014;
  57. }
  58. }