问题
I'm using Vaadin 7. In my application there's a table list and user could choice one or more items to elaborate. If execute button is clicked, UI component are disabled and two Threads start: 1st Thread does heavy computation 2nd Thread updating progress indicator on UI (with lock() and unlock() method)
At the end 1st Thread:
item is deleted from DB, all component removed and re-added (enabled). In this way refreshing table data is assured.
It works well, but when a long task is processed UI doesn't refresh and table are disabled yet.
Anybody could help me?
Many Thanks
回答1:
See https://vaadin.com/forum#!/thread/231272
In short - in Vaadin 6.0 and 7.0, you cannot "push" a change from the server to the browser from a non-request thread. (There are plugins for v6, but not for v7.0)
In Vaadin 7.1 (not yet released) this is possible. See https://vaadin.com/wiki/-/wiki/Main/Enabling+server+push for more details.
回答2:
You could use a component which refreshes periodically like the ProgressIndicator. Disable it after the thread has finished. That works for me.
来源:https://stackoverflow.com/questions/16301476/vaadin-7-dont-refresh-ui-after-execution-background-thread-only-if-it-takes-mo