From e950feb1f5ecbaa057cc36c8bbcc56d40e15a221 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 9 Sep 2019 13:45:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-21202=20tab=E5=9D=97=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E8=8F=9C=E5=8D=95=E6=A0=B7=E5=BC=8F=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E6=94=B9=E4=B8=8D=E5=9B=9E=E9=BB=98=E8=AE=A4=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/SelectionModel.java | 47 +++++++------------ .../fr/design/mainframe/FormSelection.java | 6 ++- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index c7121f0e1..76eb60230 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -18,7 +18,9 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.stable.ArrayUtils; -import java.awt.*; +import java.awt.LayoutManager; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -175,36 +177,19 @@ public class SelectionModel { } private void pasteXWFitLayout() { - if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) { - XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator(); - //tab布局编辑器内部左上角第一个坐标点 - int leftUpX = container.toData().getMargin().getLeft() + 1; - int leftUpY = container.toData().getMargin().getTop() + 1; - //选中第一个坐标点坐在的组件 - selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY)); - Rectangle rectangle = selection.getRelativeBounds(); - if (hasSelectedPasteSource()) { - selectedPaste(); - } else { - FormSelectionUtils.paste2Container(designer, container, clipboard, - rectangle.x + rectangle.width / 2, - rectangle.y + DELTA_X_Y); - } + //自适应布局编辑器内部左上角第一个坐标点 + int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; + int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; + //选中第一个坐标点坐在的组件 + selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); + Rectangle rectangle = selection.getRelativeBounds(); + if (hasSelectedPasteSource()) { + selectedPaste(); } else { - //自适应布局编辑器内部左上角第一个坐标点 - int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; - int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; - //选中第一个坐标点坐在的组件 - 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); - } + FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), + clipboard, + rectangle.x + rectangle.width / 2, + rectangle.y + DELTA_X_Y); } } @@ -497,4 +482,4 @@ public class SelectionModel { selection.setSelectedCreators(rebuildSelection); fireCreatorSelected(); } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java index 8d223c245..c7d7d8c15 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java @@ -11,6 +11,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; +import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; @@ -317,6 +318,9 @@ public class FormSelection { clipBoard.reset(); for (XCreator root : selection) { + if(root.acceptType(XWTabFitLayout.class)){ + continue; + } try { XCreator creator = XCreatorUtils.createXCreator((Widget) root.toData().clone()); creator.setBounds(root.getBounds()); @@ -326,4 +330,4 @@ public class FormSelection { } } } -} \ No newline at end of file +}