protected void setup() {
final VerticalLayout lo = new VerticalLayout();
addComponent(lo);
final ProgressIndicator pi = new ProgressIndicator();
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);