Browse Source

KERNEL-10626 直接在2.0上支持fvs多开

feature/x
kerry 3 years ago
parent
commit
9f9972eeb4
  1. 25
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  2. 21
      designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java
  3. 6
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 27
      designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java

25
designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java

@ -220,7 +220,7 @@ public class CenterRegionContainerPane extends JPanel {
* *
* @param plus 工具条中相关信息 * @param plus 工具条中相关信息
*/ */
protected void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad) { protected void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolBarMenuDock ad, ToolKitConfigStrategy strategy) {
resetCombineUpTooBar(ad.resetUpToolBar(plus), plus); resetCombineUpTooBar(ad.resetUpToolBar(plus), plus);
@ -230,28 +230,41 @@ public class CenterRegionContainerPane extends JPanel {
// 颜色,字体那些按钮的工具栏 // 颜色,字体那些按钮的工具栏
toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER);
if (strategy.hasToolBarPane(plus)) {
if (plus.hasToolBarPane()) {
this.add(toolbarPane, BorderLayout.NORTH); this.add(toolbarPane, BorderLayout.NORTH);
} else { } else {
this.remove(toolbarPane); 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(); resetByDesignMode();
} }
private void resetByDesignMode() { private void resetByDesignMode() {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
eastPane.remove(largeToolbar); eastPane.remove(largeToolbar);
eastCenterPane.remove(templateTabPane); //移除新建模板按钮
templateTabPane.remove(newWorkBookPane);
centerTemplateCardPane.refresh(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); centerTemplateCardPane.refresh(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
} else { } else {
eastPane.add(largeToolbar, BorderLayout.WEST); eastPane.add(largeToolbar, BorderLayout.WEST);
eastCenterPane.add(templateTabPane, BorderLayout.CENTER); templateTabPane.add(newWorkBookPane, BorderLayout.WEST);
}
}
} }
JComponent getToolbarComponent() { JComponent getToolbarComponent() {
return this.toolbarComponent; return this.toolbarComponent;

21
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();
}
}

6
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 工具条中相关信息 * @param plus 工具条中相关信息
*/ */
public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { public void resetToolkitByPlus(ToolBarMenuDockPlus plus) {
resetToolkitByPlus(plus, new DefaultToolKitConfig());
}
public void resetToolkitByPlus(ToolBarMenuDockPlus plus, ToolKitConfigStrategy strategy) {
if (plus == null) { if (plus == null) {
plus = ToolBarMenuDock.NULLAVOID; plus = ToolBarMenuDock.NULLAVOID;
@ -623,7 +627,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad);
CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad, strategy);
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
this.validate(); this.validate();

27
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);
}
Loading…
Cancel
Save