Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Wait cursor/threading?

Chris McGee
6 years ago Mar 07, 2016 10:08pm
Alejandro Duarte
6 years ago Mar 11, 2016 10:41am

Hi, let's soften that wrinkle ;)

Any time you have to perform a long-running task it's a good idea to execute it in a separate thread. In your case using Java threads directly sounds like a good fit.

In Vaadin applications, when your listener (e.g. ClickListener or ValueChangeListener) gets invoked you can do the following:

  1. Add a spinner to the UI. An indeterminate ProgressIndicator is a good option: progressIndicator.
  2. setIndeterminate(true).
  3. Run the long-running task in a separate thread. At this point the first thread (the one invoking the listener) finnishes and the user is able to see the spinner.
  4. Once the "separate thread" complete the long-running task, remove the spinner with the help of the UI.access(Runnable) method.

Check out this example.

Chris McGee
6 years ago Mar 22, 2016 8:08pm
Chris McGee
6 years ago Apr 07, 2016 6:35pm
Alejandro Duarte
5 years ago Apr 18, 2016 7:31am


Did you annotate your UI implementation with @Push?

Chris McGee
5 years ago Apr 18, 2016 12:34pm
Alejandro Duarte
5 years ago Apr 18, 2016 12:36pm
Chris McGee
5 years ago Apr 18, 2016 4:49pm