Browse Source

tab 间组件复用

master
yaoh.wu 8 years ago
parent
commit
3fcec33cc9
  1. 4
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java
  2. 4
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

4
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java

@ -63,9 +63,11 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
// 经过accept判断后,container会被改变,先备份 // 经过accept判断后,container会被改变,先备份
XLayoutContainer backUpContainer = container; XLayoutContainer backUpContainer = container;
Rectangle rect = ComponentUtils.getRelativeBounds(container); Rectangle rect = ComponentUtils.getRelativeBounds(container);
System.out.println("xy: " + x + "\t" + y);
System.out.println(rect);
int posX = x - rect.x; int posX = x - rect.x;
int posY = y - rect.y; int posY = y - rect.y;
System.out.println("pos: " + posX + "\t" + posY);
if (!accept(creator, posX, posY)) { if (!accept(creator, posX, posY)) {
return false; return false;
} }

4
designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -29,7 +29,7 @@ import com.fr.stable.ArrayUtils;
public class SelectionModel { public class SelectionModel {
//被粘贴组件在所选组件位置处往下、往右各错开20像素。执行多次粘贴时,在上一次粘贴的位置处错开20像素。 //被粘贴组件在所选组件位置处往下、往右各错开20像素。执行多次粘贴时,在上一次粘贴的位置处错开20像素。
private static final int DELTA_X_Y = 20; //粘贴时候的偏移距离 private static final int DELTA_X_Y = 20; //粘贴时候的偏移距离
private static final int BORDER_PROPORTION = 10; private static final int BORDER_PROPORTION = 20;
private static FormSelection CLIP_BOARD = new FormSelection(); private static FormSelection CLIP_BOARD = new FormSelection();
private FormDesigner designer; private FormDesigner designer;
private FormSelection selection; private FormSelection selection;
@ -161,7 +161,7 @@ public class SelectionModel {
if (selection.getSelectedCreator().getParent() instanceof XWFitLayout) { if (selection.getSelectedCreator().getParent() instanceof XWFitLayout) {
//自适应布局 //自适应布局
if (parent != null) { if (parent != null) {
Rectangle rec = selection.getSelctionBounds(); Rectangle rec = selection.getRelativeBounds();
FormSelectionUtils.paste2Container(designer, parent, CLIP_BOARD, rec.x + rec.width / 2, rec.y + FormSelectionUtils.paste2Container(designer, parent, CLIP_BOARD, rec.x + rec.width / 2, rec.y +
rec.height - BORDER_PROPORTION); rec.height - BORDER_PROPORTION);
} }

Loading…
Cancel
Save