Browse Source

REPORT-51919 主题切换

【问题原因】
新增模版主题功能:
从主题配置中获取主题名称和获取主题数据的开销不同,
在方法上要做区分,尽量使用主题名称完成业务逻辑

【改动思路】
同上
research/11.0
Starryi 3 years ago
parent
commit
d3fc401e9e
  1. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java

3
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.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.Set; import java.util.Set;
@ -1715,7 +1714,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private void setUpTheme4NewTemplate() { private void setUpTheme4NewTemplate() {
TemplateTheme theme = getUsingTemplateThemeConfig().getTheme4NewTemplate(); TemplateTheme theme = getUsingTemplateThemeConfig().cachedFetchTheme4NewTemplate();
TemplateThemeAttrMark themeAttrMark = template.getAttrMark(TemplateThemeAttrMark.XML_TAG); TemplateThemeAttrMark themeAttrMark = template.getAttrMark(TemplateThemeAttrMark.XML_TAG);
if (themeAttrMark == null) { if (themeAttrMark == null) {
themeAttrMark = new TemplateThemeAttrMark(); themeAttrMark = new TemplateThemeAttrMark();

3
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java

@ -220,8 +220,7 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
} }
} }
T theme4newTemplate = config.getTheme4NewTemplate(); if (StringUtils.equals(config.getThemeName4NewTemplate(), name)) {
if (StringUtils.equals(theme4newTemplate.getName(), name)) {
theme4NewTemplateMarkIcon.paintIcon(this, g, 0, 0); theme4NewTemplateMarkIcon.paintIcon(this, g, 0, 0);
} }

2
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java

@ -84,7 +84,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
if (config.contains(name)) { if (config.contains(name)) {
TemplateThemeBlock<T> block = createCachedTemplateThemeBlock(name); TemplateThemeBlock<T> block = createCachedTemplateThemeBlock(name);
contentListPane.add(block); contentListPane.add(block);
if (StringUtils.equals(name, config.getTheme4NewTemplate().getName())) { if (StringUtils.equals(name, config.getThemeName4NewTemplate())) {
block4newTemplate = block; block4newTemplate = block;
} }
} }

10
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.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; 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.Configurations;
import com.fr.transaction.WorkerFacade; import com.fr.transaction.WorkerFacade;
@ -138,7 +136,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
return; return;
} }
T currentTheme4NewTemplate = config.getTheme4NewTemplate(); T currentTheme4NewTemplate = config.cachedFetchTheme4NewTemplate();
if (currentTheme4NewTemplate == null) { if (currentTheme4NewTemplate == null) {
setTheme4NewTemplateButton.setEnabled(true); setTheme4NewTemplateButton.setEnabled(true);
return; return;
@ -171,7 +169,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
T style = themeListPane.getSelectedTheme(); T style = themeListPane.getSelectedTheme();
if (style != null) { if (style != null) {
config.setTheme4NewTemplate(style.getName()); config.setThemeName4NewTemplate(style.getName());
} }
} }
}); });
@ -190,8 +188,8 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
MenuDef menuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add")); MenuDef menuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add"));
menuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); menuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH);
menuDef.setRePaint(true); 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_Light_Theme"), config.cachedFetchLightTheme4New()));
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_Dark_Theme"), config.cachedFetchDarkTheme4New()));
return menuDef; return menuDef;
} }

Loading…
Cancel
Save