Well, I think it’s self-explaining what I’d like to do. And maybe you already know what happens: The ProgressIndicator isn’t being shown. The component is visually not added before, I think, the whole buttonClick() finished. I already tried to add progressIndicator.requestRepaint() but it doesn’t seem to do what I expect.
Can you explain me, and give me a solution?
Thanks
this is because you’re doing all the stuff (show progress, do the things, hide progress) in one event in a click listener, which corresponds to a single request from a client - no changes sent to the client UI until your click listener ends and when it ends - client displays the last state - after all work is done.
If your “do the things” part is lenghty, you need to show progress indicator in your click listener, then start a separate server thread with actual operations you perform and return. This way, client will get a response with a progress indicator visible and display it to the user and separate thread will perform its work. At the end of the thread logic, hide progress indicator and display next step page,etc. Also, do not forget to enable polling in your progress indicator, or it will run forever until you refresh a page manually.
I resolved it by spawning a new thread.
But as vaadin advertises with “forget that you’re writing a web application” (i read something similar to this :P), it would be cool if, if it is possible, you could make such code running as expected But it’s not very important… if you just document “issues” like that.
omg i think there are a lot of mistakes in my sentences, but I hope you got me
Actually, this is just like in a Swing application - doing intensive computation stuff in a button click listener will stuck your UI and you’ll not see a progress update until spawn a separate thread
Of cousre, web framework still adds its corrections, like polling from UI and progress indicator tricks, but this going to be addressed in later releases