}
@Override
protected void createStyles() {
FBFormItem item = getItem();
MIGLayoutFormItem container = getContainer(item);
Map<String, Object> dataSnapshot = new HashMap<String, Object>();
dataSnapshot.put("item", item);
dataSnapshot.put("container", container);
dataSnapshot.put("oldColspan", container.getColSpan(item));
dataSnapshot.put("oldRowspan", container.getRowSpan(item));
dataSnapshot.put("newColspan", colspan.getValue());
dataSnapshot.put("newRowspan", rowspan.getValue());
UndoableHandler rollbackHandler = new UndoableHandler() {
@Override
public void onEvent(UndoableEvent event) { }
@Override
public void doAction(UndoableEvent event) {
Integer rowspan = (Integer) event.getData("newRowspan");
Integer colspan = (Integer) event.getData("newColspan");
MIGLayoutFormItem container = (MIGLayoutFormItem) event.getData("container");
FBFormItem item = (FBFormItem) event.getData("item");
container.setSpan(item, colspan, rowspan);
}
@Override
public void undoAction(UndoableEvent event) {
Integer rowspan = (Integer) event.getData("oldRowspan");
Integer colspan = (Integer) event.getData("oldColspan");
MIGLayoutFormItem container = (MIGLayoutFormItem) event.getData("container");
FBFormItem item = (FBFormItem) event.getData("item");
container.setSpan(item, colspan, rowspan);
}
};
bus.fireEvent(new UndoableEvent(dataSnapshot, rollbackHandler));
container.setSpan(item, colspan.getValue(), rowspan.getValue());
}