The ProgressBar component is designed to display the progress of a long process.

gui progressBar

XML name of the component: progressBar

Below is an example of the component usage together with the background tasks mechanism:

<progressBar id="progressBar" width="100%"/>
private ProgressBar progressBar;
private BackgroundWorker backgroundWorker;

private static final int ITERATIONS = 5;

protected void onInit(InitEvent event){
    BackgroundTask<Integer, Void> task = new BackgroundTask<Integer, Void>(300, getWindow()) {
        public Void run(TaskLifeCycle<Integer> taskLifeCycle) throws Exception{
            for(int i = 1; i <= ITERATIONS; i++) {
                TimeUnit.SECONDS.sleep(2); (1)
            return null;

        public void progress(List<Integer> changes){
            double lastValue = changes.get(changes.size() - 1);
            progressBar.setValue((lastValue / ITERATIONS));

    BackgroundTaskHandler taskHandler = backgroundWorker.handle(task);
1 some time consuming task

Here in the BackgroundTask.progress() method, which is executed in UI thread, the ProgressBar component is set to the current value. The component value should be a double number from 0.0 to 1.0.

The changes of the ProgressBar value can be tracked using the ValueChangeListener. The origin of the ValueChangeEvent can be tracked using isUserOriginated() method.

If a running process is unable to send information about the progress, an indeterminate state of the indicator can be displayed. Set the indeterminate to true to show an indeterminate state. Default is false. For example:

<progressBar id="progressBar" width="100%" indeterminate="true"/>

By default indeterminate progress bar is displayed as horizontal bar. To make it a spinning wheel instead, set the attribute stylename="indeterminate-circle".

To make the progress bar indicator appear as a dot which progresses over the progress bar track (instead of a growing bar), use the point predefined style: