I have a Vaadin application, that I like to be "live", so that when different people have opened the application, they see changes made by another person directly, without refreshing their page.
How can I do this ?
The application consists currently of two panels, with components in them, which can be dragged and dropped.
Now I like to see a drag and drop in all open browser views, so that when person A has drag and dropped something, that this is automatically shown in the other views.
I currently can only make this, when the others are refreshing their view (I use Vaadin 7.6.6)
UPDATE
@Push
private static final class MyPanel extends Panel implements BroadcastListener {
@Override
public void attach() {
Broadcaster.register(this);
super.attach();
}
@Override
public void detach() {
Broadcaster.unregister(this);
super.detach();
}
@Override
public void receiveBroadcast(BroadcastMessage message) {
System.out.println("BROADCOAST " + message);
}
}
private Panel createTaskPanel(Status status) {
Panel tasks = new MyPanel();
tasks.setHeight("500px");
VerticalLayout taskLayout = new VerticalLayout();
taskLayout.setSpacing(true);
taskLayout.setMargin(true);
TaskContainer.get().getTasks().filter(task -> task.getStatus() == status).map(TaskComponent::new)
.map(TaskComponent::getDragAndDrop).forEach(taskLayout::addComponent);
DragAndDropWrapper wrapper = new DragAndDropWrapper(taskLayout);
wrapper.setDropHandler(new DropHandlerImplementation(status, taskLayout));
tasks.setContent(wrapper);
return tasks;
}