ProgressBar for heavy computation

Dear all,

I want to use a ProgressBar for heavy computations (monte-carlo simulations). Sadly I do not know how that could work, if the computation is not performed within the same class (respectively even not within the UI project). So far, I thought I just have to add the ProgressBar like this: BeanItem<SimulationProcess> beanItem = new BeanItem<SimulationProcess>(this.simulationProcess); Property<Float> propertyRatio = beanItem.getItemProperty("finishingRatio"); this.progressBar = new ProgressBar(propertyRatio); this.addComponent(this.progressBar) And then start the simulation. The value of “finishingRatio” is updated within the operation “performSimulation”, so I hoped the progressBar automatically updateds its value each 500ms, but it does not.

public void startSimulation() { UI.getCurrent().setPollInterval(500); this.simulationProcess.performSimulation(); } Has anyone an idea how to deal with that problem?

Best regards


Hello Patric,
recently I read about ProgressIndicator in the book “Vaadin 7 UI Design By Example” by Alejandro Duarte. I’m new at Vaadin framework and started with version 8.1.3. There are some differences regarding version 7. I think one should use ProgressBar now. This led me to the following program (created with Vaadin 8.1.4 and the plugin for Eclipse). A worker thread class

package my.vaadin.progressapp;

import com.vaadin.ui.ProgressBar;

public class HightechAlgorithm extends Thread {

private ProgressBar theProgressBar;

public void setProgressIndicator(ProgressBar progressBar) {
theProgressBar = progressBar;
} // setProgressIndicator

public void run() {
try {
if(theProgressBar != null) {

for (int i = 1; i <= 10; i++) {
if(theProgressBar != null) {
theProgressBar.setValue(i / 10f);
} catch (InterruptedException e) {
} // run

} // end of class HightechAlgorithm
[/code]and the UI class

package my.vaadin.progressapp;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.ProgressBar;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

public class ProgressUI extends UI {

private static final long serialVersionUID = 1L;

private ProgressBar theProgressBar;

protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
theProgressBar = new ProgressBar();

Button button = new Button("Start hightech algorithm", e -> {
HightechAlgorithm hta = new HightechAlgorithm();


@WebServlet(urlPatterns = "/*", name = "ProgressUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = ProgressUI.class, productionMode = false)
public static class ProgressUIServlet extends VaadinServlet {

private static final long serialVersionUID = 1L;
} // end of class ProgreesUI

Maybe this code can help you find a solution since you are using ProgressBar, too.

Best regards