bus.fireEvent(new FormItemRemovedEvent(formItem));
Integer oldX = (Integer) event.getData("oldMovableX");
Integer oldY = (Integer) event.getData("oldMovableY");
HasWidgets panel2 = layoutView.getUnderlyingLayout(oldX, oldY);
panel2.add(formItem);
bus.fireEvent(new FormItemAddedEvent(formItem, (Widget) panel2));
}
@Override
public void doAction(UndoableEvent event) {
FBFormItem formItem = (FBFormItem) event.getData("formItem");
MovablePanel movable = (MovablePanel) event.getData("movable");
Integer x = (Integer) event.getData("x");
Integer y = (Integer) event.getData("y");
if (formItem != null) {
bus.fireEvent(new FormItemRemovedEvent(formItem));
HasWidgets dropContainer = layoutView.getUnderlyingLayout(x, y);
Widget previousContainer = formItem.getParent();
if (previousContainer instanceof FBForm) {
FBForm formDisplay = (FBForm) previousContainer;
formDisplay.remove(movable);
formDisplay.remove(formItem);
} else {
LayoutFormItem layoutItem = (LayoutFormItem) ((Widget) previousContainer).getParent();
layoutItem.remove(movable);
layoutItem.remove(formItem);
}
if (dropContainer instanceof FBForm) {
FBForm formDisplay = (FBForm) dropContainer;
formDisplay.replacePhantom(formItem);
} else {
LayoutFormItem layoutItem = (LayoutFormItem) ((Widget) dropContainer).getParent();
layoutItem.replacePhantom(formItem);
}
bus.fireEvent(new FormItemAddedEvent(formItem, (Widget) dropContainer));
}
}
}));
}