From b06cfadd2becfe64cd7e2d211f31d54418408bb4 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 30 Sep 2021 16:59:04 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-60403=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E3=80=91=E5=85=BC=E5=AE=B9=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E4=B8=8B=E7=94=9F=E6=88=90=E7=9A=84=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E8=BF=98=E6=98=AF=E5=AD=98=E4=BA=86=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 若生成共享组件时使用的时兼容主题,则共享组件那的样式应当时自定义状态 【改动思路】 同上 --- .../share/generate/task/ComponentCreator.java | 11 +++++++++-- .../mainframe/share/util/ShareComponentUtils.java | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java index 126660665a..ed1c2a91db 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentCreator.java @@ -4,6 +4,7 @@ import com.fr.base.TableData; import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.theme.TemplateTheme; +import com.fr.base.theme.TemplateThemeConfig; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.share.generate.impl.AbstractComponentCreatorProcessor; @@ -18,6 +19,7 @@ import com.fr.form.share.utils.ShareUtils; import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.ui.Widget; import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; import com.fr.stable.fun.IOFileAttrMark; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; @@ -61,8 +63,13 @@ public class ComponentCreator extends AbstractComponentCreatorProcessor { private void setSuitableTemplateThemeName(JTemplate jt, DefaultSharableWidget info) { TemplateTheme theme = jt.getTemplateTheme(); - if (theme != null) { - info.setSuitableTemplateThemeName(theme.getName()); + if (theme != null ) { + String name = theme.getName(); + TemplateThemeConfig config = jt.getUsingTemplateThemeConfig(); + String name4LegacyTemplate = config.getThemeName4LegacyTemplate(); + if (!StringUtils.equals(name, name4LegacyTemplate)) { + info.setSuitableTemplateThemeName(name); + } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java index 0dd613975e..c9da573914 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.util; import com.fr.base.io.IOFile; import com.fr.base.iofile.attr.ExtendSharableAttrMark; import com.fr.base.theme.FormTheme; +import com.fr.base.theme.FormThemeConfig; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeCompatible; import com.fr.design.designer.creator.XCreator; @@ -58,9 +59,11 @@ public class ShareComponentUtils { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); TemplateTheme theme = template.getTemplateTheme(); if (theme instanceof FormTheme) { + String themeName4LegacyTemplate = FormThemeConfig.getInstance().getThemeName4LegacyTemplate(); boolean isCurrentUsingThemeSuitSharedComponent = StringUtils.isNotEmpty(theme.getName()) && StringUtils.isNotEmpty(suitableTemplateThemeName) && - StringUtils.equals(theme.getName(), suitableTemplateThemeName); + StringUtils.equals(theme.getName(), suitableTemplateThemeName) && + !StringUtils.equals(theme.getName(), themeName4LegacyTemplate); XCreatorUtils.setupTemplateTheme(creator, false, (FormTheme) theme, isCurrentUsingThemeSuitSharedComponent ? TemplateThemeCompatible.NONE : TemplateThemeCompatible.ABSENT); } return creator;