dataSnapshot.put("selectedY", getParent().getAbsoluteTop());
dataSnapshot.put("item", getItem());
bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
@Override
public void undoAction(UndoableEvent event) {
TabbedLayoutFormItem item = (TabbedLayoutFormItem) event.getData("item");
Integer selectedX = (Integer) event.getData("selectedX");
Integer selectedY = (Integer) event.getData("selectedY");
FBFormItem[] deletedTab = (FBFormItem[]) event.getData("deletedTab");
int tabNumber = item.getTabForCoordinates(selectedX, selectedY);
item.insertTab(tabNumber, (TabbedLayoutFormItem.TabLabelFormItem) deletedTab[0], (FlowLayoutFormItem) deletedTab[1]);
}
@Override
public void onEvent(UndoableEvent event) { }
@Override
public void doAction(UndoableEvent event) {
TabbedLayoutFormItem item = (TabbedLayoutFormItem) event.getData("item");
Integer selectedX = (Integer) event.getData("selectedX");
Integer selectedY = (Integer) event.getData("selectedY");
int tabNumber = item.getTabForCoordinates(selectedX, selectedY);
FBFormItem[] deletedTab = item.removeTab(tabNumber);
event.setData("deletedTab", deletedTab);
}
}));
}