|
|
|
@ -136,6 +136,27 @@ public class SelectionModel {
|
|
|
|
|
private void unselectedPaste() { |
|
|
|
|
if (designer.getClass().equals(FormDesigner.class)) { |
|
|
|
|
if (selection.getSelectedCreator() instanceof XWFitLayout) { |
|
|
|
|
pasteXWFitLayout(); |
|
|
|
|
} else { |
|
|
|
|
//绝对布局
|
|
|
|
|
//编辑器外面还有两层容器,使用designer.getRootComponent()获取到的是编辑器中层的容器,不是编辑器表层
|
|
|
|
|
//当前选择的就是编辑器表层
|
|
|
|
|
FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(), |
|
|
|
|
clipboard, |
|
|
|
|
DELTA_X_Y, |
|
|
|
|
DELTA_X_Y); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//cpt本地组件复用,编辑器就一层,是最底层,使用designer.getRootComponent()就可以获取到
|
|
|
|
|
//使用selection.getSelectedCreator()也应该是可以获取到的。
|
|
|
|
|
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), |
|
|
|
|
clipboard, |
|
|
|
|
DELTA_X_Y, |
|
|
|
|
DELTA_X_Y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void pasteXWFitLayout() { |
|
|
|
|
if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) { |
|
|
|
|
XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator(); |
|
|
|
|
//tab布局编辑器内部左上角第一个坐标点
|
|
|
|
@ -167,23 +188,6 @@ public class SelectionModel {
|
|
|
|
|
rectangle.y + DELTA_X_Y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//绝对布局
|
|
|
|
|
//编辑器外面还有两层容器,使用designer.getRootComponent()获取到的是编辑器中层的容器,不是编辑器表层
|
|
|
|
|
//当前选择的就是编辑器表层
|
|
|
|
|
FormSelectionUtils.paste2Container(designer, (XLayoutContainer) selection.getSelectedCreator(), |
|
|
|
|
clipboard, |
|
|
|
|
DELTA_X_Y, |
|
|
|
|
DELTA_X_Y); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//cpt本地组件复用,编辑器就一层,是最底层,使用designer.getRootComponent()就可以获取到
|
|
|
|
|
//使用selection.getSelectedCreator()也应该是可以获取到的。
|
|
|
|
|
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), |
|
|
|
|
clipboard, |
|
|
|
|
DELTA_X_Y, |
|
|
|
|
DELTA_X_Y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -404,19 +408,33 @@ public class SelectionModel {
|
|
|
|
|
if (x < (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) { |
|
|
|
|
return Location.outer; |
|
|
|
|
} else if ((x >= (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) && (x <= bounds.x)) { |
|
|
|
|
return getDirectionLeft(bounds, y); |
|
|
|
|
} else if ((x > bounds.x) && (x < (bounds.x + bounds.width))) { |
|
|
|
|
return getDirectionCenter(bounds, y); |
|
|
|
|
} else if ((x >= (bounds.x + bounds.width)) |
|
|
|
|
&& (x <= (bounds.x + bounds.width + XCreatorConstants.RESIZE_BOX_SIZ))) { |
|
|
|
|
return getDirectionRight(bounds, y); |
|
|
|
|
} else { |
|
|
|
|
return Location.outer; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Direction getDirectionRight(Rectangle bounds, int y) { |
|
|
|
|
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) { |
|
|
|
|
return Location.outer; |
|
|
|
|
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) { |
|
|
|
|
return Location.left_top; |
|
|
|
|
return Location.right_top; |
|
|
|
|
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) { |
|
|
|
|
return Location.left; |
|
|
|
|
return Location.right; |
|
|
|
|
} else if ((y >= (bounds.y + bounds.height)) |
|
|
|
|
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) { |
|
|
|
|
return Location.left_bottom; |
|
|
|
|
return Location.right_bottom; |
|
|
|
|
} else { |
|
|
|
|
return Location.outer; |
|
|
|
|
} |
|
|
|
|
} else if ((x > bounds.x) && (x < (bounds.x + bounds.width))) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Direction getDirectionCenter(Rectangle bounds, int y) { |
|
|
|
|
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) { |
|
|
|
|
return Location.outer; |
|
|
|
|
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) { |
|
|
|
@ -429,20 +447,18 @@ public class SelectionModel {
|
|
|
|
|
} else { |
|
|
|
|
return Location.outer; |
|
|
|
|
} |
|
|
|
|
} else if ((x >= (bounds.x + bounds.width)) |
|
|
|
|
&& (x <= (bounds.x + bounds.width + XCreatorConstants.RESIZE_BOX_SIZ))) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Direction getDirectionLeft(Rectangle bounds, int y) { |
|
|
|
|
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) { |
|
|
|
|
return Location.outer; |
|
|
|
|
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) { |
|
|
|
|
return Location.right_top; |
|
|
|
|
return Location.left_top; |
|
|
|
|
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) { |
|
|
|
|
return Location.right; |
|
|
|
|
return Location.left; |
|
|
|
|
} else if ((y >= (bounds.y + bounds.height)) |
|
|
|
|
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) { |
|
|
|
|
return Location.right_bottom; |
|
|
|
|
} else { |
|
|
|
|
return Location.outer; |
|
|
|
|
} |
|
|
|
|
return Location.left_bottom; |
|
|
|
|
} else { |
|
|
|
|
return Location.outer; |
|
|
|
|
} |
|
|
|
|