Hi All,
I am trying to update UI from a background thread and I am using Push functionality.
The way I do it is:
[code]
@Configurable
public class MyClassUI extends DocumentDesign {
…
private UI currentUI;
public MyClassUI() {
this.currentUI = UI.getCurrent();
}
…
public void myEventHandler(SomeEvent event) {
currentUI.access(new Runnable() {
@Override
public void run() {
…
}
});
}
[/code]Problem arises when user refreshes the UI - the old UI instance (this.currentUI) looses its VaadinSession instance and I get UIDetachedException exception. I understand that without PreserveOnRefresh annotation the UI gets “replaced” by a new one. But is there a way to hook up somehow to propagate that change of UI to my class which is then used by a background thread invoking myEventHandler method ? I would like to avoid the PreserveOnRefresh functionality …
Thanks,
Adrian