dataSnapshot.put("item", getItem());
bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
@Override
@SuppressWarnings("unchecked")
public void undoAction(UndoableEvent event) {
TableLayoutFormItem item = (TableLayoutFormItem) event.getData("item");
Integer selectedX = (Integer) event.getData("selectedX");
List<FBFormItem> deletedColumn = (List<FBFormItem>) event.getData("deletedColumn");
int colNumber = item.getColumnForXCoordinate(selectedX);
item.addColumn(colNumber);
item.insertColumnElements(colNumber, deletedColumn);
}
@Override
public void onEvent(UndoableEvent event) { }
@Override
public void doAction(UndoableEvent event) {
TableLayoutFormItem item = (TableLayoutFormItem) event.getData("item");
Integer selectedX = (Integer) event.getData("selectedX");
int colNumber = item.getColumnForXCoordinate(selectedX);
List<FBFormItem> deletedColumn = item.removeColumn(colNumber);
event.setData("deletedColumn", deletedColumn);
}
}));
}