I want to show an indeterminate ProgressBar on click of a checkbox in OptionGroup to prevent user interaction until some heavy computation task is performed. I followed the logic specified in
https://vaadin.com/docs/-/part/framework/components/components-progressbar.html
. On the valueChange listener of the checkbox I run a thread. The body of the run method of the thread is as follows.
[code]
getMyComponent().getUI().access(new Runnable() {
@Override public void run() {
showWaitIndicator();
}
});
// Some heavy computation logic
hideWaitIndicator();
[/code]Here showWaitIndicator() method displays the ProgressBar and hideWaitIndicator() method hides it. When I run the code, it happens that sometimes the showWaitIndicator() is executed only after the heavy computation logic and hideWaitIndicator() method are executed resulting in ProgressBar displayed forever. How can I make sure that the logic in the code shown above is executed only in the expected order.
Note: I posted the same question in stackoverflow yesterday - http://stackoverflow.com/questions/40853582/vaadin-send-response-from-heavy-computation-logic but didn’t get any satisfied answer.