Browse Source

alphafine加功能点

master
XiaXiang 7 years ago
parent
commit
a4ba146687
  1. 6
      designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  2. 325
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  3. 213
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

6
designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.base.FRCoreContext; import com.fr.base.FRCoreContext;
import com.fr.general.VT4FR; import com.fr.general.VT4FR;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
@ -247,4 +248,9 @@ public class AlphaFineConfigManager implements XMLable {
public void setOperateCount(int operateCount) { public void setOperateCount(int operateCount) {
this.operateCount = operateCount; this.operateCount = operateCount;
} }
public static boolean isALPHALicAvailable() {
return FRContext.getCurrentEnv() != null && VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support();
}
} }

325
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -6,16 +6,22 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; 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.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.*; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
@ -37,6 +43,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.VT4FR;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -54,8 +61,20 @@ import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.*; import java.awt.dnd.DnDConstants;
import java.awt.event.*; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -65,15 +84,13 @@ import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
public static final String DESIGNER_FRAME_NAME = "designer_frame";
public static final Dimension MIN_SIZE = new Dimension(100, 100);
private static final long serialVersionUID = -8732559571067484460L; private static final long serialVersionUID = -8732559571067484460L;
private static final int LEFT_ALIGN_GAP = -5; private static final int LEFT_ALIGN_GAP = -5;
private static final int MENU_HEIGHT = 26; private static final int MENU_HEIGHT = 26;
private static final Integer SECOND_LAYER = new Integer(100); private static final Integer SECOND_LAYER = new Integer(100);
private static final Integer TOP_LAYER = new Integer((200)); private static final Integer TOP_LAYER = new Integer((200));
public static final String DESIGNER_FRAME_NAME = "designer_frame";
public static final Dimension MIN_SIZE = new Dimension(100, 100);
private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>(); private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>();
private ToolBarMenuDock ad; private ToolBarMenuDock ad;
@ -139,82 +156,45 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
closeMode.paintIcon(this, g, 0, 0); closeMode.paintIcon(this, g, 0, 0);
} }
}; };
private MouseListener closeMouseListener = new MouseAdapter() {
/** public void mousePressed(MouseEvent e) {
* 注册app. closeMode = UIConstants.CLOSE_PRESS_AUTHORITY;
* closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
* @param app closeButton.repaint();
* 注册app.
*/
public static void registApp(App<?> app) {
if (app != null) {
appList.add(app);
}
}
public static void removeApp(App<?> app) {
if (app != null) {
appList.remove(app);
}
}
protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane;
} }
/** public void mouseExited(MouseEvent e) {
* 初始menuPane的方法 方便OEM时修改该组件 closeMode = UIConstants.CLOSE_OF_AUTHORITY;
*/ closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
protected void initMenuPane(){ closeButton.repaint();
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST);
basePane.add(menuPane, BorderLayout.NORTH);
this.resetToolkitByPlus(null);
} }
/** public void mouseMoved(MouseEvent e) {
* @param ad closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
* @return closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
*/ closeButton.repaint();
protected JPanel initNorthEastPane(final ToolBarMenuDock ad) {
//hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
//优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) {
@Override
public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad);
DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv());
} }
}, new PluginFilter() {
@Override public void mouseReleased(MouseEvent e) {
public boolean accept(PluginContext context) { if (BaseUtils.isAuthorityEditing()) {
BaseUtils.setAuthorityEditing(false);
return context.contain(PluginModule.ExtraDesign); WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();
refreshDottedLine();
fireAuthorityStateToNomal();
} }
});
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
} }
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { public void mouseEntered(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
northEastPane.removeAll(); closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); closeButton.repaint();
if (processor == null) {
processor = new DefaultTitlePlace();
}
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
}
} }
};
public DesignerFrame(ToolBarMenuDock ad) { public DesignerFrame(ToolBarMenuDock ad) {
@ -240,7 +220,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH); eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(newWorkBookPane =ad.getNewTemplatePane(), BorderLayout.WEST); panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST);
panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER);
eastCenterPane.add(panel, BorderLayout.CENTER); eastCenterPane.add(panel, BorderLayout.CENTER);
@ -269,7 +249,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
modWindowBounds(); modWindowBounds();
// p:检查所有按钮的可见性和是否可以编辑性. // p:检查所有按钮的可见性和是否可以编辑性.
checkToolbarMenuEnable(); checkToolbarMenuEnable();
@ -292,6 +271,82 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
initMenuPane(); initMenuPane();
} }
/**
* 注册app.
*
* @param app 注册app.
*/
public static void registApp(App<?> app) {
if (app != null) {
appList.add(app);
}
}
public static void removeApp(App<?> app) {
if (app != null) {
appList.remove(app);
}
}
protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane;
}
/**
* 初始menuPane的方法 方便OEM时修改该组件
*/
protected void initMenuPane() {
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST);
basePane.add(menuPane, BorderLayout.NORTH);
this.resetToolkitByPlus(null);
}
/**
* @param ad
* @return
*/
protected JPanel initNorthEastPane(final ToolBarMenuDock ad) {
//hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
//优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) {
@Override
public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad);
DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv());
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
}
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
northEastPane.removeAll();
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) {
processor = new DefaultTitlePlace();
}
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
if (AlphaFineConfigManager.isALPHALicAvailable() && DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
}
}
public void initTitleIcon() { public void initTitleIcon() {
try { try {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -304,20 +359,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
private void addWindowListeners(ArrayList<WindowListener> listeners){ private void addWindowListeners(ArrayList<WindowListener> listeners) {
for(WindowListener listener : listeners){ for (WindowListener listener : listeners) {
this.addWindowListener(listener); this.addWindowListener(listener);
} }
} }
protected ArrayList<WindowListener> getFrameListeners(){ protected ArrayList<WindowListener> getFrameListeners() {
ArrayList<WindowListener> arrayList = new ArrayList<WindowListener>(); ArrayList<WindowListener> arrayList = new ArrayList<WindowListener>();
arrayList.add(windowAdapter); arrayList.add(windowAdapter);
return arrayList; return arrayList;
} }
protected void laoyoutWestPane() {
protected void laoyoutWestPane(){
basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST); basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST);
} }
@ -402,46 +456,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
addDottedLine(); addDottedLine();
} }
private MouseListener closeMouseListener = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
closeMode = UIConstants.CLOSE_PRESS_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
public void mouseExited(MouseEvent e) {
closeMode = UIConstants.CLOSE_OF_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
public void mouseMoved(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
public void mouseReleased(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) {
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();
refreshDottedLine();
fireAuthorityStateToNomal();
}
}
public void mouseEntered(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
};
/** /**
* 刷新CloseButton * 刷新CloseButton
*/ */
@ -499,9 +513,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return combineUp; return combineUp;
} }
private void addExtraButtons(){ private void addExtraButtons() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(jt == null){ if (jt == null) {
return; return;
} }
@ -515,9 +529,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
private void addShareButton(){ private void addShareButton() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(jt == null){ if (jt == null) {
return; return;
} }
@ -531,10 +545,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 检查 * 检查
* *
* @param flag * @param flag 组件是否可见
* 组件是否可见 * @param al 组件名称
* @param al
* 组件名称
*/ */
public void checkCombineUp(boolean flag, ArrayList<String> al) { public void checkCombineUp(boolean flag, ArrayList<String> al) {
combineUp.checkComponentsByNames(flag, al); combineUp.checkComponentsByNames(flag, al);
@ -551,8 +563,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 重置相关的工具条. * 重置相关的工具条.
* *
* @param plus * @param plus 工具条中相关信息
* 工具条中相关信息
*/ */
public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { public void resetToolkitByPlus(ToolBarMenuDockPlus plus) {
if (plus == null) { if (plus == null) {
@ -715,16 +726,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
editingTemplate.saveTemplate(); editingTemplate.saveTemplate();
FRLogger.getLogger().log( FRLogger.getLogger().log(
Level.INFO, Level.INFO,
Inter.getLocText(new String[] { "Template", "already-saved" }, new String[] { Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "." })); editingTemplate.getEditingFILE().getName(), "."}));
} }
} else { } else {
if (editingTemplate.saveTemplate()) { if (editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate(); editingTemplate.saveTemplate();
FRLogger.getLogger().log( FRLogger.getLogger().log(
Level.INFO, Level.INFO,
Inter.getLocText(new String[] { "Template", "already-saved" }, new String[] { Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "." })); editingTemplate.getEditingFILE().getName(), "."}));
} }
} }
} }
@ -741,8 +752,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 添加 模板, 并激活. * 添加 模板, 并激活.
* *
* @param jt * @param jt 添加的模板.
* 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
@ -758,8 +768,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 激活已经存在的模板 * 激活已经存在的模板
* *
* @param jt * @param jt 模板
* 模板
*/ */
public void activateJTemplate(JTemplate<?, ?> jt) { public void activateJTemplate(JTemplate<?, ?> jt) {
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
@ -773,8 +782,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 对象侦听 * 对象侦听
* *
* @param e * @param e 事件
* 事件
*/ */
public void targetModified(TargetModifiedEvent e) { public void targetModified(TargetModifiedEvent e) {
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
@ -783,8 +791,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 模板关闭时 处理. * 模板关闭时 处理.
* *
* @param jt * @param jt 模板
* 模板
*/ */
public void templateClosed(JTemplate<?, ?> jt) { public void templateClosed(JTemplate<?, ?> jt) {
} }
@ -792,8 +799,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 模板打开时 处理. * 模板打开时 处理.
* *
* @param jt * @param jt 模板
* 模板
*/ */
public void templateOpened(JTemplate<?, ?> jt) { public void templateOpened(JTemplate<?, ?> jt) {
} }
@ -801,8 +807,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 模板保存时 处理. * 模板保存时 处理.
* *
* @param jt * @param jt 模板
* 模板
*/ */
public void templateSaved(JTemplate<?, ?> jt) { public void templateSaved(JTemplate<?, ?> jt) {
this.checkToolbarMenuEnable(); this.checkToolbarMenuEnable();
@ -811,8 +816,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 打开模板文件,如果是已经打开的就激活此模板所对应的JInternalFrame * 打开模板文件,如果是已经打开的就激活此模板所对应的JInternalFrame
* *
* @param tplFile * @param tplFile 文件
* 文件
*/ */
public void openTemplate(FILE tplFile) { public void openTemplate(FILE tplFile) {
// 测试连接,如果连接失败,则提示 // 测试连接,如果连接失败,则提示
@ -821,8 +825,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
&& !FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) { && !FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) {
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[] { "FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened" }, new String[] { Inter.getLocText(new String[]{"FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened"}, new String[]{
",", "!" }), Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); ",", "!"}), Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE);
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
@ -849,12 +853,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 是否不合版本的设计器 * 是否不合版本的设计器
* *
* @param jt * @param jt 当前模板
* 当前模板
*
* @return 是否不合版本 * @return 是否不合版本
*
*
* @date 2014-10-14-下午6:30:37 * @date 2014-10-14-下午6:30:37
*/ */
private boolean inValidDesigner(JTemplate jt) { private boolean inValidDesigner(JTemplate jt) {
@ -864,10 +864,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 打开指定的文件 * 打开指定的文件
* *
* @param tplFile * @param tplFile 指定的文件
* 指定的文件
*
*
* @date 2014-10-14-下午6:31:05 * @date 2014-10-14-下午6:31:05
*/ */
private void openFile(FILE tplFile) { private void openFile(FILE tplFile) {
@ -913,17 +910,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/** /**
* 激活指定的模板 * 激活指定的模板
* *
* @param tplFile * @param tplFile 模板文件
* 模板文件 * @param jt 当前报表
* @param jt
* 当前报表
*
*
* @date 2014-10-14-下午6:31:23 * @date 2014-10-14-下午6:31:23
*/ */
private void activeTemplate(FILE tplFile, JTemplate jt) { private void activeTemplate(FILE tplFile, JTemplate jt) {
// 如果该模板已经打开,则进行激活就可以了 // 如果该模板已经打开,则进行激活就可以了
String fullName = StableUtils.pathJoin(new String[] { ProjectConstants.REPORTLETS_NAME, tplFile.getName() }); String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()});
if (tplFile instanceof FileNodeFILE) { if (tplFile instanceof FileNodeFILE) {
fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath();
} }

213
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -5,17 +5,33 @@ package com.fr.design.mainframe.toolbar;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.FRCoreContext;
import com.fr.design.DesignState; import com.fr.design.DesignState;
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.file.*; import com.fr.design.actions.community.BugAction;
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.UpAction;
import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.OpenRecentReportMenuDef;
import com.fr.design.actions.file.OpenTemplateAction;
import com.fr.design.actions.file.PreferenceAction;
import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphaFineAction; import com.fr.design.actions.help.alphafine.AlphaFineAction;
import com.fr.design.actions.server.*; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.actions.server.FunctionManagerAction;
import com.fr.design.actions.server.GlobalParameterAction;
import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
@ -35,7 +51,6 @@ import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.VT4FR;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -48,8 +63,11 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Set;
/** /**
* @author richer * @author richer
@ -61,12 +79,63 @@ import java.util.List;
* 还有docking的状态的保存,下次打开设计器,也应该是这样的 * 还有docking的状态的保存,下次打开设计器,也应该是这样的
*/ */
public abstract class ToolBarMenuDock { public abstract class ToolBarMenuDock {
public static final int PANLE_HEIGNT = 26;
public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() {
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public ShortCut[] shortcut4FileMenu() {
return new ShortCut[0];
}
@Override
public MenuDef[] menus4Target() {
return new MenuDef[0];
}
@Override
public JPanel[] toolbarPanes4Form() {
return new JPanel[0];
}
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
public JComponent toolBar4Authority() {
return new JPanel();
}
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
public int getToolBarHeight() {
return PANLE_HEIGNT;
}
/**
* 导出菜单的子菜单 目前用于图表设计器
*
* @return 子菜单
*/
public ShortCut[] shortcut4ExportMenu() {
return new ShortCut[0];
}
};
private static final String FINEREPORT = "FineReport"; private static final String FINEREPORT = "FineReport";
private static final int MENUBAR_HEIGHT = 22; private static final int MENUBAR_HEIGHT = 22;
public static final int PANLE_HEIGNT = 26;
private MenuDef[] menus; private MenuDef[] menus;
private ToolBarDef toolBarDef; private ToolBarDef toolBarDef;
private List<UpdateActionModel> shortCutsList; private List<UpdateActionModel> shortCutsList;
/** /**
* 更新菜单 * 更新菜单
*/ */
@ -118,6 +187,10 @@ public abstract class ToolBarMenuDock {
return jMenuBar; return jMenuBar;
} }
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////menu below/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/** /**
* 生成报表设计和表单设计的编辑区域 * 生成报表设计和表单设计的编辑区域
* *
@ -127,10 +200,6 @@ public abstract class ToolBarMenuDock {
return null; return null;
} }
//////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////menu below/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
public MenuDef[] menus(final ToolBarMenuDockPlus plus) { public MenuDef[] menus(final ToolBarMenuDockPlus plus) {
java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>(); java.util.List<MenuDef> menuList = new java.util.ArrayList<MenuDef>();
// 添加文件菜单 // 添加文件菜单
@ -164,6 +233,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 获取所有actionmodel * 获取所有actionmodel
*
* @param menuList * @param menuList
*/ */
private void addAllUpdateActionsToList(List<MenuDef> menuList) { private void addAllUpdateActionsToList(List<MenuDef> menuList) {
@ -175,6 +245,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 递归获取所有UpdateAction * 递归获取所有UpdateAction
*
* @param menuDef * @param menuDef
*/ */
private void addUpdateActionToList(MenuDef menuDef, int level) { private void addUpdateActionToList(MenuDef menuDef, int level) {
@ -195,11 +266,11 @@ public abstract class ToolBarMenuDock {
} }
} }
public void addCommunityMenuDef(java.util.List<MenuDef> menuList){ public void addCommunityMenuDef(java.util.List<MenuDef> menuList) {
Locale locale = FRContext.getLocale(); Locale locale = FRContext.getLocale();
Locale [] locales =supportCommunityLocales(); Locale[] locales = supportCommunityLocales();
for(int i = 0; i < locales.length; i++) { for (int i = 0; i < locales.length; i++) {
if(locale.equals(locales[i])){ if (locale.equals(locales[i])) {
menuList.add(createCommunityMenuDef()); menuList.add(createCommunityMenuDef());
break; break;
} }
@ -218,13 +289,13 @@ public abstract class ToolBarMenuDock {
// 给菜单加插件入口 // 给菜单加插件入口
for (MenuDef m : menuDefs) { for (MenuDef m : menuDefs) {
switch (m.getAnchor()) { switch (m.getAnchor()) {
case MenuHandler.TEMPLATE : case MenuHandler.TEMPLATE:
insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus));
break; break;
case MenuHandler.INSERT : case MenuHandler.INSERT:
insertMenu(m, MenuHandler.INSERT); insertMenu(m, MenuHandler.INSERT);
break; break;
case MenuHandler.CELL : case MenuHandler.CELL:
insertMenu(m, MenuHandler.CELL); insertMenu(m, MenuHandler.CELL);
break; break;
default: default:
@ -271,7 +342,7 @@ public abstract class ToolBarMenuDock {
addSwitchExistEnvAction(menuDef); addSwitchExistEnvAction(menuDef);
menuDef.addShortCut( new ExitDesignerAction()); menuDef.addShortCut(new ExitDesignerAction());
insertMenu(menuDef, MenuHandler.FILE); insertMenu(menuDef, MenuHandler.FILE);
return menuDef; return menuDef;
@ -293,7 +364,7 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new SwitchExistEnv()); menuDef.addShortCut(new SwitchExistEnv());
} }
protected ShortCut openTemplateAction(){ protected ShortCut openTemplateAction() {
return new OpenTemplateAction(); return new OpenTemplateAction();
} }
@ -308,17 +379,15 @@ public abstract class ToolBarMenuDock {
* 创建论坛登录面板, chart那边不需要 * 创建论坛登录面板, chart那边不需要
* *
* @return 面板组件 * @return 面板组件
*
*/ */
public Component createBBSLoginPane(){ public Component createBBSLoginPane() {
return new UILabel(); return new UILabel();
} }
public Component createAlphafinePane(){ public Component createAlphafinePane() {
return new UILabel(); return new UILabel();
} }
protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Server"), 'S'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Server"), 'S');
@ -361,6 +430,7 @@ public abstract class ToolBarMenuDock {
/** /**
* 创建帮助子菜单 * 创建帮助子菜单
*
* @return 帮组菜单的子菜单 * @return 帮组菜单的子菜单
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
@ -372,25 +442,22 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new TutorialAction()); shortCuts.add(new TutorialAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
//shortCuts.add(new TutorialAction());
shortCuts.add(SeparatorDef.DEFAULT);
if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) {
// mod by anchore 16/11/17 去掉反馈
//shortCuts.add(new FeedBackAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) {
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
// shortCuts.add(new ForumAction());
} }
shortCuts.add(SeparatorDef.DEFAULT); if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction()); shortCuts.add(new AlphaFineAction());
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
}
shortCuts.add(SeparatorDef.DEFAULT);
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }
/** /**
* 创建社区子菜单 * 创建社区子菜单
*
* @return 社区菜单的子菜单 * @return 社区菜单的子菜单
*/ */
public ShortCut[] createCommunityShortCuts() { public ShortCut[] createCommunityShortCuts() {
@ -405,6 +472,7 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new SignAction()); shortCuts.add(new SignAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]); return shortCuts.toArray(new ShortCut[shortCuts.size()]);
} }
public MenuDef createHelpMenuDef() { public MenuDef createHelpMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H');
ShortCut[] otherHelpShortCuts = createHelpShortCuts(); ShortCut[] otherHelpShortCuts = createHelpShortCuts();
@ -414,6 +482,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.HELP); insertMenu(menuDef, MenuHandler.HELP);
return menuDef; return menuDef;
} }
public MenuDef createCommunityMenuDef() { public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
@ -423,6 +492,7 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.BBS); insertMenu(menuDef, MenuHandler.BBS);
return menuDef; return menuDef;
} }
/** /**
* 生成工具栏 * 生成工具栏
* *
@ -460,7 +530,6 @@ public abstract class ToolBarMenuDock {
} }
} }
protected JPanel polyToolBar(String text) { protected JPanel polyToolBar(String text) {
JPanel panel = new JPanel(new BorderLayout()) { JPanel panel = new JPanel(new BorderLayout()) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
@ -477,7 +546,6 @@ public abstract class ToolBarMenuDock {
return panel; return panel;
} }
/** /**
* 重置上面的工具栏 * 重置上面的工具栏
* *
@ -488,7 +556,6 @@ public abstract class ToolBarMenuDock {
return plus.toolBarButton4Form(); return plus.toolBarButton4Form();
} }
/** /**
* 创建大的工具按钮 * 创建大的工具按钮
* *
@ -507,62 +574,11 @@ public abstract class ToolBarMenuDock {
return new UIButton[0]; return new UIButton[0];
} }
protected void refreshLargeToolbarState() { protected void refreshLargeToolbarState() {
} }
public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() { public NewTemplatePane getNewTemplatePane() {
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public ShortCut[] shortcut4FileMenu() {
return new ShortCut[0];
}
@Override
public MenuDef[] menus4Target() {
return new MenuDef[0];
}
@Override
public JPanel[] toolbarPanes4Form() {
return new JPanel[0];
}
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
public JComponent toolBar4Authority() {
return new JPanel();
}
@Override
public int getMenuState() {
return DesignState.WORK_SHEET;
}
public int getToolBarHeight(){
return PANLE_HEIGNT;
}
/**
* 导出菜单的子菜单 目前用于图表设计器
*
* @return 子菜单
*/
public ShortCut[] shortcut4ExportMenu(){
return new ShortCut[0];
}
};
public NewTemplatePane getNewTemplatePane(){
return new NewTemplatePane() { return new NewTemplatePane() {
@Override @Override
public Icon getNew() { public Icon getNew() {
@ -641,7 +657,7 @@ public abstract class ToolBarMenuDock {
return; return;
} }
ShortCut shortCut = action.methodAction(handler); ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){ if (shortCut == null) {
continue; continue;
} }
menuDef.removeShortCut(shortCut); menuDef.removeShortCut(shortCut);
@ -663,7 +679,7 @@ public abstract class ToolBarMenuDock {
return; return;
} }
ShortCut shortCut = action.methodAction(handler); ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){ if (shortCut == null) {
continue; continue;
} }
@ -676,10 +692,10 @@ public abstract class ToolBarMenuDock {
menuDef.insertShortCut(insertPosition, shortCut); menuDef.insertShortCut(insertPosition, shortCut);
if (handler.insertSeparatorBefore()) { if (handler.insertSeparatorBefore()) {
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
insertPosition ++; insertPosition++;
} }
if (handler.insertSeparatorAfter()) { if (handler.insertSeparatorAfter()) {
insertPosition ++; insertPosition++;
menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT);
} }
} }
@ -688,36 +704,35 @@ public abstract class ToolBarMenuDock {
/** /**
* 设计器退出时, 做的一些操作. * 设计器退出时, 做的一些操作.
*
*/ */
public void shutDown(){ public void shutDown() {
} }
private interface ShortCutMethodAction{ private interface ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler); public ShortCut methodAction(MenuHandler handler);
} }
private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{ private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction {
public ShortCut methodAction(MenuHandler handler){ public ShortCut methodAction(MenuHandler handler) {
return handler.shortcut(); return handler.shortcut();
} }
} }
//不需要编辑对象的菜单, 比如文件, 服务器, 关于 //不需要编辑对象的菜单, 比如文件, 服务器, 关于
private class NoTargetAction extends AbstractShortCutMethodAction{ private class NoTargetAction extends AbstractShortCutMethodAction {
} }
//模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可. //模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可.
//在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell). //在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell).
private class TemplateTargetAction extends AbstractShortCutMethodAction{ private class TemplateTargetAction extends AbstractShortCutMethodAction {
private ToolBarMenuDockPlus plus; private ToolBarMenuDockPlus plus;
public TemplateTargetAction(ToolBarMenuDockPlus plus){ public TemplateTargetAction(ToolBarMenuDockPlus plus) {
this.plus = plus; this.plus = plus;
} }

Loading…
Cancel
Save