From 9f9972eeb49d2c40486d032e6466bdc012d2dfc7 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 25 Mar 2022 17:12:58 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-10626=20=E7=9B=B4=E6=8E=A5=E5=9C=A82.0?= =?UTF-8?q?=E4=B8=8A=E6=94=AF=E6=8C=81fvs=E5=A4=9A=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/CenterRegionContainerPane.java | 25 ++++++++++++----- .../mainframe/DefaultToolKitConfig.java | 21 +++++++++++++++ .../fr/design/mainframe/DesignerFrame.java | 6 ++++- .../mainframe/ToolKitConfigStrategy.java | 27 +++++++++++++++++++ 4 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index d31b5ede09..bee79a81b1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -220,7 +220,7 @@ public class CenterRegionContainerPane extends JPanel { * * @param plus 工具条中相关信息 */ - protected void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad) { + protected void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad, ToolKitConfigStrategy strategy) { resetCombineUpTooBar(ad.resetUpToolBar(plus), plus); @@ -230,28 +230,41 @@ public class CenterRegionContainerPane extends JPanel { // 颜色,字体那些按钮的工具栏 toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); - - if (plus.hasToolBarPane()) { + if (strategy.hasToolBarPane(plus)) { this.add(toolbarPane, BorderLayout.NORTH); } else { this.remove(toolbarPane); } + if (strategy.hasTemplateTabPane(plus)) { + eastCenterPane.add(templateTabPane, BorderLayout.CENTER); + } else { + eastCenterPane.remove(templateTabPane); + } + + if (strategy.hasCombineUp(plus)) { + eastCenterPane.add(combineUp, BorderLayout.NORTH); + } else { + eastCenterPane.remove(combineUp); + } resetByDesignMode(); } private void resetByDesignMode() { if (DesignModeContext.isDuchampMode()) { eastPane.remove(largeToolbar); - eastCenterPane.remove(templateTabPane); + //移除新建模板按钮 + templateTabPane.remove(newWorkBookPane); centerTemplateCardPane.refresh(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); } else { eastPane.add(largeToolbar, BorderLayout.WEST); - eastCenterPane.add(templateTabPane, BorderLayout.CENTER); - } + templateTabPane.add(newWorkBookPane, BorderLayout.WEST); + } } + + JComponent getToolbarComponent() { return this.toolbarComponent; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java b/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java new file mode 100644 index 0000000000..305c44aa21 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java @@ -0,0 +1,21 @@ +package com.fr.design.mainframe; + +import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; + +public class DefaultToolKitConfig implements ToolKitConfigStrategy { + @Override + public boolean hasTemplateTabPane(ToolBarMenuDockPlus plus) { + return !DesignModeContext.isDuchampMode(); + } + + @Override + public boolean hasCombineUp(ToolBarMenuDockPlus plus) { + return plus.hasToolBarPane(); + } + + @Override + public boolean hasToolBarPane(ToolBarMenuDockPlus plus) { + return plus.hasToolBarPane(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 8f732a02e4..e2d4609439 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -616,6 +616,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param plus 工具条中相关信息 */ public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { + resetToolkitByPlus(plus, new DefaultToolKitConfig()); + } + + public void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolKitConfigStrategy strategy) { if (plus == null) { plus = ToolBarMenuDock.NULLAVOID; @@ -623,7 +627,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); - CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); + CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad, strategy); this.checkToolbarMenuEnable(); this.validate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java b/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java new file mode 100644 index 0000000000..67b1409b36 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java @@ -0,0 +1,27 @@ +package com.fr.design.mainframe; + +import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; + +public interface ToolKitConfigStrategy { + + /** + * 展示tabpane + * @param plus + * @return + */ + boolean hasTemplateTabPane(ToolBarMenuDockPlus plus); + + /** + * 展示模板操作按钮(复制、粘贴、保存等) + * @param plus + * @return + */ + boolean hasCombineUp(ToolBarMenuDockPlus plus); + + /** + * 展示工具栏pane + * @param plus + * @return + */ + boolean hasToolBarPane(ToolBarMenuDockPlus plus); +}