@Override
protected Command getCreateCommand(CreateRequest request) {
Object newObject = request.getNewObject();
if (newObject instanceof FormItemInfo) {
final FormItemInfo item = (FormItemInfo) newObject;
return new EditCommand(m_form) {
@Override
protected void executeEdit() throws Exception {
placementsSupport.commitAdd();
Rectangle widgetModelBounds = item.getModelBounds();
m_form.command_CREATE(item, null);
m_form.command_BOUNDS(item, widgetModelBounds.getLocation(), widgetModelBounds.getSize());
}
};
}
if (newObject instanceof CanvasInfo) {
final CanvasInfo canvas = (CanvasInfo) newObject;
return new EditCommand(m_form) {
@Override
protected void executeEdit() throws Exception {
placementsSupport.commitAdd();
Rectangle widgetModelBounds = canvas.getModelBounds();
m_form.command_CREATE(canvas, null);