Browse Source

Merge pull request #1360 in DESIGN/design from ~KERRY/design_10.0:bugfix/10.0 to bugfix/10.0

* commit '4f24288c06c345e9e9eaa70d458b7de2544839bf':
  REPORT-24117 这部分代码回退,当时的bug REPORT-21202修改FormSelection就可以避免tab的复制
bugfix/10.0
kerry 5 years ago
parent
commit
9b400bac0e
  1. 45
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

45
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -18,9 +18,7 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import java.awt.LayoutManager; import java.awt.*;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
@ -177,19 +175,36 @@ public class SelectionModel {
} }
private void pasteXWFitLayout() { private void pasteXWFitLayout() {
//自适应布局编辑器内部左上角第一个坐标点 if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) {
int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator();
int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; //tab布局编辑器内部左上角第一个坐标点
//选中第一个坐标点坐在的组件 int leftUpX = container.toData().getMargin().getLeft() + 1;
selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); int leftUpY = container.toData().getMargin().getTop() + 1;
Rectangle rectangle = selection.getRelativeBounds(); //选中第一个坐标点坐在的组件
if (hasSelectedPasteSource()) { selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY));
selectedPaste(); Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, container, clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
} else { } else {
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), //自适应布局编辑器内部左上角第一个坐标点
clipboard, int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1;
rectangle.x + rectangle.width / 2, int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1;
rectangle.y + DELTA_X_Y); //选中第一个坐标点坐在的组件
selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY));
Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
} }
} }

Loading…
Cancel
Save