Browse Source

feature: JTemplate新增 停用模板+指定模板所需设计器界面方法

feature/big-screen
shine 4 years ago
parent
commit
ba88eedb27
  1. 52
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  2. 61
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 24
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  4. 11
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java

52
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -5,7 +5,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
@ -31,7 +30,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.MacOsAddListenerAction; import com.fr.design.os.impl.MacOsAddListenerAction;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
@ -560,9 +558,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
plus = ToolBarMenuDock.NULLAVOID; plus = ToolBarMenuDock.NULLAVOID;
} }
DesignState designState = new DesignState(plus);
MenuManager.getInstance().setMenus4Designer(designState);
NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); NorthRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad);
CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad); CenterRegionContainerPane.getInstance().resetToolkitByPlus(plus, ad);
@ -763,10 +758,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }
if (currentTemplateDeactivateFail()) {
return;
}
jt.addJTemplateActionListener(this); jt.addJTemplateActionListener(this);
jt.addTargetModifiedListener(this); jt.addTargetModifiedListener(this);
jt.addJTemplateActionListener(VcsHelper.getInstance()); jt.addJTemplateActionListener(VcsHelper.getInstance());
getCenterTemplateCardPane().showJTemplate(jt); getCenterTemplateCardPane().showJTemplate(jt);
refreshBaseContentPane(jt);
setTitle(); setTitle();
layeredPane.repaint(); layeredPane.repaint();
} }
@ -784,11 +783,54 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }
if (currentTemplateDeactivateFail()) {
return;
}
getCenterTemplateCardPane().showJTemplate(jt); getCenterTemplateCardPane().showJTemplate(jt);
refreshBaseContentPane(jt);
setTitle(); setTitle();
layeredPane.repaint(); layeredPane.repaint();
} }
/**
* 当前模板 停用失败
*
* @return 是否停用失败
*/
private boolean currentTemplateDeactivateFail() {
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate();
}
/**
* 根据模板刷新 设计器整个界面
*
* @param jTemplate 当前模板
*/
private void refreshBaseContentPane(JTemplate jTemplate) {
JComponent north = jTemplate.north4DesignerFrame(),
center = jTemplate.center4DesignerFrame(),
west = jTemplate.west4DesignerFrame(),
east = jTemplate.east4DesignerFrame();
basePane.removeAll();
if (north != null) {
basePane.add(north, BorderLayout.NORTH);
}
if (center != null) {
basePane.add(center, BorderLayout.CENTER);
}
if (west != null) {
basePane.add(west, BorderLayout.WEST);
}
if (east != null) {
basePane.add(east, BorderLayout.EAST);
}
}
/** /**
* 对象侦听 * 对象侦听
* *

61
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -82,11 +82,11 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.awt.BorderLayout;
/** /**
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件) * 报表设计和表单设计的编辑区域(设计器编辑的IO文件)
@ -1125,6 +1125,16 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); DesignerContext.getDesignerFrame().addAndActivateJTemplate(this);
} }
/**
* 将要激活打开其他模板使当前模板灭活
* 默认 do nothing 返回true
*
* @return true成功停用当前模板
*/
public boolean deactivateTemplate() {
return true;
}
/** /**
* 返回当前支持的超链界面pane * 返回当前支持的超链界面pane
@ -1237,15 +1247,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/ */
public abstract Icon getIcon(); public abstract Icon getIcon();
/**
* 导出菜单项
*
* @return 菜单项
*/
@Override
public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0];
}
/** /**
* 复制JS代码 * 复制JS代码
@ -1359,4 +1360,44 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
/**
* 设计器界面是BorderLayout指定NORTH组件
* 默认是 菜单区域
*
* @return NORTH组件
*/
public JComponent north4DesignerFrame() {
return NorthRegionContainerPane.getInstance();
}
/**
* 设计器界面是BorderLayout指定CENTER组件
* 默认是 模板对应的工具栏区域+模板设计区域
*
* @return CENTER组件
*/
public JComponent center4DesignerFrame() {
return CenterRegionContainerPane.getInstance();
}
/**
* 设计器界面是BorderLayout指定WEST组件
* 默认是 模板目录树+数据集编辑区域
*
* @return WEST组件
*/
public JComponent west4DesignerFrame() {
return WestRegionContainerPane.getInstance();
}
/**
* 设计器界面是BorderLayout指定EAST组件
* 默认是 属性配置界面
*
* @return EAST组件
*/
public JComponent east4DesignerFrame() {
return EastRegionContainerPane.getInstance();
}
} }

24
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -9,7 +9,18 @@ import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.*; import com.fr.design.actions.community.BBSAction;
import com.fr.design.actions.community.BugAction;
import com.fr.design.actions.community.BugNeedAction;
import com.fr.design.actions.community.CenterAction;
import com.fr.design.actions.community.FacebookFansAction;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.actions.community.QuestionAction;
import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.TechSolutionAction;
import com.fr.design.actions.community.TechSupportAction;
import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.community.WorkOrderCenterAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction; import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction; import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.OpenRecentReportMenuDef; import com.fr.design.actions.file.OpenRecentReportMenuDef;
@ -64,7 +75,6 @@ import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder; import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -141,16 +151,6 @@ public abstract class ToolBarMenuDock {
return PANLE_HEIGNT; return PANLE_HEIGNT;
} }
/**
* 导出菜单的子菜单 目前用于图表设计器
*
* @return 子菜单
*/
@Override
public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0];
}
}; };
private static final int MENUBAR_HEIGHT = 22; private static final int MENUBAR_HEIGHT = 22;

11
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java

@ -1,11 +1,12 @@
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import javax.swing.*;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import javax.swing.JComponent;
import javax.swing.JPanel;
public interface ToolBarMenuDockPlus { public interface ToolBarMenuDockPlus {
/** /**
* 模板的工具 * 模板的工具
@ -53,11 +54,5 @@ public interface ToolBarMenuDockPlus {
int getToolBarHeight(); int getToolBarHeight();
/**
* 导出菜单的子菜单 目前用于图表设计器
*
* @return 子菜单
*/
ShortCut[] shortcut4ExportMenu();
} }
Loading…
Cancel
Save