|
|
|
@ -146,13 +146,13 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
// 给菜单加插件入口
|
|
|
|
|
for (MenuDef m : menuDefs) { |
|
|
|
|
switch (m.getAnchor()) { |
|
|
|
|
case MenuHandler.TEMPLATE : |
|
|
|
|
case MenuHandler.TEMPLATE: |
|
|
|
|
insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); |
|
|
|
|
break; |
|
|
|
|
case MenuHandler.INSERT : |
|
|
|
|
case MenuHandler.INSERT: |
|
|
|
|
insertMenu(m, MenuHandler.INSERT); |
|
|
|
|
break; |
|
|
|
|
case MenuHandler.CELL : |
|
|
|
|
case MenuHandler.CELL: |
|
|
|
|
insertMenu(m, MenuHandler.CELL); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
@ -199,7 +199,7 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
|
|
|
|
|
addSwitchExistEnvAction(menuDef); |
|
|
|
|
|
|
|
|
|
menuDef.addShortCut( new ExitDesignerAction()); |
|
|
|
|
menuDef.addShortCut(new ExitDesignerAction()); |
|
|
|
|
|
|
|
|
|
insertMenu(menuDef, MenuHandler.FILE); |
|
|
|
|
return menuDef; |
|
|
|
@ -221,7 +221,7 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
menuDef.addShortCut(new SwitchExistEnv()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected ShortCut openTemplateAction(){ |
|
|
|
|
protected ShortCut openTemplateAction() { |
|
|
|
|
return new OpenTemplateAction(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -231,15 +231,14 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
* @return 菜单 |
|
|
|
|
*/ |
|
|
|
|
public abstract ShortCut[] createNewFileShortCuts(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 创建论坛登录面板, chart那边不需要 |
|
|
|
|
* |
|
|
|
|
* @return 面板组件 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public Component createBBSLoginPane(){ |
|
|
|
|
return new UILabel(); |
|
|
|
|
* 创建论坛登录面板, chart那边不需要 |
|
|
|
|
* |
|
|
|
|
* @return 面板组件 |
|
|
|
|
*/ |
|
|
|
|
public Component createBBSLoginPane() { |
|
|
|
|
return new UILabel(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -264,9 +263,10 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!BaseUtils.isAuthorityEditing()) { |
|
|
|
|
if (shouldShowPlugin()){ |
|
|
|
|
if (shouldShowPlugin()) { |
|
|
|
|
menuDef.addShortCut( |
|
|
|
|
new PluginManagerAction() |
|
|
|
|
new PluginManagerAction(), |
|
|
|
|
new ReuseManagerAction() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
menuDef.addShortCut( |
|
|
|
@ -290,6 +290,7 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 创建帮助子菜单 |
|
|
|
|
* |
|
|
|
|
* @return 帮组菜单的子菜单 |
|
|
|
|
*/ |
|
|
|
|
public ShortCut[] createHelpShortCuts() { |
|
|
|
@ -298,11 +299,11 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
shortCuts.add(SeparatorDef.DEFAULT); |
|
|
|
|
//shortCuts.add(new TutorialAction());
|
|
|
|
|
shortCuts.add(SeparatorDef.DEFAULT); |
|
|
|
|
if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { |
|
|
|
|
if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) { |
|
|
|
|
shortCuts.add(new FeedBackAction()); |
|
|
|
|
shortCuts.add(SeparatorDef.DEFAULT); |
|
|
|
|
shortCuts.add(SeparatorDef.DEFAULT); |
|
|
|
|
// shortCuts.add(new ForumAction());
|
|
|
|
|
// shortCuts.add(new ForumAction());
|
|
|
|
|
} |
|
|
|
|
shortCuts.add(SeparatorDef.DEFAULT); |
|
|
|
|
shortCuts.add(new AboutAction()); |
|
|
|
@ -312,6 +313,7 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 创建社区子菜单 |
|
|
|
|
* |
|
|
|
|
* @return 社区菜单的子菜单 |
|
|
|
|
*/ |
|
|
|
|
public ShortCut[] createCommunityShortCuts() { |
|
|
|
@ -346,6 +348,7 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
insertMenu(menuDef, MenuHandler.BBS); |
|
|
|
|
return menuDef; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 生成工具栏 |
|
|
|
|
* |
|
|
|
@ -470,7 +473,8 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
public int getMenuState() { |
|
|
|
|
return DesignState.WORK_SHEET; |
|
|
|
|
} |
|
|
|
|
public int getToolBarHeight(){ |
|
|
|
|
|
|
|
|
|
public int getToolBarHeight() { |
|
|
|
|
return PANLE_HEIGNT; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -479,29 +483,29 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
* |
|
|
|
|
* @return 子菜单 |
|
|
|
|
*/ |
|
|
|
|
public ShortCut[] shortcut4ExportMenu(){ |
|
|
|
|
public ShortCut[] shortcut4ExportMenu() { |
|
|
|
|
return new ShortCut[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
public NewTemplatePane getNewTemplatePane(){ |
|
|
|
|
return new NewTemplatePane() { |
|
|
|
|
@Override |
|
|
|
|
public Icon getNew() { |
|
|
|
|
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); |
|
|
|
|
} |
|
|
|
|
public NewTemplatePane getNewTemplatePane() { |
|
|
|
|
return new NewTemplatePane() { |
|
|
|
|
@Override |
|
|
|
|
public Icon getNew() { |
|
|
|
|
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Icon getMouseOverNew() { |
|
|
|
|
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public Icon getMouseOverNew() { |
|
|
|
|
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Icon getMousePressNew() { |
|
|
|
|
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
@Override |
|
|
|
|
public Icon getMousePressNew() { |
|
|
|
|
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void insertMenu(MenuDef menuDef, String anchor) { |
|
|
|
@ -521,7 +525,7 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
for (MenuHandler handler : target) { |
|
|
|
|
int insertPosition = handler.insertPosition(menuDef.getShortCutCount()); |
|
|
|
|
ShortCut shortCut = action.methodAction(handler); |
|
|
|
|
if (shortCut == null){ |
|
|
|
|
if (shortCut == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -534,48 +538,47 @@ public abstract class ToolBarMenuDock {
|
|
|
|
|
menuDef.insertShortCut(insertPosition, shortCut); |
|
|
|
|
if (handler.insertSeparatorBefore()) { |
|
|
|
|
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); |
|
|
|
|
insertPosition ++; |
|
|
|
|
insertPosition++; |
|
|
|
|
} |
|
|
|
|
if (handler.insertSeparatorAfter()) { |
|
|
|
|
insertPosition ++; |
|
|
|
|
insertPosition++; |
|
|
|
|
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设计器退出时, 做的一些操作. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void shutDown(){ |
|
|
|
|
|
|
|
|
|
* 设计器退出时, 做的一些操作. |
|
|
|
|
*/ |
|
|
|
|
public void shutDown() { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private interface ShortCutMethodAction{ |
|
|
|
|
private interface ShortCutMethodAction { |
|
|
|
|
|
|
|
|
|
public ShortCut methodAction(MenuHandler handler); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{ |
|
|
|
|
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction { |
|
|
|
|
|
|
|
|
|
public ShortCut methodAction(MenuHandler handler){ |
|
|
|
|
return handler.shortcut(); |
|
|
|
|
public ShortCut methodAction(MenuHandler handler) { |
|
|
|
|
return handler.shortcut(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//不需要编辑对象的菜单, 比如文件, 服务器, 关于
|
|
|
|
|
private class NoTargetAction extends AbstractShortCutMethodAction{ |
|
|
|
|
private class NoTargetAction extends AbstractShortCutMethodAction { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可.
|
|
|
|
|
//在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell).
|
|
|
|
|
private class TemplateTargetAction extends AbstractShortCutMethodAction{ |
|
|
|
|
private class TemplateTargetAction extends AbstractShortCutMethodAction { |
|
|
|
|
|
|
|
|
|
private ToolBarMenuDockPlus plus; |
|
|
|
|
|
|
|
|
|
public TemplateTargetAction(ToolBarMenuDockPlus plus){ |
|
|
|
|
public TemplateTargetAction(ToolBarMenuDockPlus plus) { |
|
|
|
|
this.plus = plus; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|