Matthias95
(Matthias Rauer)
1
Hello,
is there any example like this:
http://demo.vaadin.com/sampler/#foundation/push
with a table or treeview, which several users can edit on different clients.
User A edits cell B1 => User B edits cell C2
User C get all changes in the table view.
Every user (A,B,C) got the same view at the end.
Greeting from Germany,
Matthias
Matthias95
(Matthias Rauer)
2
Here is my solution using JPAContainer and Broadcast:
private TextField currentTextField = null;
private JPAContainer<AbstractA> jpaContainer;
public void receiveBroadcast(Object change) {
if (currentTextField == null) {
jpaContainer.refreshItem(change);
} else {
currentTextField = null;
}
}
TextField textField = (TextField) super.createField(container, itemId, propertyId, uiContext);
textField.setImmediate(true);
textField.addBlurListener(new FieldEvents.BlurListener() {
@Override
public void blur(FieldEvents.BlurEvent event) {
currentTextField = textField;
Broadcaster.broadcast(itemId);
}
});
Broadcasting refer:
https://vaadin.com/wiki/-/wiki/Main/Broadcasting+messages+to+other+users
Changed parameter from String to Object.
@Override
public void receiveBroadcast(final Object change) {
if (change instanceof Long) {
getTable().receiveBroadcast(change);
} else {
After leaving the table cell, all other clients will see change.
Is there any solution for highlighting a table cell for one second?