From d3fc401e9e619a6970e59aff21eb7ca9648dee99 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 24 Aug 2021 13:41:53 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-51919=20=E4=B8=BB=E9=A2=98=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 新增模版主题功能: 从主题配置中获取主题名称和获取主题数据的开销不同, 在方法上要做区分,尽量使用主题名称完成业务逻辑 【改动思路】 同上 --- .../main/java/com/fr/design/mainframe/JTemplate.java | 3 +-- .../fr/design/mainframe/theme/TemplateThemeBlock.java | 3 +-- .../design/mainframe/theme/TemplateThemeListPane.java | 2 +- .../mainframe/theme/TemplateThemeManagePane.java | 10 ++++------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 2567ab7b8b..1eebed739f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -92,7 +92,6 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.SwingConstants; -import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; import java.awt.BorderLayout; import java.util.Set; @@ -1715,7 +1714,7 @@ public abstract class JTemplate> } private void setUpTheme4NewTemplate() { - TemplateTheme theme = getUsingTemplateThemeConfig().getTheme4NewTemplate(); + TemplateTheme theme = getUsingTemplateThemeConfig().cachedFetchTheme4NewTemplate(); TemplateThemeAttrMark themeAttrMark = template.getAttrMark(TemplateThemeAttrMark.XML_TAG); if (themeAttrMark == null) { themeAttrMark = new TemplateThemeAttrMark(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java index 929b5ef9fb..a61c2721e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java @@ -220,8 +220,7 @@ public class TemplateThemeBlock extends JPanel { } } - T theme4newTemplate = config.getTheme4NewTemplate(); - if (StringUtils.equals(theme4newTemplate.getName(), name)) { + if (StringUtils.equals(config.getThemeName4NewTemplate(), name)) { theme4NewTemplateMarkIcon.paintIcon(this, g, 0, 0); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java index 247c373700..403fde166f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java @@ -84,7 +84,7 @@ public class TemplateThemeListPane extends BasicPane { if (config.contains(name)) { TemplateThemeBlock block = createCachedTemplateThemeBlock(name); contentListPane.add(block); - if (StringUtils.equals(name, config.getTheme4NewTemplate().getName())) { + if (StringUtils.equals(name, config.getThemeName4NewTemplate())) { block4newTemplate = block; } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java index 5dab5b7f3a..cb0e4562de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java @@ -22,8 +22,6 @@ import com.fr.design.menu.ToolBarDef; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import com.fr.third.checkerframework.checker.nullness.qual.Nullable; -import com.fr.third.guava.util.concurrent.FutureCallback; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; @@ -138,7 +136,7 @@ public class TemplateThemeManagePane extends BasicPane return; } - T currentTheme4NewTemplate = config.getTheme4NewTemplate(); + T currentTheme4NewTemplate = config.cachedFetchTheme4NewTemplate(); if (currentTheme4NewTemplate == null) { setTheme4NewTemplateButton.setEnabled(true); return; @@ -171,7 +169,7 @@ public class TemplateThemeManagePane extends BasicPane public void actionPerformed(ActionEvent e) { T style = themeListPane.getSelectedTheme(); if (style != null) { - config.setTheme4NewTemplate(style.getName()); + config.setThemeName4NewTemplate(style.getName()); } } }); @@ -190,8 +188,8 @@ public class TemplateThemeManagePane extends BasicPane MenuDef menuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add")); menuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); menuDef.setRePaint(true); - menuDef.addShortCut(new AddThemeAction(Toolkit.i18nText("Fine-Design_Template_Theme_Manager_Pane_Create_Light_Theme"), config.getLightTheme4New())); - menuDef.addShortCut(new AddThemeAction(Toolkit.i18nText("Fine-Design_Template_Theme_Manager_Pane_Create_Dark_Theme"), config.getDarkTheme4New())); + menuDef.addShortCut(new AddThemeAction(Toolkit.i18nText("Fine-Design_Template_Theme_Manager_Pane_Create_Light_Theme"), config.cachedFetchLightTheme4New())); + menuDef.addShortCut(new AddThemeAction(Toolkit.i18nText("Fine-Design_Template_Theme_Manager_Pane_Create_Dark_Theme"), config.cachedFetchDarkTheme4New())); return menuDef; }