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;