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 d31b5ede0..bee79a81b 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 000000000..305c44aa2 --- /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 8f732a02e..e2d460943 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 000000000..67b1409b3 --- /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); +}