We have a View built with Vaadin Designer, a gird inside and we need to refresh the data provider when a broadcast message is received.
The broadcast is like the one presented here:
https://vaadin.com/docs/-/part/framework/advanced/advanced-push.html
The problem is that in the method where the message is received, the UI is null and the refreshAll method of data provider has no effect.
The refresh works if dataProvider.refreshAll() is called via a button or at any click on grid header.
I tried in several ways without success. Bellow is an example.
@SpringView
@PrototypeScope
public class MyView extends MyViewDesign
implements View, Broadcaster.BroadcastListener {
...
@Override
public void receiveBroadcast(String message) {
grid.getUI().access(new Runnable() {
@Override
public void run() {
dataProvider.refreshAll();
}
});
}
}
Thank you!