From 568cf34dc65fa13e4efe4d2f2ab8c377732c7827 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 24 Nov 2021 18:37:02 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-63305=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=88=B6=E5=AE=B9=E5=99=A8=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=AF=B9=E6=8B=93=E5=B1=95=E7=9A=84=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 26 +++++++++++++++++++ .../widget/ui/FormSingleWidgetCardPane.java | 7 ++--- .../designer/component/WidgetBoundPane.java | 10 ++----- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 2f797efa4..6445e001b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -57,6 +57,7 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.invoke.Reflect; @@ -68,6 +69,7 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nonnull; +import java.util.Set; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; @@ -375,4 +377,28 @@ public class XCreatorUtils { return xCreator; } + + public static boolean isExtraContainer(XCreator creator) { + Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG); + for (FormWidgetOptionProvider provider : set) { + if (provider.isContainer() + && ComparatorUtils.equals(provider.appearanceForWidget(), provider.appearanceForWidget()) + && ComparatorUtils.equals(provider.classForWidget(), creator.toData().getClass())) { + return true; + } + } + return false; + } + + public static XLayoutContainer getParent(XCreator source) { + if (source.acceptType(XWCardTagLayout.class) ) { + return (XLayoutContainer)source.getParent(); + } + XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); + boolean accept = (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) && !isExtraContainer(source); + if (accept) { + container = null; + } + return container; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java index 1fd1a3527..491b42b2b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormSingleWidgetCardPane.java @@ -67,12 +67,9 @@ public class FormSingleWidgetCardPane extends FormWidgetCardPane { initDefinePane(); } + @Deprecated public XLayoutContainer getParent(XCreator source) { - XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); - if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { - container = null; - } - return container; + return XCreatorUtils.getParent(source); } public WidgetBoundPane createWidgetBoundPane(XCreator xCreator) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index aee83889e..f711eb157 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -61,15 +61,9 @@ public class WidgetBoundPane extends BasicPane { initBoundPane(); } + @Deprecated public XLayoutContainer getParent(XCreator source) { - if(source.acceptType(XWCardTagLayout.class)){ - return (XLayoutContainer)source.getParent(); - } - XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source); - if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) { - container = null; - } - return container; + return XCreatorUtils.getParent(source); } public void initBoundPane() {