Vaadin 7 don't refresh UI after execution background thread (only if it takes more than 5 minutes)

試著忘記壹切 提交于 2019-12-02 05:33:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!