From 04bac5d214bddc2ff1d1febdfdc1c0a79e8dcad8 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 23 Aug 2021 17:21:19 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-57590=20=E8=A1=A8=E5=8D=95=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E4=B8=8D=E5=BA=94=E8=AF=A5=E8=83=BD?= =?UTF-8?q?=E8=A2=AB=E5=A4=8D=E5=88=B6=E5=88=B0=E5=AE=B9=E5=99=A8=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XWParameterLayout.java | 10 +++++++ .../design/mainframe/FormSelectionUtils.java | 27 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java index 1d37024d9..f60aa9846 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java @@ -103,6 +103,16 @@ public class XWParameterLayout extends XWAbsoluteLayout { return false; } + @Override + public boolean canEnterIntoAbsolutePane() { + return false; + } + + @Override + public boolean canEnterIntoAdaptPane() { + return false; + } + /** * 该组件是否可以拖拽(表单中参数面板和自适应布局不可以拖拽) * @return 是则返回true diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index 2900650aa..84b8f6bf3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -10,6 +10,7 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; 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.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; @@ -60,6 +61,11 @@ public class FormSelectionUtils { */ public static void paste2Container(FormDesigner designer, XLayoutContainer parent, FormSelection clipboard, int x, int y) { + clipboard = filterFormSelection(clipboard, parent); + if (clipboard.isEmpty()) { + Toolkit.getDefaultToolkit().beep(); + return; + } LayoutAdapter adapter = parent.getLayoutAdapter(); if (parent instanceof XWAbsoluteLayout) { //绝对布局 @@ -77,6 +83,27 @@ public class FormSelectionUtils { Toolkit.getDefaultToolkit().beep(); } + private static FormSelection filterFormSelection(FormSelection clipboard, XLayoutContainer parent) { + FormSelection newSelection = new FormSelection(); + for (XCreator xCreator : clipboard.getSelectedCreators()) { + if (parent.acceptType(XWParameterLayout.class)) { + if (xCreator.canEnterIntoParaPane()) { + newSelection.addSelectedCreator(xCreator); + } + } else if (parent.acceptType(XWAbsoluteLayout.class)) { + if (xCreator.canEnterIntoAbsolutePane()) { + newSelection.addSelectedCreator(xCreator); + } + } else if (parent.acceptType(XWFitLayout.class)) { + if (xCreator.canEnterIntoAdaptPane()) { + newSelection.addSelectedCreator(xCreator); + } + } + + } + return newSelection; + } + private static boolean isExtraContainer(XLayoutContainer parent) { if (parent != null) { Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);