From ba7b696fe22071796b6757cf59d7fba7c73a676e Mon Sep 17 00:00:00 2001 From: hzzz Date: Mon, 30 Jul 2018 20:12:07 +0800 Subject: [PATCH 01/13] =?UTF-8?q?REPORT-9221=2010.0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9-=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 306 +++++++----------- 1 file changed, 117 insertions(+), 189 deletions(-) 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 9e9746ec23..9b93816ef5 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 @@ -4,15 +4,18 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.Env; +import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.actions.file.SwitchExistEnv; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; -import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -22,9 +25,9 @@ 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.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuHighLight; -import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; @@ -32,6 +35,7 @@ import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; +import com.fr.design.menu.ShortCut; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FILE; @@ -39,9 +43,10 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; import com.fr.general.GeneralContext; - -import com.fr.log.FineLoggerFactory; +import com.fr.general.Inter; +import com.fr.general.env.EnvContext; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -51,30 +56,12 @@ import com.fr.stable.CoreConstants; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; -import com.fr.workspace.WorkContext; -import com.fr.workspace.Workspace; -import com.fr.workspace.connect.WorkspaceConnection; - -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLayeredPane; -import javax.swing.JMenuBar; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.WindowConstants; + +import javax.swing.*; import javax.swing.border.MatteBorder; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; +import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -97,54 +84,41 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Set; +import java.util.logging.Level; 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 int LEFT_ALIGN_GAP = -5; - private static final int MENU_HEIGHT = 26; - private static final Integer SECOND_LAYER = new Integer(100); - private static final Integer TOP_LAYER = new Integer((200)); - private static java.util.List> appList = new java.util.ArrayList>(); private List designerOpenedListenerList = new ArrayList<>(); - private ToolBarMenuDock ad; + //顶部日志+登陆按钮 + private static final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + private static ToolBarMenuDock ad; private DesktopCardPane centerTemplateCardPane; private JPanel toolbarPane; - private JComponent toolbarComponent; private JPanel menuPane; - private JMenuBar menuBar; - private JPanel eastCenterPane; - private UIToolbar combineUp; - private NewTemplatePane newWorkBookPane = null; - private Icon closeMode = UIConstants.CLOSE_OF_AUTHORITY; - private JLayeredPane layeredPane = this.getLayeredPane(); - private JPanel basePane = new JPanel(); - // 上面的虚线 private DottedLine upDottedLine; - // 下面的虚线 private DottedLine downDottedLine; @@ -155,18 +129,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private DottedLine rightDottedLine; private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); - private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private WindowAdapter windowAdapter = new WindowAdapter() { - public void windowOpened(WindowEvent e) { + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); + reCalculateFrameSize(); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); } @Override public void windowClosing(WindowEvent e) { - SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); // 只有一个文件未保存时 if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) { @@ -184,9 +158,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta }; private JComponent closeButton = new JComponent() { - protected void paintComponent(Graphics g) { - g.setColor(UIConstants.NORMAL_BACKGROUND); g.fillArc(0, 0, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, 0, 360); @@ -195,32 +167,27 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta }; 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); + if (DesignerMode.isAuthorityEditing()) { + DesignerMode.setMode(DesignerMode.NORMARL); WestRegionContainerPane.getInstance().replaceDownPane( TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); @@ -233,15 +200,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseEntered(MouseEvent e) { - closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); closeButton.repaint(); } }; - private ProgressDialog progressDialog; - public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME); @@ -254,9 +218,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // the content pane basePane.setLayout(new BorderLayout()); toolbarPane = new JPanel() { - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); // dim.height = TOOLBAR_HEIGHT; return dim; @@ -299,32 +261,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.addWindowListeners(getFrameListeners()); this.addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - reCalculateFrameSize(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { doResize(); } } }); - this.addDesignerOpenedListener(new DesignerOpenedListener() { - - @Override - public void designerOpened() { - - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); - reCalculateFrameSize(); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); - } - }); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setVisible(false); this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); closeMode = UIConstants.CLOSE_OF_AUTHORITY; initMenuPane(); - this.progressDialog = new ProgressDialog(this); } /** @@ -333,7 +282,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param app 注册app. */ public static void registApp(App app) { - if (app != null) { appList.add(app); } @@ -350,7 +298,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 注册"设计器初始化完成"的监听 */ public void addDesignerOpenedListener(DesignerOpenedListener listener) { - designerOpenedListenerList.add(listener); } @@ -358,14 +305,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 触发"设计器初始化完成"事件 */ public void fireDesignerOpened() { - for (DesignerOpenedListener listener : designerOpenedListenerList) { listener.designerOpened(); } } protected DesktopCardPane getCenterTemplateCardPane() { - return centerTemplateCardPane; } @@ -373,45 +318,41 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 初始menuPane的方法 方便OEM时修改该组件 */ protected void initMenuPane() { - menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); + menuPane.add(initNorthEastPane(), BorderLayout.EAST); basePane.add(menuPane, BorderLayout.NORTH); this.resetToolkitByPlus(null); } /** - * @param ad * @return */ - protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { + protected JPanel initNorthEastPane() { //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(); + refreshNorthEastPane(); + DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv()); } }, new PluginFilter() { @Override public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign); + return !SwitchExistEnv.isSwitching() + && context.contain(PluginModule.ExtraDesign); } }); - refreshNorthEastPane(northEastPane, ad); + refreshNorthEastPane(); return northEastPane; } - private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { - + public static void refreshNorthEastPane() { northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); @@ -427,27 +368,24 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void initTitleIcon() { - try { @SuppressWarnings("unchecked") List image = ICODecoder.read(DesignerFrame.class .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); this.setIconImages(image); } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FRContext.getLogger().error(e.getMessage(), e); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); } } private void addWindowListeners(ArrayList listeners) { - for (WindowListener listener : listeners) { this.addWindowListener(listener); } } protected ArrayList getFrameListeners() { - ArrayList arrayList = new ArrayList(); arrayList.add(windowAdapter); return arrayList; @@ -455,13 +393,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta protected void laoyoutWestPane() { - basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST); } // 调整windows大小 private void reCalculateFrameSize() { - contentHeight = layeredPane.getHeight(); contentWidth = layeredPane.getWidth(); layeredPane.remove(basePane); @@ -474,7 +410,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 更新 */ public void populateAuthorityArea() { - int centerWidth = contentWidth - WestRegionContainerPane.getInstance().getContainerWidth() - EastRegionContainerPane.getInstance().getContainerWidth(); // 上面的虚线 @@ -499,7 +434,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void addDottedLine() { - layeredPane.add(upDottedLine, SECOND_LAYER); layeredPane.add(downDottedLine, SECOND_LAYER); layeredPane.add(leftDottedLine, SECOND_LAYER); @@ -508,7 +442,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void removeDottedLine() { - layeredPane.remove(upDottedLine); layeredPane.remove(downDottedLine); layeredPane.remove(leftDottedLine); @@ -517,7 +450,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public JLayeredPane getContentFrame() { - return layeredPane; } @@ -525,8 +457,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 刷新 */ public void refreshDottedLine() { - - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { populateAuthorityArea(); populateCloseButton(); addDottedLine(); @@ -540,7 +471,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 刷新DottedLine */ public void doResize() { - removeDottedLine(); populateAuthorityArea(); populateCloseButton(); @@ -565,7 +495,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体 */ private void fireAuthorityStateToNomal() { - java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 @@ -576,12 +505,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void setCloseMode(Icon closeMode) { - this.closeMode = closeMode; } private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) { - combineUp = new UIToolbar(FlowLayout.LEFT); combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); @@ -589,7 +516,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta for (int i = 0; i < fixButtons.length; i++) { combineUp.add(fixButtons[i]); } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { combineUp.addSeparator(new Dimension(2, 16)); if (toolbar4Form != null) { for (int i = 0; i < toolbar4Form.length; i++) { @@ -608,7 +535,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void addExtraButtons() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; @@ -625,7 +551,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void addShareButton() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; @@ -645,7 +570,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param al 组件名称 */ public void checkCombineUp(boolean flag, ArrayList al) { - combineUp.checkComponentsByNames(flag, al); } @@ -654,7 +578,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 刷新工具条. */ public void refreshToolbar() { - this.ad.updateToolBarDef(); } @@ -664,7 +587,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param plus 工具条中相关信息 */ public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { - if (plus == null) { plus = ToolBarMenuDock.NULLAVOID; } @@ -697,7 +619,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public JComponent getToolbarComponent() { - return this.toolbarComponent; } @@ -706,14 +627,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void needToAddAuhtorityPaint() { - newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); + newWorkBookPane.setButtonGray(DesignerMode.isAuthorityEditing()); + + // 进入或退出权限编辑模式,通知插件 + Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); + for (ShortCut shortCut : extraShortCuts) { + if (shortCut instanceof AbstractTemplateTreeShortCutProvider) { + ((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing()); + } + } + } /** * 检查工具条. */ private void checkToolbarMenuEnable() { - if (this.ad != null) { this.ad.updateMenuDef(); this.ad.updateToolBarDef(); @@ -724,34 +653,29 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 设置标题 */ public void setTitle() { - JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); defaultTitleSB.append(ProductConstants.PRODUCT_NAME); defaultTitleSB.append(" "); defaultTitleSB.append(ProductConstants.BRANCH); - defaultTitleSB.append(" "); // james:标识登录的用户和登录的ENV String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); - Workspace workspace = WorkContext.getCurrent(); - DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); - - String username = null; - if (info != null) { - WorkspaceConnection connection = info.getConnection(); - username = connection == null ? StringUtils.EMPTY : connection.getUserName(); - } - defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]"); - if (editingTemplate != null) { - String path = editingTemplate.getEditingFILE().getPath(); - if (!editingTemplate.getEditingFILE().exists()) { - path = FILEFactory.MEM_PREFIX + path; - } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { - path = workspace.getPath() + File.separator + path; + Env env = DesignerEnvManager.getEnvManager().getEnv(envName); + if (env != null) { + defaultTitleSB.append(env.getUser()).append('@').append(envName).append('['); + defaultTitleSB.append(env.getEnvDescription()); + defaultTitleSB.append(']'); + if (editingTemplate != null) { + String path = editingTemplate.getEditingFILE().getPath(); + if (!editingTemplate.getEditingFILE().exists()) { + path = FILEFactory.MEM_PREFIX + path; + } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { + path = env.getPath() + File.separator + path; + } + defaultTitleSB.append(" " + path); } - defaultTitleSB.append(" " + path); - } + } setTitle(defaultTitleSB.toString()); } @@ -788,22 +712,26 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 报表运行环境改变时,需要刷新某些面板 + * + * @param env 环境 */ - public void refreshEnv() { - + public void refreshEnv(Env env) { this.setTitle(); DesignerFrameFileDealerPane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TemplateTreePane.getInstance().refreshDockingView(); DesignTableDataManager.clearGlobalDs(); EastRegionContainerPane.getInstance().refreshDownPane(); + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.refreshToolArea(); + } } /** * 返回选中的模板. */ public JTemplate getSelectedJTemplate() { - return this.centerTemplateCardPane.getSelectedJTemplate(); } @@ -812,7 +740,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void saveCurrentEditingTemplate() { - JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (editingTemplate == null) { return; @@ -825,19 +752,23 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Utils-Would_you_like_to_save") + " \"" + editingTemplate.getEditingFILE() + Inter.getLocText("Utils-Would_you_like_to_save") + " \"" + editingTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Template_Already_Saved", - editingTemplate.getEditingFILE().getName())); + FRLogger.getLogger().log( + Level.INFO, + Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ + editingTemplate.getEditingFILE().getName(), "."})); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Template_Already_Saved", - editingTemplate.getEditingFILE().getName())); + FRLogger.getLogger().log( + Level.INFO, + Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ + editingTemplate.getEditingFILE().getName(), "."})); } } } @@ -847,7 +778,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 添加新建模板, 并激活. */ public void addAndActivateJTemplate() { - addAndActivateJTemplate(ad.createNewTemplate()); layeredPane.repaint(); } @@ -892,7 +822,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param e 事件 */ public void targetModified(TargetModifiedEvent e) { - this.checkToolbarMenuEnable(); } @@ -902,7 +831,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void templateClosed(JTemplate jt) { - } /** @@ -911,7 +839,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void templateOpened(JTemplate jt) { - } /** @@ -920,7 +847,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void templateSaved(JTemplate jt) { - this.checkToolbarMenuEnable(); } @@ -931,22 +857,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void openTemplate(FILE tplFile) { // 测试连接,如果连接失败,则提示 -// try { -// if (FRContext.getCommonOperator() != null -// && !FRContext.getCommonOperator().testServerConnectionWithOutShowMessagePane()) { -// JOptionPane.showMessageDialog( -// DesignerContext.getDesignerFrame(), -// com.fr.design.i18n.Toolkit.i18nText(new String[]{"FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened"}, new String[]{ -// ",", "!"}), com.fr.design.i18n.Toolkit.i18nText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); -// return; -// } -// } catch (Exception e) { -// FineLoggerFactory.getLogger().error(e.getMessage()); -// } + try { + if (FRContext.getCurrentEnv() != null + && !FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) { + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Inter.getLocText(new String[]{"FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened"}, new String[]{ + ",", "!"}), Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); + return; + } + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Warning-Template_Do_Not_Exsit"), + JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); DesignerFrameFileDealerPane.getInstance().refresh(); return; @@ -955,7 +881,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { openFile(tplFile); } catch (Throwable t) { - FineLoggerFactory.getLogger().error(t.getMessage(), t); + FRLogger.getLogger().error(t.getMessage(), t); addAndActivateJTemplate(); } @@ -969,7 +895,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @date 2014-10-14-下午6:30:37 */ private boolean inValidDesigner(JTemplate jt) { - return jt.isOldDesigner() || (!jt.isJWorkBook() && jt.isNewDesigner()); } @@ -980,7 +905,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @date 2014-10-14-下午6:31:05 */ private void openFile(FILE tplFile) { - String fileName = tplFile.getName(); int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); if (indexOfLastDot < 0) { @@ -989,13 +913,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta String fileExtention = fileName.substring(indexOfLastDot + 1); for (int i = 0, len = appList.size(); i < len; i++) { App app = appList.get(i); - String[] defaultAppExtentions = app.defaultExtensions(); + String[] defaultAppExtentions = app.defaultExtentions(); boolean opened = false; for (int j = 0; j < defaultAppExtentions.length; j++) { if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { - // 不要catch - JTemplate jt = app.openTemplate(tplFile); - + JTemplate jt = null; + try { + jt = app.openTemplate(tplFile); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage(), e); + } if (jt == null) { return; } @@ -1026,7 +953,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ private void activeTemplate(FILE tplFile, JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); + String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()}); + if (tplFile instanceof FileNodeFILE) { + fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); + } + // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 + if (tplFile instanceof FileFILE) { + fullName = tplFile.getPath(); + } + fullName = OperatingSystem.isWindows() ? fullName.replaceAll("/", "\\\\") : fullName.replaceAll("\\\\", "/"); + int index = HistoryTemplateListPane.getInstance().contains(fullName); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); @@ -1039,12 +975,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * Exit退出 */ public void exit() { - Thread thread = new Thread() { - @Override public void run() { - DesignerEnvManager.doEndMapSaveWorkersIndesign(); } }; @@ -1053,7 +986,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { thread.join(); } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error("Map Thread Error"); + FRLogger.getLogger().error("Map Thread Error"); } DesignerEnvManager.getEnvManager().setLastOpenFile( @@ -1070,8 +1003,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignerEnvManager.getEnvManager().saveXMLFile(); - WorkContext.switchTo(null); - + Env currentEnv = FRContext.getCurrentEnv(); + try { + EnvContext.fireBeforeSignOut(); + currentEnv.signOut(); + EnvContext.fireAfterSignOut(); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } this.setVisible(false); this.dispose(); @@ -1085,22 +1024,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void dragEnter(DropTargetDragEvent event) { - } @Override public void dragExit(DropTargetEvent event) { - } @Override public void dragOver(DropTargetDragEvent event) { - } @Override public void dropActionChanged(DropTargetDragEvent event) { - if (!isDragAcceptable(event)) { event.rejectDrag(); return; @@ -1110,7 +1045,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @SuppressWarnings("unchecked") @Override public void drop(DropTargetDropEvent event) { - if (!isDropAcceptable(event)) { event.rejectDrop(); return; @@ -1131,25 +1065,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FRContext.getLogger().error(e.getMessage(), e); } } event.dropComplete(true); } public boolean isDragAcceptable(DropTargetDragEvent event) { - return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; } public boolean isDropAcceptable(DropTargetDropEvent event) { - return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; } } - public ProgressDialog getProgressDialog() { - - return progressDialog; - } } \ No newline at end of file From 03b5f203a83741f65ea08587efdb61ddbc9d7c3d Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 30 Jul 2018 21:48:48 +0800 Subject: [PATCH 02/13] =?UTF-8?q?CHART-2699=20=E7=B1=BB=E5=9E=8B=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=BC=B9=E5=87=BA=E6=A1=86=E7=9A=84=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=20=E7=94=A8=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/ChartTypeInterfaceManager.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index e3fa679d6e..06e74b39ca 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -136,15 +136,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr allCharts[i] = rowChart; } - //异步加载图片 - new Thread(new Runnable() { - - @Override - public void run() { - initAllChartsDemoImage(allCharts); - } - }).start(); - return child; } From 39c06853dd8adc0ea4f14c2d893dde7bc4f103b4 Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 30 Jul 2018 21:51:00 +0800 Subject: [PATCH 03/13] =?UTF-8?q?CHART-2699=20=E7=B1=BB=E5=9E=8B=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=BC=B9=E5=87=BA=E6=A1=86=E7=9A=84=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=20=E7=94=A8=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/ChartTypeInterfaceManager.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index ff3056df26..06e74b39ca 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -136,15 +136,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr allCharts[i] = rowChart; } - //异步加载图片 -// new Thread(new Runnable() { -// -// @Override -// public void run() { -// initAllChartsDemoImage(allCharts); -// } -// }).start(); - return child; } From 8166d5dd409c18c4fe90bc609744cff1801fc161 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 30 Jul 2018 22:20:16 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 4e45f0e0c1..60ce965044 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -553,7 +553,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { return; } try { - String envName = getDefaultEnvName(); + final String envName = getDefaultEnvName(); WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()),new WorkContextCallback() { @Override From 9e926b954e491f460d56efd6361c8f277a36cb5a Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 31 Jul 2018 10:22:49 +0800 Subject: [PATCH 05/13] =?UTF-8?q?REPORT-10181=E3=80=9010.0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E3=80=91=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=BF=99=E9=87=8C=E6=8F=92=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AFjar=E5=8C=85=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java index a5673b7fa5..43fb9b2c39 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java @@ -229,7 +229,7 @@ public class PluginUtils { jo.put("free", pluginContext.isFree()); jo.put("licDamaged", pluginContext.isLicDamaged()); jo.put("available", pluginContext.isAvailable()); - jo.put("leftDays", String.valueOf(pluginContext.getLeftDays())); + jo.put("leftDays", pluginContext.getLeftDays()); jo.put("trial", pluginContext.isOnTrial()); jo.put("deadline", getDeadline(pluginContext)); jo.put("registerFailed", pluginContext.isRegisterFailed()); From fc78087cc544a2f55c4661cbdf64a5cff3e7028a Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 31 Jul 2018 11:21:34 +0800 Subject: [PATCH 06/13] =?UTF-8?q?REPORT-10160=2010.0=E5=86=92=E7=83=9F=20M?= =?UTF-8?q?ac=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8,=20=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E7=B3=8A=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 29e84d031a..e4c119f7d5 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -150,11 +150,6 @@ public class Designer extends BaseDesigner { private static SplashStrategy createSplash() { // 这里可以开接口加载自定义启动画面 - if (OperatingSystem.isWindows()) { - return new SplashFx(); - } else if (OperatingSystem.isMacOS()) { - return new SplashMac(); - } return new SplashFx(); } From e8a5d074a446bff3cb5bc978675751cbaa28cd3e Mon Sep 17 00:00:00 2001 From: hzzz Date: Tue, 31 Jul 2018 11:35:04 +0800 Subject: [PATCH 07/13] =?UTF-8?q?REPORT-9221=2010.0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9-=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/WebPreviewUtils.java | 10 +- .../fr/design/file/MutilTempalteTabPane.java | 26 +- .../com/fr/design/file/NewTemplatePane.java | 29 +- .../fun/TemplateTreeShortCutProvider.java | 14 + .../AbstractTemplateTreeShortCutProvider.java | 26 ++ .../fr/design/mainframe/DesignerFrame.java | 290 ++++++++++++------ .../DesignerFrameFileDealerPane.java | 38 ++- .../com/fr/design/mainframe/JTemplate.java | 8 +- .../mainframe/ToolBarNewTemplatePane.java | 36 +++ .../mainframe/toolbar/ToolBarMenuDock.java | 53 ++-- .../fr/design/mainframe/toolbar/VcsScene.java | 45 +++ .../java/com/fr/design/menu/ShortCut.java | 7 + .../java/com/fr/design/mainframe/JForm.java | 10 +- .../com/fr/design/mainframe/JWorkBook.java | 11 +- .../src/main/java/com/fr/start/Designer.java | 7 +- 15 files changed, 447 insertions(+), 163 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index 5cb36f3df8..e1c426eec7 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -1,6 +1,7 @@ package com.fr.design.actions.file; import com.fr.base.extension.FileExtension; +import com.fr.base.vcs.DesignerMode; import com.fr.design.fun.PreviewProvider; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -15,6 +16,7 @@ import com.fr.stable.web.AbstractWebletCreator; import javax.swing.JOptionPane; import java.util.Collections; +import java.util.HashMap; import java.util.Map; public final class WebPreviewUtils { @@ -34,6 +36,12 @@ public final class WebPreviewUtils { return; } + if (map == null || map == Collections.EMPTY_MAP) { + map = new HashMap<>(); + } + if (DesignerMode.isVcsMode()) { + map.put("mode", DesignerMode.getMode().toString()); + } DesignerContext.getDesignerFrame().refreshToolbar(); jt.stopEditing(); @@ -105,4 +113,4 @@ public final class WebPreviewUtils { } } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 2ebd5fe9c0..0190e60784 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -3,6 +3,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; @@ -313,6 +314,15 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M } + public void paint(Graphics g) { + //不可见时,按钮.4f透明 + AlphaComposite composite = DesignerMode.isVcsMode() + ? AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f) + : (AlphaComposite) ((Graphics2D) g).getComposite(); + ((Graphics2D) g).setComposite(composite); + super.paint(g); + } + private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { paintDefaultBackground(g2d); //最多能画的个数 @@ -359,7 +369,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M templateStartX += realWidth; } + if (!DesignerMode.isVcsMode()) { paintListDown(g2d, maxWidth); + } paintUnderLine(templateStartX, maxWidth, g2d); } @@ -538,7 +550,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; + if (!DesignerMode.isVcsMode()) { closeIcon.paintIcon(this, g2d, closePosition, closeY); + } return closePosition; } @@ -594,7 +608,9 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M g2d.drawString(sheetName, (int) templateStartX + sheeticon.getIconWidth() + 2 * GAP, getHeight() - GAP * 2); int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; int closePosition = (int) templateStartX + realWidth - CLOSE.getIconWidth() - SMALLGAP; + if (!DesignerMode.isVcsMode()) { closeIcon.paintIcon(this, g2d, closePosition, closeY); + } return closePosition; } @@ -640,6 +656,10 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M * @param e 鼠标事件 */ public void mousePressed(MouseEvent e) { + //如果在版本管理情况下,不允许切换tab + if (DesignerMode.isVcsMode()) { + return; + } int evtX = e.getX(); int evtY = e.getY(); @@ -672,7 +692,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M openedTemplate.get(selectedIndex).stopEditing(); selectedIndex = getTemplateIndex(evtX); //如果在权限编辑情况下,不允许切换到表单类型的工作簿 - if (BaseUtils.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { + if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Form-AuthorityEdited_Cannot_be_Supported") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); @@ -712,7 +732,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/"); - if (!specifiedTemplate.isALLSaved()) { + if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Utils-Would_you_like_to_save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); @@ -951,4 +971,4 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java index 47db76f4e5..dae921a1c8 100644 --- a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java @@ -1,6 +1,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; @@ -20,11 +21,10 @@ import java.awt.geom.Rectangle2D; public abstract class NewTemplatePane extends JComponent implements MouseListener, MouseMotionListener { private static final Icon GRAY_NEW_CPT = BaseUtils.readIcon("/com/fr/design/images/buttonicon/additicon_grey.png"); - private static final int PRE_GAP = 0; + private static final int ICON_START_X = 5; private static final int HEIGHT = 26; private Graphics2D g2d; private Icon newWorkBookIconMode = null; - private int newIconStartX = PRE_GAP; public NewTemplatePane() { @@ -49,7 +49,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene g2d.setColor(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); g2d.fill(new Rectangle2D.Double(0, 0, getWidth(),getHeight())); int sheetIconY = (getHeight() - newWorkBookIconMode.getIconHeight()) / 2; - newWorkBookIconMode.paintIcon(this, g2d, newIconStartX, sheetIconY); + newWorkBookIconMode.paintIcon(this, g2d, ICON_START_X, sheetIconY); // paintUnderLine(g2d); } @@ -65,7 +65,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseClicked(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } } @@ -76,12 +76,11 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene */ public void mousePressed(MouseEvent e) { int evtX = e.getX(); - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { newWorkBookIconMode = getMousePressNew(); - newIconStartX = 0; DesignerContext.getDesignerFrame().addAndActivateJTemplate(); } this.repaint(); @@ -92,7 +91,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseReleased(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } } @@ -102,7 +101,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseEntered(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } } @@ -112,8 +111,7 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene * @param e 事件 */ public void mouseExited(MouseEvent e) { - newIconStartX = PRE_GAP; - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } else { newWorkBookIconMode = getNew(); @@ -135,10 +133,9 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene */ public void mouseMoved(MouseEvent e) { int evtX = e.getX(); - if (BaseUtils.isAuthorityEditing()) { + if (needGrayNewCpt()) { newWorkBookIconMode = GRAY_NEW_CPT; } else if (isOverNewIcon(evtX)) { - newIconStartX = 0; newWorkBookIconMode = getMouseOverNew(); } @@ -146,9 +143,13 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene } + private boolean needGrayNewCpt() { + return DesignerMode.isAuthorityEditing() || DesignerMode.isVcsMode(); + } + private boolean isOverNewIcon(int evtX) { - return (evtX >= PRE_GAP && evtX <= PRE_GAP + newWorkBookIconMode.getIconWidth()); + return (evtX >= ICON_START_X && evtX <= ICON_START_X + newWorkBookIconMode.getIconWidth()); } public void setButtonGray(boolean isGray) { @@ -161,4 +162,4 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene public abstract Icon getMousePressNew(); -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java b/designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java new file mode 100644 index 0000000000..f5c9e09c6a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/TemplateTreeShortCutProvider.java @@ -0,0 +1,14 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Aftermath; +import com.fr.stable.fun.mark.Mutable; + +/** + * 左上角目录树上边工具条的插件接口 + * Created by hzzz on 2017/11/30. + */ +public interface TemplateTreeShortCutProvider extends Mutable, Aftermath { + String XML_TAG = "TemplateTreeShortCut"; + + int CURRENT_LEVEL = 1; +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java new file mode 100644 index 0000000000..22fe8aa767 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeShortCutProvider.java @@ -0,0 +1,26 @@ +package com.fr.design.fun.impl; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.fun.TemplateTreeShortCutProvider; +import com.fr.stable.fun.mark.API; + +/** + * 左上角目录树上边工具条的插件接口 + * Created by hzzz on 2017/11/30. + */ +@API(level = TemplateTreeShortCutProvider.CURRENT_LEVEL) +public abstract class AbstractTemplateTreeShortCutProvider extends UpdateAction implements TemplateTreeShortCutProvider { + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public void process() { + } + + @Override + public void undo() { + } +} 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 9b93816ef5..e2aaad44a4 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 @@ -4,18 +4,16 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.Env; -import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; -import com.fr.design.actions.file.SwitchExistEnv; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; +import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -28,6 +26,7 @@ import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuHighLight; +import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; @@ -43,10 +42,9 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogger; import com.fr.general.GeneralContext; -import com.fr.general.Inter; -import com.fr.general.env.EnvContext; + +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -56,12 +54,30 @@ import com.fr.stable.CoreConstants; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; - -import javax.swing.*; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.connect.WorkspaceConnection; + +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLayeredPane; +import javax.swing.JMenuBar; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -85,40 +101,54 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import java.util.logging.Level; 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 int LEFT_ALIGN_GAP = -5; + private static final int MENU_HEIGHT = 26; + private static final Integer SECOND_LAYER = new Integer(100); + private static final Integer TOP_LAYER = new Integer((200)); + private static java.util.List> appList = new java.util.ArrayList>(); private List designerOpenedListenerList = new ArrayList<>(); - //顶部日志+登陆按钮 - private static final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - private static ToolBarMenuDock ad; + private ToolBarMenuDock ad; private DesktopCardPane centerTemplateCardPane; private JPanel toolbarPane; + private JComponent toolbarComponent; private JPanel menuPane; + private JMenuBar menuBar; + private JPanel eastCenterPane; + private UIToolbar combineUp; + private NewTemplatePane newWorkBookPane = null; + private Icon closeMode = UIConstants.CLOSE_OF_AUTHORITY; + private JLayeredPane layeredPane = this.getLayeredPane(); + private JPanel basePane = new JPanel(); + // 上面的虚线 private DottedLine upDottedLine; + // 下面的虚线 private DottedLine downDottedLine; @@ -129,18 +159,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private DottedLine rightDottedLine; private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); + private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private WindowAdapter windowAdapter = new WindowAdapter() { + public void windowOpened(WindowEvent e) { - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); - reCalculateFrameSize(); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); } @Override public void windowClosing(WindowEvent e) { + SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); // 只有一个文件未保存时 if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) { @@ -158,7 +188,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta }; private JComponent closeButton = new JComponent() { + protected void paintComponent(Graphics g) { + g.setColor(UIConstants.NORMAL_BACKGROUND); g.fillArc(0, 0, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, 0, 360); @@ -167,19 +199,23 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta }; 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(); @@ -200,12 +236,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseEntered(MouseEvent e) { + closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); closeButton.repaint(); } }; + private ProgressDialog progressDialog; + public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME); @@ -218,7 +257,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // the content pane basePane.setLayout(new BorderLayout()); toolbarPane = new JPanel() { + public Dimension getPreferredSize() { + Dimension dim = super.getPreferredSize(); // dim.height = TOOLBAR_HEIGHT; return dim; @@ -261,19 +302,32 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.addWindowListeners(getFrameListeners()); this.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + reCalculateFrameSize(); - if (DesignerMode.isAuthorityEditing()) { + if (BaseUtils.isAuthorityEditing()) { doResize(); } } }); + this.addDesignerOpenedListener(new DesignerOpenedListener() { + + @Override + public void designerOpened() { + + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); + reCalculateFrameSize(); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); + } + }); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setVisible(false); this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); closeMode = UIConstants.CLOSE_OF_AUTHORITY; initMenuPane(); + this.progressDialog = new ProgressDialog(this); } /** @@ -282,6 +336,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param app 注册app. */ public static void registApp(App app) { + if (app != null) { appList.add(app); } @@ -298,6 +353,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 注册"设计器初始化完成"的监听 */ public void addDesignerOpenedListener(DesignerOpenedListener listener) { + designerOpenedListenerList.add(listener); } @@ -305,12 +361,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 触发"设计器初始化完成"事件 */ public void fireDesignerOpened() { + for (DesignerOpenedListener listener : designerOpenedListenerList) { listener.designerOpened(); } } protected DesktopCardPane getCenterTemplateCardPane() { + return centerTemplateCardPane; } @@ -318,41 +376,45 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 初始menuPane的方法 方便OEM时修改该组件 */ protected void initMenuPane() { + menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - menuPane.add(initNorthEastPane(), BorderLayout.EAST); + menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); basePane.add(menuPane, BorderLayout.NORTH); this.resetToolkitByPlus(null); } /** + * @param ad * @return */ - protected JPanel initNorthEastPane() { + 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(); - DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv()); + refreshNorthEastPane(northEastPane, ad); + DesignUtils.refreshDesignerFrame(); } }, new PluginFilter() { @Override public boolean accept(PluginContext context) { - return !SwitchExistEnv.isSwitching() - && context.contain(PluginModule.ExtraDesign); + + return context.contain(PluginModule.ExtraDesign); } }); - refreshNorthEastPane(); + refreshNorthEastPane(northEastPane, ad); return northEastPane; } - public static void refreshNorthEastPane() { + private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { + northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); @@ -368,24 +430,27 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void initTitleIcon() { + try { @SuppressWarnings("unchecked") List image = ICODecoder.read(DesignerFrame.class .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); this.setIconImages(image); } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); } } private void addWindowListeners(ArrayList listeners) { + for (WindowListener listener : listeners) { this.addWindowListener(listener); } } protected ArrayList getFrameListeners() { + ArrayList arrayList = new ArrayList(); arrayList.add(windowAdapter); return arrayList; @@ -393,11 +458,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta protected void laoyoutWestPane() { + basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST); } // 调整windows大小 private void reCalculateFrameSize() { + contentHeight = layeredPane.getHeight(); contentWidth = layeredPane.getWidth(); layeredPane.remove(basePane); @@ -410,6 +477,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 更新 */ public void populateAuthorityArea() { + int centerWidth = contentWidth - WestRegionContainerPane.getInstance().getContainerWidth() - EastRegionContainerPane.getInstance().getContainerWidth(); // 上面的虚线 @@ -434,6 +502,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void addDottedLine() { + layeredPane.add(upDottedLine, SECOND_LAYER); layeredPane.add(downDottedLine, SECOND_LAYER); layeredPane.add(leftDottedLine, SECOND_LAYER); @@ -442,6 +511,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void removeDottedLine() { + layeredPane.remove(upDottedLine); layeredPane.remove(downDottedLine); layeredPane.remove(leftDottedLine); @@ -450,6 +520,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public JLayeredPane getContentFrame() { + return layeredPane; } @@ -457,7 +528,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 刷新 */ public void refreshDottedLine() { - if (DesignerMode.isAuthorityEditing()) { + + if (BaseUtils.isAuthorityEditing()) { populateAuthorityArea(); populateCloseButton(); addDottedLine(); @@ -471,6 +543,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 刷新DottedLine */ public void doResize() { + removeDottedLine(); populateAuthorityArea(); populateCloseButton(); @@ -495,6 +568,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体 */ private void fireAuthorityStateToNomal() { + java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 @@ -505,10 +579,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void setCloseMode(Icon closeMode) { + this.closeMode = closeMode; } private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) { + combineUp = new UIToolbar(FlowLayout.LEFT); combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); @@ -516,7 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta for (int i = 0; i < fixButtons.length; i++) { combineUp.add(fixButtons[i]); } - if (!DesignerMode.isAuthorityEditing()) { + if (!BaseUtils.isAuthorityEditing()) { combineUp.addSeparator(new Dimension(2, 16)); if (toolbar4Form != null) { for (int i = 0; i < toolbar4Form.length; i++) { @@ -535,6 +611,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void addExtraButtons() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; @@ -551,6 +628,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } private void addShareButton() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; @@ -570,6 +648,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param al 组件名称 */ public void checkCombineUp(boolean flag, ArrayList al) { + combineUp.checkComponentsByNames(flag, al); } @@ -578,6 +657,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 刷新工具条. */ public void refreshToolbar() { + this.ad.updateToolBarDef(); } @@ -587,6 +667,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param plus 工具条中相关信息 */ public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { + if (plus == null) { plus = ToolBarMenuDock.NULLAVOID; } @@ -619,6 +700,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public JComponent getToolbarComponent() { + return this.toolbarComponent; } @@ -627,22 +709,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void needToAddAuhtorityPaint() { - newWorkBookPane.setButtonGray(DesignerMode.isAuthorityEditing()); + newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); // 进入或退出权限编辑模式,通知插件 Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); for (ShortCut shortCut : extraShortCuts) { if (shortCut instanceof AbstractTemplateTreeShortCutProvider) { - ((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing()); + ((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(BaseUtils.isAuthorityEditing()); } } - } /** * 检查工具条. */ private void checkToolbarMenuEnable() { + if (this.ad != null) { this.ad.updateMenuDef(); this.ad.updateToolBarDef(); @@ -653,29 +735,34 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 设置标题 */ public void setTitle() { + JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); defaultTitleSB.append(ProductConstants.PRODUCT_NAME); defaultTitleSB.append(" "); defaultTitleSB.append(ProductConstants.BRANCH); + defaultTitleSB.append(" "); // james:标识登录的用户和登录的ENV String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); - Env env = DesignerEnvManager.getEnvManager().getEnv(envName); - if (env != null) { - defaultTitleSB.append(env.getUser()).append('@').append(envName).append('['); - defaultTitleSB.append(env.getEnvDescription()); - defaultTitleSB.append(']'); - if (editingTemplate != null) { - String path = editingTemplate.getEditingFILE().getPath(); - if (!editingTemplate.getEditingFILE().exists()) { - path = FILEFactory.MEM_PREFIX + path; - } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { - path = env.getPath() + File.separator + path; - } - defaultTitleSB.append(" " + path); - } + Workspace workspace = WorkContext.getCurrent(); + DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); + String username = null; + if (info != null) { + WorkspaceConnection connection = info.getConnection(); + username = connection == null ? StringUtils.EMPTY : connection.getUserName(); } + defaultTitleSB.append(username).append("@").append(envName).append("[").append(workspace.getDescription()).append("]"); + if (editingTemplate != null) { + String path = editingTemplate.getEditingFILE().getPath(); + if (!editingTemplate.getEditingFILE().exists()) { + path = FILEFactory.MEM_PREFIX + path; + } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { + path = workspace.getPath() + File.separator + path; + } + defaultTitleSB.append(" " + path); + } + setTitle(defaultTitleSB.toString()); } @@ -712,16 +799,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 报表运行环境改变时,需要刷新某些面板 - * - * @param env 环境 */ - public void refreshEnv(Env env) { + public void refreshEnv() { + this.setTitle(); DesignerFrameFileDealerPane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TemplateTreePane.getInstance().refreshDockingView(); DesignTableDataManager.clearGlobalDs(); EastRegionContainerPane.getInstance().refreshDownPane(); + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (template != null) { template.refreshToolArea(); @@ -732,6 +819,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 返回选中的模板. */ public JTemplate getSelectedJTemplate() { + return this.centerTemplateCardPane.getSelectedJTemplate(); } @@ -740,6 +828,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void saveCurrentEditingTemplate() { + JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (editingTemplate == null) { return; @@ -752,23 +841,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - Inter.getLocText("Utils-Would_you_like_to_save") + " \"" + editingTemplate.getEditingFILE() + com.fr.design.i18n.Toolkit.i18nText("Utils-Would_you_like_to_save") + " \"" + editingTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FRLogger.getLogger().log( - Level.INFO, - Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ - editingTemplate.getEditingFILE().getName(), "."})); + FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Template_Already_Saved", + editingTemplate.getEditingFILE().getName())); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FRLogger.getLogger().log( - Level.INFO, - Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ - editingTemplate.getEditingFILE().getName(), "."})); + FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Template_Already_Saved", + editingTemplate.getEditingFILE().getName())); } } } @@ -778,6 +863,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 添加新建模板, 并激活. */ public void addAndActivateJTemplate() { + addAndActivateJTemplate(ad.createNewTemplate()); layeredPane.repaint(); } @@ -822,6 +908,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param e 事件 */ public void targetModified(TargetModifiedEvent e) { + this.checkToolbarMenuEnable(); } @@ -831,6 +918,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void templateClosed(JTemplate jt) { + } /** @@ -839,6 +927,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void templateOpened(JTemplate jt) { + } /** @@ -847,6 +936,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void templateSaved(JTemplate jt) { + this.checkToolbarMenuEnable(); } @@ -857,22 +947,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void openTemplate(FILE tplFile) { // 测试连接,如果连接失败,则提示 - try { - if (FRContext.getCurrentEnv() != null - && !FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Inter.getLocText(new String[]{"FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened"}, new String[]{ - ",", "!"}), Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); - return; - } - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } +// try { +// if (FRContext.getCommonOperator() != null +// && !FRContext.getCommonOperator().testServerConnectionWithOutShowMessagePane()) { +// JOptionPane.showMessageDialog( +// DesignerContext.getDesignerFrame(), +// com.fr.design.i18n.Toolkit.i18nText(new String[]{"FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened"}, new String[]{ +// ",", "!"}), com.fr.design.i18n.Toolkit.i18nText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); +// return; +// } +// } catch (Exception e) { +// FineLoggerFactory.getLogger().error(e.getMessage()); +// } // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), + JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Warning-Template_Do_Not_Exsit"), ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); DesignerFrameFileDealerPane.getInstance().refresh(); return; @@ -881,7 +971,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { openFile(tplFile); } catch (Throwable t) { - FRLogger.getLogger().error(t.getMessage(), t); + FineLoggerFactory.getLogger().error(t.getMessage(), t); addAndActivateJTemplate(); } @@ -895,6 +985,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @date 2014-10-14-下午6:30:37 */ private boolean inValidDesigner(JTemplate jt) { + return jt.isOldDesigner() || (!jt.isJWorkBook() && jt.isNewDesigner()); } @@ -905,6 +996,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @date 2014-10-14-下午6:31:05 */ private void openFile(FILE tplFile) { + String fileName = tplFile.getName(); int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); if (indexOfLastDot < 0) { @@ -913,16 +1005,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta String fileExtention = fileName.substring(indexOfLastDot + 1); for (int i = 0, len = appList.size(); i < len; i++) { App app = appList.get(i); - String[] defaultAppExtentions = app.defaultExtentions(); + String[] defaultAppExtentions = app.defaultExtensions(); boolean opened = false; for (int j = 0; j < defaultAppExtentions.length; j++) { if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { - JTemplate jt = null; - try { - jt = app.openTemplate(tplFile); - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage(), e); - } + // 不要catch + JTemplate jt = app.openTemplate(tplFile); + if (jt == null) { return; } @@ -953,16 +1042,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ private void activeTemplate(FILE tplFile, JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()}); - if (tplFile instanceof FileNodeFILE) { - fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); - } - // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 - if (tplFile instanceof FileFILE) { - fullName = tplFile.getPath(); - } - fullName = OperatingSystem.isWindows() ? fullName.replaceAll("/", "\\\\") : fullName.replaceAll("\\\\", "/"); - int index = HistoryTemplateListPane.getInstance().contains(fullName); + int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); @@ -975,9 +1055,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * Exit退出 */ public void exit() { + Thread thread = new Thread() { + @Override public void run() { + DesignerEnvManager.doEndMapSaveWorkersIndesign(); } }; @@ -986,7 +1069,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { thread.join(); } catch (InterruptedException e) { - FRLogger.getLogger().error("Map Thread Error"); + FineLoggerFactory.getLogger().error("Map Thread Error"); } DesignerEnvManager.getEnvManager().setLastOpenFile( @@ -1003,14 +1086,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignerEnvManager.getEnvManager().saveXMLFile(); - Env currentEnv = FRContext.getCurrentEnv(); - try { - EnvContext.fireBeforeSignOut(); - currentEnv.signOut(); - EnvContext.fireAfterSignOut(); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } + WorkContext.switchTo(null); + this.setVisible(false); this.dispose(); @@ -1024,18 +1101,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void dragEnter(DropTargetDragEvent event) { + } @Override public void dragExit(DropTargetEvent event) { + } @Override public void dragOver(DropTargetDragEvent event) { + } @Override public void dropActionChanged(DropTargetDragEvent event) { + if (!isDragAcceptable(event)) { event.rejectDrag(); return; @@ -1045,6 +1126,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @SuppressWarnings("unchecked") @Override public void drop(DropTargetDropEvent event) { + if (!isDropAcceptable(event)) { event.rejectDrop(); return; @@ -1065,19 +1147,25 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } event.dropComplete(true); } public boolean isDragAcceptable(DropTargetDragEvent event) { + return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; } public boolean isDropAcceptable(DropTargetDropEvent event) { + return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; } } -} \ No newline at end of file + public ProgressDialog getProgressDialog() { + + return progressDialog; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 137d0bf4db..c09e6e846f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -31,21 +31,30 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; - import com.fr.io.utils.ResourceIOUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -59,9 +68,13 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private CardLayout card; private JPanel cardPane; + private java.util.List otherToobarStateChangeListeners= new ArrayList<>(); - private FileOperations selectedOperation; + public FileOperations getSelectedOperation() { + return selectedOperation; + } + private FileOperations selectedOperation; private UIToolbar toolBar; private OpenReportAction openReportAction = new OpenReportAction(); @@ -244,6 +257,21 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt selectedOperation.refresh(); stateChange(); + + } + } + + public void addToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) { + this.otherToobarStateChangeListeners.add(toobarStateChangeListener); + } + + public void removeToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) { + this.otherToobarStateChangeListeners.remove(toobarStateChangeListener); + } + + private void otherStateChange() { + for (FileToolbarStateChangeListener toobarStateChangeListener : otherToobarStateChangeListeners) { + toobarStateChangeListener.stateChange(); } } @@ -578,4 +606,4 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt return null; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 9f03ddcf66..d896c1364c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -6,6 +6,7 @@ import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.TemplateIdAttrMark; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -32,6 +33,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import com.fr.design.mainframe.toolbar.VcsScene; import com.fr.design.menu.MenuDef; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; @@ -699,7 +701,9 @@ public abstract class JTemplate> */ @Override public ShortCut[] shortcut4FileMenu() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isVcsMode()) { + return VcsScene.shortcut4FileMenu(this); + } else if (DesignerMode.isAuthorityEditing()) { return new ShortCut[]{new SaveTemplateAction(this), new UndoAction(this), new RedoAction(this)}; } else { return new ShortCut[]{new SaveTemplateAction(this), new SaveAsTemplateAction(this), new UndoAction(this), new RedoAction(this)}; @@ -721,7 +725,9 @@ public abstract class JTemplate> tplMenu.addShortCut(new TableDataSourceAction(this)); tplMenu.addShortCut(shortcut4TemplateMenu()); } + if (!DesignerMode.isVcsMode()) { tplMenu.addShortCut(shortCuts4Authority()); + } return new MenuDef[]{tplMenu}; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java new file mode 100644 index 0000000000..1f7cab6d6f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java @@ -0,0 +1,36 @@ +package com.fr.design.mainframe; + +import com.fr.base.BaseUtils; +import com.fr.design.file.NewTemplatePane; + +import javax.swing.Icon; + +/** + * Created by hzzz on 2017/12/26. + */ +public class ToolBarNewTemplatePane extends NewTemplatePane { + + private static final ToolBarNewTemplatePane instance = new ToolBarNewTemplatePane(); + + private ToolBarNewTemplatePane() { + } + + public static NewTemplatePane getInstance() { + return instance; + } + + @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 getMousePressNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index fcf8b7ddc1..5b7d561abd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -3,8 +3,8 @@ */ package com.fr.design.mainframe.toolbar; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; @@ -42,6 +42,7 @@ import com.fr.design.gui.imenu.UIMenuBar; import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.ToolBarNewTemplatePane; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; @@ -50,7 +51,6 @@ import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -61,8 +61,17 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -320,10 +329,15 @@ public abstract class ToolBarMenuDock { } public MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { + if (DesignerMode.isVcsMode()) { + MenuDef menuDef = VcsScene.createFileMenuDef(plus); + insertMenu(menuDef, MenuHandler.FILE); + return menuDef; + } MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F'); ShortCut[] scs = new ShortCut[0]; - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { scs = createNewFileShortCuts(); } if (!ArrayUtils.isEmpty(scs)) { @@ -354,13 +368,13 @@ public abstract class ToolBarMenuDock { } protected void addCloseCurrentTemplateAction(MenuDef menuDef) { - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut(new CloseCurrentTemplateAction()); } } protected void addPreferenceAction(MenuDef menuDef) { - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut(new PreferenceAction()); } } @@ -396,7 +410,7 @@ public abstract class ToolBarMenuDock { protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Server"), 'S'); - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut( new ConnectionListAction(), createGlobalTDAction() @@ -412,7 +426,7 @@ public abstract class ToolBarMenuDock { menuDef.addShortCut(new RemoteDesignAuthorityManagerAction()); } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { if (shouldShowPlugin()) { menuDef.addShortCut( new PluginManagerAction() @@ -434,7 +448,7 @@ public abstract class ToolBarMenuDock { } private boolean shouldShowRemotePermission() { - + return WorkContext.getCurrent() != null && !WorkContext.getCurrent().isLocal() && WorkContext.getCurrent().isRoot(); } @@ -588,22 +602,7 @@ public abstract class ToolBarMenuDock { } 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 getMousePressNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); - } - }; + return ToolBarNewTemplatePane.getInstance(); } protected void insertMenu(MenuDef menuDef, String anchor) { @@ -751,4 +750,4 @@ public abstract class ToolBarMenuDock { return handler.shortcut(plus); } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java new file mode 100644 index 0000000000..d3e3631a6e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java @@ -0,0 +1,45 @@ +package com.fr.design.mainframe.toolbar; + +import com.fr.base.vcs.DesignerMode; +import com.fr.design.actions.edit.RedoAction; +import com.fr.design.actions.edit.UndoAction; +import com.fr.design.actions.file.ExitDesignerAction; +import com.fr.design.actions.file.PreferenceAction; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.menu.MenuDef; +import com.fr.design.menu.SeparatorDef; +import com.fr.design.menu.ShortCut; +import com.fr.stable.ArrayUtils; + +/** + * Created by hzzz on 2017/12/28. + */ +public class VcsScene { + + public static MenuDef createFileMenuDef(ToolBarMenuDockPlus plus) { + MenuDef menuDef = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"), 'F'); + + ShortCut[] scs = new ShortCut[0]; + if (!ArrayUtils.isEmpty(scs)) { + menuDef.addShortCut(scs); + } + + scs = plus.shortcut4FileMenu(); + if (!ArrayUtils.isEmpty(scs)) { + menuDef.addShortCut(SeparatorDef.DEFAULT); + menuDef.addShortCut(scs); + menuDef.addShortCut(SeparatorDef.DEFAULT); + } + + if (!DesignerMode.isAuthorityEditing()) { + menuDef.addShortCut(new PreferenceAction()); + } + + menuDef.addShortCut(new ExitDesignerAction()); + return menuDef; + } + + public static ShortCut[] shortcut4FileMenu(JTemplate jTemplate) { + return new ShortCut[]{new UndoAction(jTemplate), new RedoAction(jTemplate)}; + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/ShortCut.java b/designer-base/src/main/java/com/fr/design/menu/ShortCut.java index a2f8e943c8..beca4ae723 100644 --- a/designer-base/src/main/java/com/fr/design/menu/ShortCut.java +++ b/designer-base/src/main/java/com/fr/design/menu/ShortCut.java @@ -71,4 +71,11 @@ public abstract class ShortCut extends AbstractProvider implements Mutable { public void setMenuKeySet(MenuKeySet menuKeySet) { this.menuKeySet = menuKeySet; } + + /** + * 权限编辑模式变更时候会调用这个方法 + * @param isAuhtority + */ + public void notifyFromAuhtorityChange(boolean isAuhtority) { + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index b219f6396b..e5fdfc9a51 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.PaperSize; import com.fr.base.Parameter; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.WebPreviewUtils; @@ -55,7 +56,6 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.ComparatorUtils; - import com.fr.log.FineLoggerFactory; import com.fr.page.PaperSettingProvider; import com.fr.report.worksheet.FormElementCase; @@ -141,7 +141,7 @@ public class JForm extends JTemplate implements BaseJForm { return processInfo; } - public FormECCompositeProvider getReportComposite(){ + public FormECCompositeProvider getReportComposite() { return this.reportComposite; } @@ -204,7 +204,8 @@ public class JForm extends JTemplate implements BaseJForm { */ public ShortCut[] shortcut4FileMenu() { return (ShortCut[]) ArrayUtils.addAll( - super.shortcut4FileMenu(), new ShortCut[]{this.createWorkBookExportMenu()} + super.shortcut4FileMenu(), + DesignerMode.isVcsMode() ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); } @@ -257,6 +258,7 @@ public class JForm extends JTemplate implements BaseJForm { }); formDesign.addDesignerEditListener(new DesignerEditListener() { private XComponent lastAffectedCreator; + @Override public void fireCreatorModified(DesignerEvent evt) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) { @@ -843,7 +845,7 @@ public class JForm extends JTemplate implements BaseJForm { Object[] designerArg = new Object[]{formDesign.getElementCase(), getTarget()}; FormECDesignerProvider formECDesigner = StableFactory.getMarkedInstanceObjectFromClass(FormECDesignerProvider.XML_TAG, designerArg, designerClass, FormECDesignerProvider.class); // 如果是移动端专属模版,需要修改页面大小并显示边缘线 - PaperSettingProvider paperSetting = ((FormElementCase)formECDesigner.getEditingElementCase()).getReportSettings().getPaperSetting(); + PaperSettingProvider paperSetting = ((FormElementCase) formECDesigner.getEditingElementCase()).getReportSettings().getPaperSetting(); paperSetting.setPaperSize(getTarget().getFormMobileAttr().isMobileOnly() ? PaperSize.PAPERSIZE_MOBILE : new PaperSize()); return formECDesigner; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 0fd66e40f5..b85ecedd7a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -5,6 +5,7 @@ import com.fr.base.DynamicUnitList; import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.AllowAuthorityEditAction; @@ -632,9 +633,11 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4FileMenu() { - return (ShortCut[]) ArrayUtils.addAll( - super.shortcut4FileMenu(), - BaseUtils.isAuthorityEditing() || (!WorkContext.getCurrent().isLocal()) ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} + boolean showWorkBookExportMenu = DesignerMode.isVcsMode() + || DesignerMode.isAuthorityEditing() + || !WorkContext.getCurrent().isLocal(); + return (ShortCut[]) ArrayUtils.addAll(super.shortcut4FileMenu(), + showWorkBookExportMenu ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} ); } @@ -1161,4 +1164,4 @@ public class JWorkBook extends JTemplate { public String route() { return ViewRequestConstants.REPORT_VIEW_PATH; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 29e84d031a..d02fcb0164 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -2,6 +2,7 @@ package com.fr.start; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.file.WebPreviewUtils; @@ -192,7 +193,7 @@ public class Designer extends BaseDesigner { return menuDef; } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { menuDef.addShortCut(SeparatorDef.DEFAULT); if (WorkContext.getCurrent().isRoot()) { @@ -362,7 +363,7 @@ public class Designer extends BaseDesigner { if (jt == null) { return; } - saveButton.setEnabled(!jt.isSaved()); + saveButton.setEnabled(!jt.isSaved() && !DesignerMode.isVcsMode()); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListPane.getInstance().getHistoryList()); MutilTempalteTabPane.getInstance().repaint(); if (DesignerEnvManager.getEnvManager().isSupportUndo()) { @@ -387,7 +388,7 @@ public class Designer extends BaseDesigner { @Override public JComponent resetToolBar(JComponent toolbarComponent, ToolBarMenuDockPlus plus) { //如果是处于权限编辑状态 - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (plus instanceof JWorkBook && plus.toolbars4Target() == null) { //聚合块编辑 return super.polyToolBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Privilege_Poly_Block_Edit")); From 2ae7e2a073619cca9fce3df9eea8eed5c85bd408 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 31 Jul 2018 14:17:04 +0800 Subject: [PATCH 08/13] =?UTF-8?q?REPORT-9652=20=E4=BC=98=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=87=8F=E5=B0=91RPC=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=AE=BF=E9=97=AE=E6=AC=A1=E6=95=B0=20?= =?UTF-8?q?=E3=80=9010.0=E4=BA=8C=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=9B=86=E6=88=90-=E9=9B=86=E7=BE=A4-?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E9=87=8F=E6=A8=A1=E6=9D=BF=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=97=B6=E6=96=87=E4=BB=B6=E5=A4=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/itree/filetree/TemplateFileTree.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index 4ac6141c7e..862aff3796 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -179,8 +179,9 @@ public class TemplateFileTree extends EnvFileTree { @Override protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) { + FileNode[] fnArray = listFileNodes(treeNode); - + return fileNodeArray2TreeNodeArray(fnArray); } @@ -189,13 +190,14 @@ public class TemplateFileTree extends EnvFileTree { */ private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) { boolean isLocal = WorkContext.getCurrent().isLocal(); + boolean isRoot = WorkContext.getCurrent().isRoot(); ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length]; for (int i = 0; i < res.length; i++) { FileNode fn = fileNodes[i]; res[i] = new ExpandMutableTreeNode(fn); if (fn.isDirectory()) { res[i].add(new ExpandMutableTreeNode()); - if (isLocal || WorkContext.getCurrent().isRoot()) { + if (isLocal || isRoot) { res[i].setFullAuthority(true); } else { boolean hasFullAuthority = isContained(fn); @@ -203,7 +205,6 @@ public class TemplateFileTree extends EnvFileTree { } } } - return res; } @@ -269,6 +270,7 @@ public class TemplateFileTree extends EnvFileTree { * 求当前TreeNode下所有的FileNode. */ private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) { + if (currentTreeNode == null) { return new FileNode[0]; } @@ -276,6 +278,7 @@ public class TemplateFileTree extends EnvFileTree { Object object = currentTreeNode.getUserObject(); if (object instanceof FileNode) { + return this.listFileNodes(((FileNode) object).getEnvPath()); } From 3f1cec83e442ad5eae2da31de240199cc2309e51 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 31 Jul 2018 14:32:21 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=90=8E=EF=BC=8C=E6=B0=B4=E5=8D=B0=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormDesignerUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 0f1ccf33ce..6e075f7338 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -115,7 +115,7 @@ public class FormDesignerUI extends ComponentUI { private void paintWatermark(Graphics2D g) { WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget()); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution()); - painter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds()); + painter.paint(g, 0, 0, designer.getArea().getBounds()); } private int[] getActualLine(int i) { From 9ab8e82ada52be5efd7c8201399fbdd362e733a9 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 31 Jul 2018 14:36:09 +0800 Subject: [PATCH 10/13] =?UTF-8?q?CORE-116=20=E7=BB=A7=E7=BB=AD=E6=94=B9?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 130 +++++++++--------- .../design/actions/community/VideoAction.java | 4 +- .../design/actions/file/PreferencePane.java | 84 ++++------- .../design/actions/file/SwitchExistEnv.java | 5 +- .../com/fr/design/actions/help/AboutPane.java | 30 ++-- .../design/actions/help/TutorialAction.java | 3 +- .../fr/design/editor/editor/DateEditor.java | 8 +- .../com/fr/design/formula/FormulaPane.java | 3 +- .../com/fr/design/formula/FunctionNAD.java | 48 +++---- .../com/fr/design/mainframe/TemplatePane.java | 2 + .../mainframe/toolbar/ToolBarMenuDock.java | 7 +- .../java/com/fr/design/utils/DesignUtils.java | 2 +- .../com/fr/design/DesignerEnvManagerTest.java | 23 +--- .../actions/help/TutorialActionTest.java | 11 +- .../start/CollectUserInformationDialog.java | 15 +- .../main/java/com/fr/start/SplashContext.java | 5 +- .../fr/start/module/PreStartActivator.java | 2 +- 17 files changed, 167 insertions(+), 215 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 60ce965044..13b95f8f4f 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -22,10 +22,9 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; -import com.fr.general.Inter; import com.fr.general.xml.GeneralXMLTools; -import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.stable.CommonUtils; import com.fr.stable.Constants; import com.fr.stable.EnvChangedListener; import com.fr.stable.ListMap; @@ -43,10 +42,9 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.connect.AuthException; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.SwingWorker.StateValue; -import java.awt.Color; -import java.awt.Rectangle; +import java.awt.*; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; @@ -111,7 +109,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private Color paginationLineColor = Color.black; // line color of paper private boolean supportCellEditorDef = false; private boolean isDragPermited = false; - private int language; + private Locale language = Locale.SIMPLIFIED_CHINESE; //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 private boolean useOracleSystemSpace = true; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; @@ -502,7 +500,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回默认环境 */ public DesignerWorkspaceInfo getDefaultConfig() { - String installHome = StableUtils.getInstallHome(); + String installHome = StableUtils.getInstallHome(); String defaultenvPath = getDefaultenvPath(installHome); defaultenvPath = new File(defaultenvPath).getPath(); Iterator> entryIt = nameEnvMap.entrySet().iterator(); @@ -554,7 +552,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } try { final String envName = getDefaultEnvName(); - WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()),new WorkContextCallback() { + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()), new WorkContextCallback() { @Override public void done() { @@ -713,37 +711,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * 返回语言类型 */ - public int getLanguage() { - return this.language; - } - - /** - * 返回语言类型 - */ - public Locale getLocale() { - // 性能 - if (language <= 1) { - return Locale.CHINA; - } - Locale[] locales = supportLocale(); - if (language <= locales.length) { - return locales[language - 1]; - } - return Locale.CHINA; - } - - // 当前系统支持的语言 - protected Locale[] supportLocale() { - Inter.getInstance(); - Map languageMap = InterProviderFactory.getProvider().getSupportLocaleMap(); - return languageMap.keySet().toArray(new Locale[languageMap.size()]); + public Locale getLanguage() { + return language; } /** * 设置语言参数 */ - public void setLanguage(int i) { - this.language = i; + public void setLanguage(Locale locale) { + this.language = locale; } /** @@ -1310,7 +1286,34 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void readLanguage(XMLableReader reader) { String tmpVal; if ((tmpVal = reader.getElementValue()) != null) { - this.setLanguage(Integer.parseInt(tmpVal)); + if (!CommonUtils.isNumber(tmpVal)) { + setLanguage(CommonUtils.stringToLocale(tmpVal)); + } else { + // 用于兼容10.0之前的版本 + int value = Integer.parseInt(tmpVal); + switch (value) { + case 0: + setLanguage(Locale.SIMPLIFIED_CHINESE); + break; + case 1: + setLanguage(Locale.US); + break; + case 2: + setLanguage(Locale.JAPAN); + break; + case 3: + setLanguage(Locale.TRADITIONAL_CHINESE); + break; + case 4: + setLanguage(Locale.KOREA); + break; + case 5: + setLanguage(new Locale("pt", "PT")); + break; + default: + setLanguage(Locale.SIMPLIFIED_CHINESE); + } + } } } @@ -1368,6 +1371,34 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { reader.readXMLObject(this.configManager); } + public String getUUID() { + return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid; + } + + public int getActiveKeyStatus() { + return activeKeyStatus; + } + + public void setActiveKeyStatus(int activeKeyStatus) { + this.activeKeyStatus = activeKeyStatus; + } + + public AlphaFineConfigManager getAlphaFineConfigManager() { + return alphaFineConfigManager; + } + + public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { + this.alphaFineConfigManager = alphaFineConfigManager; + } + + public boolean isImageCompress() { + return imageCompress; + } + + public void setImageCompress(boolean imageCompress) { + this.imageCompress = imageCompress; + } + /** * Read XML.
* The method will be invoked when read data from XML file.
@@ -1640,17 +1671,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } } - public String getUUID() { - return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid; - } - - public int getActiveKeyStatus() { - return activeKeyStatus; - } - - public void setActiveKeyStatus(int activeKeyStatus) { - this.activeKeyStatus = activeKeyStatus; - } //写入uuid private void writeUUID(XMLPrintWriter writer) { @@ -1814,7 +1834,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writer.textNode("" + this.lastOpenFilePath); writer.end(); - writer.startTAG("Language").textNode(String.valueOf(this.language)).end() + writer.startTAG("Language").textNode(CommonUtils.localeToString(language)).end() .startTAG("JettyServerPort").textNode(String.valueOf(this.jettyServerPort)).end(); } @@ -1867,20 +1887,4 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { .end(); } - - public AlphaFineConfigManager getAlphaFineConfigManager() { - return alphaFineConfigManager; - } - - public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { - this.alphaFineConfigManager = alphaFineConfigManager; - } - - public boolean isImageCompress() { - return imageCompress; - } - - public void setImageCompress(boolean imageCompress) { - this.imageCompress = imageCompress; - } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index 17d45f0292..f28ee3b722 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -4,8 +4,8 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; - import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -33,7 +33,7 @@ public class VideoAction extends UpdateAction public void actionPerformed(ActionEvent arg0) { String url; - if (FRContext.getLocale().equals(Locale.US)) { + if (GeneralContext.getLocale().equals(Locale.US)) { url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); } else { url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index de57a4018d..37405bb55a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIDictionaryComboBox; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -23,7 +24,6 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; - import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; import com.fr.third.apache.log4j.Level; @@ -32,14 +32,11 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; -import java.util.ArrayList; import java.util.Locale; import java.util.Map; @@ -87,9 +84,7 @@ public class PreferencePane extends BasicPane { private static final String DISPLAY_MINUS = "-"; private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG}; - private static java.util.List LANGUAGE = new ArrayList<>(); - private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言 private boolean languageChanged; // 是否修改了设计器语言设置 //设置是否支持undo private UICheckBox supportUndoCheckBox; @@ -114,7 +109,8 @@ public class PreferencePane extends BasicPane { private UITextField logExportDirectoryField; - private UIComboBox logLevelComboBox, languageComboBox, pageLengthComboBox, reportLengthComboBox; + private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; + private UIDictionaryComboBox languageComboBox; private IntegerEditor portEditor; private UITextField jdkHomeTextField; private UICheckBox oracleSpace; @@ -123,18 +119,8 @@ public class PreferencePane extends BasicPane { public PreferencePane() { this.initComponents(); - this.initLanguageItems(); } - // 语言选项 - private void initLanguageItems() { - LANGUAGE.clear(); - Map map = InterProviderFactory.getProvider().getSupportLocaleMap(); - LANGUAGE.add(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Language_Default")); - for (Locale locale : map.keySet()) { - LANGUAGE.add(getLocaledLanguage(map.get(locale), locale)); - } - } protected void initComponents() { JPanel contentPane = this; @@ -182,13 +168,6 @@ public class PreferencePane extends BasicPane { advancePane.add(spaceUpPane); } - private static String getLocaledLanguage(String key, Locale locale) { - StringBuilder sb = new StringBuilder(); - sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append("("); - sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append(")"); - return sb.toString(); - } - private void createFunctionPane(JPanel generalPane) { JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference-Function")); generalPane.add(functionPane); @@ -379,8 +358,9 @@ public class PreferencePane extends BasicPane { JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Choose_Language")); generalPane.add(languageAndDashBoard_pane); languageAndDashBoard_pane.add(LanguagePane); - languageComboBox = new UIComboBox(LANGUAGE.toArray()); - languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 + + languageComboBox = createLanguageComboBox(); + ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Designer_Language")); languageLabel.addActionListener(new ActionListener() { @Override @@ -402,16 +382,26 @@ public class PreferencePane extends BasicPane { Component[][] components = { {languageLabel, languageComboBox, noticeLabel}, }; - languageComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - //Inter.fr = ResourceBundle.getBundle("com/fr/general/locale/fr", Locale.US); - } - }); JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); LanguagePane.add(choosePane); } + private UIDictionaryComboBox createLanguageComboBox() { + Map map = InterProviderFactory.getProvider().getSupportLocaleMap(); + int size = map.size(); + Locale[] keys = new Locale[size]; + String[] values = new String[size]; + int i = 0; + for (Map.Entry entry : map.entrySet()) { + keys[i] = entry.getKey(); + values[i] = com.fr.design.i18n.Toolkit.i18nText(entry.getValue()); + i++; + } + UIDictionaryComboBox languageComboBox = new UIDictionaryComboBox<>(keys, values); + languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 + return languageComboBox; + } + private String getDisplayShortCut(String shotrCut) { return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) @@ -506,7 +496,7 @@ public class PreferencePane extends BasicPane { JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplate")); UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_MaxCachingTemplate")); UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplateTip")); - memoryTipLabel.setBorder(BorderFactory.createEmptyBorder( 0, CACHING_GAP, 0, 0)); + memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); memorySpace.add(memoryLabel); @@ -564,8 +554,8 @@ public class PreferencePane extends BasicPane { this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); - this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); - designerEnvLanguageIndex = designerEnvManager.getLanguage(); + this.languageComboBox.setSelectedItem(designerEnvManager.getLanguage()); + this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); @@ -625,7 +615,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); - designerEnvManager.setLanguage(getLanguageInt()); + designerEnvManager.setLanguage(languageComboBox.getSelectedItem()); designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); @@ -637,7 +627,6 @@ public class PreferencePane extends BasicPane { designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); -// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected()); designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { @@ -648,21 +637,6 @@ public class PreferencePane extends BasicPane { } - /* - * 得到所选语言的int值 - */ - private int getLanguageInt() { - int l = 0; - String lang = (String) this.languageComboBox.getSelectedItem(); - for (int i = 0; i < LANGUAGE.size(); i++) { - if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) { - l = i; - break; - } - } - return l; - } - // 如果语言设置改变了,则显示重启对话框 public void showRestartDialog() { @@ -689,11 +663,7 @@ public class PreferencePane extends BasicPane { return showWindow(window, new DialogActionAdapter() { @Override public void doOk() { - if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) { - languageChanged = true; - } else { - languageChanged = false; - } + languageChanged = !ComparatorUtils.equals(languageComboBox.getSelectedItem(), DesignerEnvManager.getEnvManager(false).getLanguage()); } }); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 9b400f0522..564b6e6698 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -14,16 +14,15 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.utils.DesignUtils; +import com.fr.event.EventDispatcher; import com.fr.general.GeneralContext; - import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; -import javax.swing.JOptionPane; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Iterator; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index 1d98477c2b..46aa254500 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -10,8 +10,8 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.general.GeneralUtils; - import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; @@ -72,18 +72,18 @@ public class AboutPane extends JPanel { addPhoneAndQQPane(contentPane); // 官网 - JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); + JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); // 支持邮箱 String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL); - JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + FRContext.getLocale(), defaultEmail)); + JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail)); contentPane.add(urlActionPane); contentPane.add(emailPane); - if (FRContext.getLocale().equals(Locale.CHINA) || FRContext.getLocale().equals(Locale.TAIWAN)){ + if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) { contentPane.add(getRemarkPane()); - } + } if (shouldShowThanks()) { addThankPane(contentPane); @@ -93,13 +93,13 @@ public class AboutPane extends JPanel { private void addPhoneAndQQPane(JPanel contentPane) { BoxCenterAligmentPane boxCenterAlignmentPane; // 英文版不显示服务电话和QQ - if (FRContext.getLocale().equals(Locale.US)) { + if (GeneralContext.getLocale().equals(Locale.US)) { return; } boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); contentPane.add(boxCenterAlignmentPane); // 繁体版不显示QQ - if (FRContext.getLocale().equals(Locale.TAIWAN)) { + if (GeneralContext.getLocale().equals(Locale.TAIWAN)) { return; } boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + CloudCenter.getInstance().acquireUrlByKind("help.qq")); @@ -110,17 +110,17 @@ public class AboutPane extends JPanel { private boolean shouldShowThanks() { Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN}; for (Locale loc : hideLocales) { - if (FRContext.getLocale().equals(loc)) { + if (GeneralContext.getLocale().equals(loc)) { return false; } } return true; } - private JPanel getRemarkPane(){ - String remark = com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_About_Remark_Info",PRESIDENT_PHONE); + private JPanel getRemarkPane() { + String remark = com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_About_Remark_Info", PRESIDENT_PHONE); UILabel label = new UILabel(); - label.setSize(new Dimension(580,30)); + label.setSize(new Dimension(580, 30)); //用THML标签进行拼接,以实现自动换行 StringBuilder builder = new StringBuilder(""); @@ -139,12 +139,12 @@ public class AboutPane extends JPanel { break; } } - builder.append(chars, start, len-1).append("
"); + builder.append(chars, start, len - 1).append("
"); start = start + len - 1; len = 0; } //拼接剩余部分 - builder.append(chars, start, remark.length()-start); + builder.append(chars, start, remark.length() - start); builder.append(""); JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -184,7 +184,7 @@ public class AboutPane extends JPanel { StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX); } - private JPanel getEmailActionPane(final String desc, final String mailTo){ + private JPanel getEmailActionPane(final String desc, final String mailTo) { ActionLabel emailLabel = new ActionLabel(mailTo); emailLabel.addActionListener(new ActionListener() { @@ -204,7 +204,7 @@ public class AboutPane extends JPanel { return panel; } - private JPanel getURLActionPane(final String desc, final String url){ + private JPanel getURLActionPane(final String desc, final String url) { ActionLabel actionLabel = new ActionLabel(url); actionLabel.addActionListener(new ActionListener() { @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 4e3ea83202..c0e255af7b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -6,6 +6,7 @@ import com.fr.base.Utils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.general.http.HttpToolbox; import com.fr.stable.CommonUtils; import com.fr.stable.ProductConstants; @@ -78,7 +79,7 @@ public class TutorialAction extends UpdateAction { // 生成帮助文档 sitecenter key, help.zh_CN.10 protected String createDocKey() { - String locale = FRContext.getLocale().toString(); + String locale = GeneralContext.getLocale().toString(); return CommonUtils.join(new String[]{ "help", locale, ProductConstants.MAIN_VERSION }, "."); } diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java index d112f7fe01..24f1111f3b 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java @@ -6,9 +6,9 @@ package com.fr.design.editor.editor; import com.fr.base.FRContext; import com.fr.design.gui.date.UIDatePicker; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.GeneralContext; import javax.swing.*; - import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -60,9 +60,9 @@ public class DateEditor extends Editor { this.setLayout(FRGUIPaneFactory.createBorderLayout()); uiDatePicker = new UIDatePicker(); if (format) { - int dateStyle = (FRContext.getLocale() == Locale.ENGLISH - || FRContext.getLocale() == Locale.US - || FRContext.getLocale() == Locale.UK) ? uiDatePicker.STYLE_EN_DATE : uiDatePicker.STYLE_CN_DATE; + int dateStyle = (GeneralContext.getLocale() == Locale.ENGLISH + || GeneralContext.getLocale() == Locale.US + || GeneralContext.getLocale() == Locale.UK) ? uiDatePicker.STYLE_EN_DATE : uiDatePicker.STYLE_CN_DATE; uiDatePicker.setStyle(dateStyle); uiDatePicker.setEditable(false); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 0d5622d6e9..72ff977766 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -20,6 +20,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; import com.fr.parser.FRLexer; import com.fr.parser.FRParser; import com.fr.stable.EncodeConstants; @@ -774,7 +775,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { desBuf = getText((TextUserObject) selectedValue, path); } } catch (IOException exp) { - FRContext.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } descriptionTextArea.setText(desBuf.toString()); descriptionTextArea.moveCaretPosition(0); diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java b/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java index fe52fb1dc6..411d0c8a6f 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java @@ -1,6 +1,6 @@ package com.fr.design.formula; -import com.fr.base.FRContext; +import com.fr.general.GeneralContext; import com.fr.script.CalculatorEmbeddedFunction; import com.fr.stable.StringUtils; import com.fr.stable.script.Function; @@ -10,29 +10,29 @@ import java.util.Locale; public class FunctionNAD extends AbstractNameAndDescription { - private Function fn; - - FunctionNAD(Function fn) { - this.fn = fn; - } - - public String getName() { - return fn == null ? StringUtils.EMPTY : fn.getClass().getSimpleName(); - } - - public String getDesc() { - if (fn == null) { - return StringUtils.EMPTY; - } - Locale locale = FRContext.getLocale(); - String describtion = fn.getDescription(locale); - if (describtion.startsWith(CalculatorEmbeddedFunction.LOCALE_PREFIX)) { - // 老的自定义函数兼容, 没有重写getDescription - return Locale.CHINA.equals(locale) ? fn.getCN() : fn.getEN(); - } - - return describtion; - } + private Function fn; + + FunctionNAD(Function fn) { + this.fn = fn; + } + + public String getName() { + return fn == null ? StringUtils.EMPTY : fn.getClass().getSimpleName(); + } + + public String getDesc() { + if (fn == null) { + return StringUtils.EMPTY; + } + Locale locale = GeneralContext.getLocale(); + String describtion = fn.getDescription(locale); + if (describtion.startsWith(CalculatorEmbeddedFunction.LOCALE_PREFIX)) { + // 老的自定义函数兼容, 没有重写getDescription + return Locale.CHINA.equals(locale) ? fn.getCN() : fn.getEN(); + } + + return describtion; + } @Override public String searchResult(String keyWord, boolean findDescription) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index b569e054e1..69192af7f4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.DesignUtils; import com.fr.env.EnvListPane; +import com.fr.event.EventDispatcher; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; @@ -20,6 +21,7 @@ import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; +import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.connect.AuthException; import javax.swing.*; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index fcf8b7ddc1..ea6d694c70 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -50,7 +50,6 @@ import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -224,7 +223,7 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - if (FRContext.getLocale() == Locale.CHINA || FRContext.getLocale() == Locale.TAIWAN) { + if (GeneralContext.getLocale() == Locale.CHINA || GeneralContext.getLocale() == Locale.TAIWAN) { // 添加社区菜单 addCommunityMenuDef(menuList); } @@ -272,7 +271,7 @@ public abstract class ToolBarMenuDock { } public void addCommunityMenuDef(java.util.List menuList) { - Locale locale = FRContext.getLocale(); + Locale locale = GeneralContext.getLocale(); Locale[] locales = supportCommunityLocales(); for (int i = 0; i < locales.length; i++) { if (locale.equals(locales[i])) { @@ -451,7 +450,7 @@ public abstract class ToolBarMenuDock { java.util.List shortCuts = new ArrayList(); shortCuts.add(new WebDemoAction()); // 英文,把 video 和帮助文档放到 Help 下面 - if (FRContext.getLocale().equals(Locale.US)) { + if (GeneralContext.getLocale().equals(Locale.US)) { shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index b9f720e266..497dd07e03 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -226,7 +226,7 @@ public class DesignUtils { } //先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整. - Locale designerLocale = FRContext.getLocale(); + Locale designerLocale = GeneralContext.getLocale(); String file = com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"); char displayChar = file.charAt(0); if (!guiFRFont.canDisplay(displayChar)) { diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index 65a3e78df8..b7d123d66e 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -1,33 +1,20 @@ package com.fr.design; -import com.fr.locale.InterProviderFactory; import junit.framework.TestCase; -import java.util.HashSet; import java.util.Locale; public class DesignerEnvManagerTest extends TestCase{ public void testGetLocale() { DesignerEnvManager envManager = new DesignerEnvManager(); - assertEquals("默认值", envManager.getLocale(), Locale.CHINA); + assertEquals("默认值", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE); - HashSet result = new HashSet<>(); - Locale[] locales = envManager.supportLocale(); - int len = locales.length; - assertEquals(len, InterProviderFactory.getProvider().getSupportLocaleMap().size()); - for (int i = 0; i < len; i++) { - envManager.setLanguage(i + 1); - Locale locale = envManager.getLocale(); - result.add(locale); - } - assertEquals("每个int都有对应的locale", result.size(), len); + envManager.setLanguage(Locale.US); + assertEquals("上边界", envManager.getLanguage(), Locale.US); - envManager.setLanguage(998); - assertEquals("上边界", envManager.getLocale(), Locale.CHINA); - - envManager.setLanguage(-998); - assertEquals("下边界", envManager.getLocale(), Locale.CHINA); + envManager.setLanguage(Locale.SIMPLIFIED_CHINESE); + assertEquals("下边界", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE); } } diff --git a/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java b/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java index e538a637e3..7e4dad651a 100644 --- a/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java +++ b/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java @@ -13,20 +13,17 @@ public class TutorialActionTest extends TestCase{ TutorialAction action = new TutorialAction(); GeneralContext.setLocale(Locale.US); String enKey = action.createDocKey(); - assertTrue(enKey.indexOf(Locale.US.toString()) != -1); - assertTrue(enKey.indexOf(ProductConstants.MAIN_VERSION) != -1); + assertTrue(enKey.contains(Locale.US.toString())); + assertTrue(enKey.contains(ProductConstants.MAIN_VERSION)); GeneralContext.setLocale(Locale.CHINA); String zhKey = action.createDocKey(); - assertTrue(zhKey.indexOf(Locale.CHINA.toString()) != -1); + assertTrue(zhKey.contains(Locale.CHINA.toString())); Locale pt = new Locale("pt", "PT"); GeneralContext.setLocale(pt); String ptKey = action.createDocKey(); - assertTrue(ptKey.indexOf(pt.toString()) != -1); - - GeneralContext.setLanguage(998); - assertTrue(action.createDocKey().indexOf(Locale.CHINA.toString()) != -1); + assertTrue(ptKey.contains(pt.toString())); } public void testServerOnline() { diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index 5ffefb024e..c319af3413 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -1,6 +1,5 @@ package com.fr.start; -import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ibutton.UIButton; @@ -14,18 +13,12 @@ import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; - +import com.fr.general.GeneralContext; import com.fr.stable.OperatingSystem; -import javax.swing.BorderFactory; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.WindowConstants; +import javax.swing.*; import javax.swing.border.TitledBorder; -import java.awt.BorderLayout; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.Frame; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -147,7 +140,7 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { - Locale locale = FRContext.getLocale(); + Locale locale = GeneralContext.getLocale(); String url = EN_LOGIN_HTML; if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { url = TW_LOGIN_HTML; diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 18c7085a7c..ebdad4c287 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,11 +1,10 @@ package com.fr.start; -import com.fr.base.FRContext; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; - +import com.fr.general.GeneralContext; import com.fr.module.ModuleEvent; import com.fr.stable.StringUtils; @@ -135,7 +134,7 @@ public class SplashContext { private boolean shouldShowThanks() { Locale[] hideLocales = {Locale.CHINA, Locale.TAIWAN}; for (Locale loc : hideLocales) { - if (FRContext.getLocale().equals(loc)) { + if (GeneralContext.getLocale().equals(loc)) { return true; } } diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index 7797479900..1f7db56227 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -64,7 +64,7 @@ public class PreStartActivator extends Activator { private void initLanguage() { //这两句的位置不能随便调换,因为会影响语言切换的问题 - GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLocale()); + GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLanguage()); } @Override From c80dcdf0e7946ba7c4fd9c1bd46639988f1b2e99 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 31 Jul 2018 15:33:08 +0800 Subject: [PATCH 11/13] =?UTF-8?q?REPORT-10202=20=E6=B2=A1=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E7=9B=91=E5=90=AC=EF=BC=8C=E5=88=A0=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/SwitchExistEnv.java | 15 --------------- .../design/file/HistoryTemplateListPane.java | 2 -- .../com/fr/design/mainframe/TemplatePane.java | 18 ++++++++++++++---- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 9b400f0522..d32a1aa678 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -9,14 +9,10 @@ import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.utils.DesignUtils; -import com.fr.general.GeneralContext; - -import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; @@ -36,17 +32,6 @@ public class SwitchExistEnv extends MenuDef { this.setName(getMenuKeySet().getMenuName()); this.setHasScrollSubMenu(true); initMenuDef(); - JTemplate t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (t != null) { - GeneralContext.addEnvWillChangedListener( - t.getPath(), - new EnvChangedListener() { - public void envChanged() { - SwitchExistEnv.this.clearShortCuts(); - initMenuDef(); - } - }); - } } private void initMenuDef() { diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index 12dad2ea85..6d828ccafd 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -114,7 +114,6 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); - GeneralContext.removeEnvWillChangedListener(selected.getPath()); if (contains(selected) == -1) { return; } @@ -139,7 +138,6 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C public void closeVirtualSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); - GeneralContext.removeEnvWillChangedListener(selected.getPath()); if (contains(selected) == -1) { return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index b569e054e1..a7a466bdb5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -15,15 +15,26 @@ import com.fr.design.utils.DesignUtils; import com.fr.env.EnvListPane; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; - import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; @@ -132,7 +143,6 @@ public class TemplatePane extends JPanel implements MouseListener { final String selectedName = envListPane.updateEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName); - GeneralContext.fireEnvWillChangeListener(); try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); if (workspace == null) { From eca7394dbcbed217ce2ae7d10e59582d3452d95e Mon Sep 17 00:00:00 2001 From: hzzz Date: Tue, 31 Jul 2018 18:07:40 +0800 Subject: [PATCH 12/13] =?UTF-8?q?REPORT-9221=2010.0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9-=E7=89=88=E6=9C=AC=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/DesignState.java | 3 +- .../actions/AllowAuthorityEditAction.java | 82 ++++++++++++++++++- .../actions/ExitAuthorityEditAction.java | 5 +- .../design/gui/ibutton/UISliderButtonUI.java | 7 +- .../icontainer/UIEastResizableContainer.java | 3 +- .../icontainer/UIModeControlContainer.java | 9 +- .../gui/icontainer/UIResizableContainer.java | 5 +- .../fr/design/mainframe/DesignerFrame.java | 10 +-- .../DesignerFrameFileDealerPane.java | 15 ++-- .../com/fr/design/mainframe/JTemplate.java | 12 +-- .../fr/design/mainframe/UndoStateEdit.java | 5 +- .../mainframe/toolbar/ToolBarMenuDock.java | 1 + .../fr/design/mainframe/toolbar/VcsScene.java | 1 + .../roleAuthority/ReportAndFSManagePane.java | 3 +- .../fr/design/utils/gui/GUIPaintUtils.java | 9 +- .../fr/design/designer/creator/XCreator.java | 1 + .../com/fr/design/mainframe/FormDesigner.java | 1 + .../fr/design/mainframe/FormDesignerUI.java | 3 +- .../design/mainframe/FormToolBarButton.java | 3 +- .../java/com/fr/design/mainframe/JForm.java | 8 +- .../design/mainframe/ShareWidgetButton.java | 3 +- .../fr/design/mainframe/ToolBarButton.java | 3 +- .../design/mainframe/WidgetToolBarPane.java | 5 +- .../fr/design/mainframe/ElementCasePane.java | 9 +- .../mainframe/ElementCasePaneDelegate.java | 7 +- .../com/fr/design/mainframe/JWorkBook.java | 10 +-- .../fr/design/mainframe/ReportComponent.java | 3 +- .../mainframe/ReportComponentCardPane.java | 3 +- .../fr/design/mainframe/SheetNameTabPane.java | 3 +- .../form/FormElementCaseDesigner.java | 3 +- .../parameter/ParameterDefinitePane.java | 5 +- .../com/fr/design/webattr/ToolBarButton.java | 3 +- .../grid/AbstractGridHeaderMouseHandler.java | 5 +- .../main/java/com/fr/grid/GridColumnUI.java | 3 +- .../java/com/fr/grid/GridMouseAdapter.java | 13 +-- .../src/main/java/com/fr/grid/GridRowUI.java | 3 +- .../src/main/java/com/fr/grid/GridUI.java | 3 +- .../com/fr/grid/selection/CellSelection.java | 3 +- .../com/fr/grid/selection/FloatSelection.java | 3 +- .../java/com/fr/poly/PolyComponetsBar.java | 3 +- .../main/java/com/fr/poly/PolyDesigner.java | 7 +- .../fr/poly/actions/DeleteBlockAction.java | 3 +- .../com/fr/poly/creator/ChartBlockEditor.java | 7 +- .../com/fr/poly/creator/ECBlockEditor.java | 3 +- .../java/com/fr/poly/creator/ECBlockPane.java | 5 +- .../hanlder/BottomCornerMouseHanlder.java | 7 +- .../hanlder/ColumnOperationMouseHandler.java | 5 +- .../poly/hanlder/PolyDesignerDropTarget.java | 3 +- .../hanlder/RowOperationMouseHandler.java | 5 +- 49 files changed, 225 insertions(+), 99 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignState.java b/designer-base/src/main/java/com/fr/design/DesignState.java index fc7130aa26..fcc971b7e4 100644 --- a/designer-base/src/main/java/com/fr/design/DesignState.java +++ b/designer-base/src/main/java/com/fr/design/DesignState.java @@ -1,6 +1,7 @@ package com.fr.design; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.workspace.WorkContext; @@ -43,7 +44,7 @@ public class DesignState { // designState += REMOTE; // } // isRoot = env != null && env.isRoot(); - isAuthority = BaseUtils.isAuthorityEditing(); + isAuthority = DesignerMode.isAuthorityEditing(); } public int getDesignState() { diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 4d73692054..507632c72a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java @@ -1 +1,81 @@ -package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } } \ No newline at end of file +package com.fr.design.actions; + +import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; +import com.fr.design.constants.UIConstants; +import com.fr.design.menu.KeySetUtils; +import com.fr.design.roleAuthority.ReportAndFSManagePane; +import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.designer.TargetComponent; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.mainframe.*; + +/** + * Author : daisy + * Date: 13-8-30 + * Time: 上午10:12 + */ +public class AllowAuthorityEditAction extends TemplateComponentAction { + + public AllowAuthorityEditAction(TargetComponent t) { + super(t); + this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); + this.setName(getMenuKeySet().getMenuName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); + } + + /** + * 撤销 + */ + public void prepare4Undo() { + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); + } + + /** + * 执行动作 + * + * @return 是否执行成功 + */ + public boolean executeActionReturnUndoRecordNeeded() { + TargetComponent tc = getEditingComponent(); + if (tc == null) { + return false; + } + + cleanAuthorityCondition(); + + //进入时是格式刷则取消格式刷 + if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { + tc.cancelFormat(); + } + DesignerMode.setMode(DesignerMode.AUTHORITY); + ReportAndFSManagePane.getInstance().refreshDockingView(); + RolesAlreadyEditedPane.getInstance().refreshDockingView(); + WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); + DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); + DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); + DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); + EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); + DesignerContext.getDesignerFrame().refreshDottedLine(); + EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); + EastRegionContainerPane.getInstance().removeParameterPane(); + + //画虚线 + return true; + } + + + /** + * 进入权限编辑之前将权限编辑界面重置一下工具栏 + */ + private void cleanAuthorityCondition() { + + java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); + for (int i = 0; i < opendedTemplate.size(); i++) { + opendedTemplate.get(i).cleanAuthorityUndo(); + } + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index a90f7923ce..4d2b1d40a2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.DesignModelAdapter; import com.fr.design.designer.TargetComponent; @@ -33,8 +34,8 @@ public class ExitAuthorityEditAction extends TemplateComponentAction { return false; } - if (BaseUtils.isAuthorityEditing()) { - BaseUtils.setAuthorityEditing(false); + if (DesignerMode.isAuthorityEditing()) { + DesignerMode.setMode(DesignerMode.NORMARL); WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java index be6f570aca..6da878d8d7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java @@ -13,6 +13,7 @@ import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.View; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.stable.Constants; @@ -174,7 +175,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); @@ -187,7 +188,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); @@ -199,7 +200,7 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { Color oldColor = g2d.getColor(); - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); } else { g2d.setColor(UIConstants.POP_DIALOG_BORDER); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index 81b291f41d..1513eb6e95 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; @@ -281,7 +282,7 @@ public class UIEastResizableContainer extends JPanel { } onResize(); refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index 2492a6c360..51bdba9859 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -72,7 +73,7 @@ public class UIModeControlContainer extends JLayeredPane { public void needToShowCoverAndHidPane() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.remove(coverPane); this.remove(hidePane); } else { @@ -115,7 +116,7 @@ public class UIModeControlContainer extends JLayeredPane { if (isHideMode || !upEditMode) { return; } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); @@ -142,7 +143,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } boolean notUpEditMode = isHideMode || !upEditMode; @@ -183,7 +184,7 @@ public class UIModeControlContainer extends JLayeredPane { setUpPaneHeight(0); } - if (BaseUtils.isAuthorityEditing() && isSheeetCovered) { + if (DesignerMode.isAuthorityEditing() && isSheeetCovered) { sheetInvisibleCoverPane.setBounds(0, toolPaneY + toolPaneHeight + UIConstants.SIZE, getWidth(), getHeight() - toolPaneY - toolPaneHeight - sheetCorverGap); UIModeControlContainer.this.add(sheetInvisibleCoverPane); UIModeControlContainer.this.setLayer(sheetInvisibleCoverPane, 2); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java index 09d95f8434..73199d2ab2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; @@ -443,7 +444,7 @@ public class UIResizableContainer extends JPanel { containerWidth = toolPaneHeight; } refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } @@ -476,7 +477,7 @@ public class UIResizableContainer extends JPanel { containerWidth = toolPaneHeight; } refreshContainer(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } } 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 e2aaad44a4..81e1ccfe8a 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 @@ -306,7 +306,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void componentResized(ComponentEvent e) { reCalculateFrameSize(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { doResize(); } } @@ -529,7 +529,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void refreshDottedLine() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { populateAuthorityArea(); populateCloseButton(); addDottedLine(); @@ -592,7 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta for (int i = 0; i < fixButtons.length; i++) { combineUp.add(fixButtons[i]); } - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { combineUp.addSeparator(new Dimension(2, 16)); if (toolbar4Form != null) { for (int i = 0; i < toolbar4Form.length; i++) { @@ -709,13 +709,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void needToAddAuhtorityPaint() { - newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); + newWorkBookPane.setButtonGray(DesignerMode.isAuthorityEditing()); // 进入或退出权限编辑模式,通知插件 Set extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts(); for (ShortCut shortCut : extraShortCuts) { if (shortCut instanceof AbstractTemplateTreeShortCutProvider) { - ((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(BaseUtils.isAuthorityEditing()); + ((AbstractTemplateTreeShortCutProvider) shortCut).notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing()); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index c09e6e846f..55ba067c12 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -68,13 +69,11 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private CardLayout card; private JPanel cardPane; - private java.util.List otherToobarStateChangeListeners= new ArrayList<>(); - public FileOperations getSelectedOperation() { - return selectedOperation; - } + private java.util.List otherToobarStateChangeListeners = new ArrayList<>(); private FileOperations selectedOperation; + private UIToolbar toolBar; private OpenReportAction openReportAction = new OpenReportAction(); @@ -143,7 +142,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt HistoryTemplateListPane.getInstance().setCurrentEditingTemplate(jt); //处理自动新建的模板 MutilTempalteTabPane.getInstance().doWithtemTemplate(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } @@ -263,7 +262,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public void addToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) { this.otherToobarStateChangeListeners.add(toobarStateChangeListener); - } + } public void removeToobarStateChangeListener(FileToolbarStateChangeListener toobarStateChangeListener) { this.otherToobarStateChangeListeners.remove(toobarStateChangeListener); @@ -341,6 +340,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt delFileAction.setEnabled(true); } + otherStateChange(); } /** @@ -606,4 +606,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt return null; } + public FileOperations getSelectedOperation() { + return selectedOperation; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index d896c1364c..b9cc68da41 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -276,7 +276,7 @@ public abstract class JTemplate> * @return 是则返回true */ public boolean isSaved() { - return BaseUtils.isAuthorityEditing() ? this.authoritySaved : this.saved; + return DesignerMode.isAuthorityEditing() ? this.authoritySaved : this.saved; } /** @@ -299,7 +299,7 @@ public abstract class JTemplate> } public void setSaved(boolean isSaved) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { authoritySaved = isSaved; } else { saved = isSaved; @@ -310,7 +310,7 @@ public abstract class JTemplate> * @return */ public UndoManager getUndoManager() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (this.authorityUndoManager == null) { this.authorityUndoManager = new UndoManager(); int limit = DesignerEnvManager.getEnvManager().getUndoLimit(); @@ -385,7 +385,7 @@ public abstract class JTemplate> return; } //如果是在不同的模式下产生的 - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.getUndoManager().addEdit(new UndoStateEdit(authorityUndoState, newState)); authorityUndoState = newState; } else { @@ -414,7 +414,7 @@ public abstract class JTemplate> } private void fireSuperTargetModified() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.authoritySaved = false; } else { this.saved = false; @@ -720,7 +720,7 @@ public abstract class JTemplate> public MenuDef[] menus4Target() { MenuDef tplMenu = new MenuDef(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_M-Template"), 'T'); tplMenu.setAnchor(MenuHandler.TEMPLATE); - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_WorkBook"))); tplMenu.addShortCut(new TableDataSourceAction(this)); tplMenu.addShortCut(shortcut4TemplateMenu()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java b/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java index 60421dcad5..62cfb7fd09 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; @@ -52,7 +53,7 @@ public class UndoStateEdit extends AbstractUndoableEdit { if (this.old != null) { this.old.applyState(); } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } } @@ -67,7 +68,7 @@ public class UndoStateEdit extends AbstractUndoableEdit { if (this.cur != null) { this.cur.applyState(); } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 5b7d561abd..552b17e1fa 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -3,6 +3,7 @@ */ package com.fr.design.mainframe.toolbar; +import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java index d3e3631a6e..34fed3a86b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/VcsScene.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.toolbar; +import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.edit.RedoAction; import com.fr.design.actions.edit.UndoAction; diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 18ed104fe7..a26d01e45b 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1,6 +1,7 @@ package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; @@ -265,7 +266,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java index 94131a5ff8..30984197c0 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java @@ -1,6 +1,7 @@ package com.fr.design.utils.gui; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.stable.Constants; @@ -17,7 +18,7 @@ public class GUIPaintUtils { public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { Color oldColor = g2d.getColor(); Shape oldClip = g2d.getClip(); - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_LINE_COLOR); } else { g2d.setColor(UIConstants.POP_DIALOG_BORDER); @@ -67,7 +68,7 @@ public class GUIPaintUtils { public static final void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted, Color color) { GradientPaint gp; - if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, color, 1, height - 1, color); @@ -99,7 +100,7 @@ public class GUIPaintUtils { GradientPaint gp; if (hoverColor != null) { gp = new GradientPaint(1, 1, hoverColor, 1, height - 1, hoverColor); - } else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + } else if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { gp = new GradientPaint(1, 1, UIConstants.ATTRIBUTE_HOVER, 1, height - 1, UIConstants.ATTRIBUTE_HOVER); @@ -129,7 +130,7 @@ public class GUIPaintUtils { Color oldColor = g2d.getColor(); if (pressedColor != null) { g2d.setColor(pressedColor); - } else if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { + } else if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); } else { g2d.setColor(UIConstants.ATTRIBUTE_PRESS); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index d71f81387a..b7d7b3a45d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -3,6 +3,7 @@ */ package com.fr.design.designer.creator; +import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index abff9a9c88..56579a1a32 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 0f1ccf33ce..be1980d24d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -5,6 +5,7 @@ import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.base.Utils; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; @@ -84,7 +85,7 @@ public class FormDesignerUI extends ComponentUI { paintSelection(g); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { paintAuthorityDetails(g, designer.getRootComponent()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java b/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java index 211c3ef3dd..b28d5c253c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormToolBarButton.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; @@ -102,7 +103,7 @@ public class FormToolBarButton extends JButton implements MouseListener { //该button只在报表块工具栏中使用, //parent只有FormToolBarPane一种,故可以直接强转 final FormToolBarPane toolBarPane = (FormToolBarPane) this.getParent(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { auhtorityMouseAction(); return; } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index e5fdfc9a51..3165d08c5f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -342,7 +342,7 @@ public class JForm extends JTemplate implements BaseJForm { } ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this); editingComponent = comp.createToolPane(this, formDesign); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane()); } else { @@ -580,7 +580,7 @@ public class JForm extends JTemplate implements BaseJForm { throw new RuntimeException(e); } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { this.authorityUndoState = u; } else { this.undoState = u; @@ -655,7 +655,7 @@ public class JForm extends JTemplate implements BaseJForm { public JPanel getEastUpPane() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (formDesign.isSupportAuthority()) { return new AuthorityPropertyPane(this); } else { @@ -719,7 +719,7 @@ public class JForm extends JTemplate implements BaseJForm { DesignerContext.getDesignerFrame().resetToolkitByPlus(JForm.this); //表单切换后拖不进去组件是因为找不到designer WidgetToolBarPane.getInstance(formDesign); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (formDesign.isSupportAuthority()) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new AuthorityPropertyPane(this)); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java index cbca8c4f82..a79ac17a5c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ShareWidgetButton.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.SharableAttrMark; +import com.fr.base.vcs.DesignerMode; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; @@ -199,7 +200,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot @Override public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } if (lastPressEvent == null) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java index b152f6f4b3..baf69fa878 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.core.WidgetOption; import com.fr.design.designer.creator.XCreatorUtils; @@ -70,7 +71,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio @Override public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } if (lastPressEvent == null) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java index c6dfdd9ed2..bde1367c47 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetToolBarPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.core.FormWidgetOption; @@ -122,7 +123,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide private void checkEnable() { for (JComponent comp : componentsList4Form) { - comp.setEnabled(!BaseUtils.isAuthorityEditing()); + comp.setEnabled(!DesignerMode.isAuthorityEditing()); } } @@ -149,7 +150,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide chartButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } if (chartWindow == null) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index e0efed6499..b5f78ef604 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -10,6 +10,7 @@ import com.fr.base.FRContext; import com.fr.base.Formula; import com.fr.base.ScreenResolution; import com.fr.base.Style; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -756,7 +757,7 @@ public abstract class ElementCasePane extends Tar * @return 返回是否清除内容. */ public boolean clearContents() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return false; } boolean b = this.selection.clear(Clear.CONTENTS, this); @@ -1043,7 +1044,7 @@ public abstract class ElementCasePane extends Tar */ public UIPopupMenu createRowPopupMenu(MouseEvent evt, int selectedRows) { UIPopupMenu popupMenu = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popupMenu.add(new CleanAuthorityAction(this).createMenuItem()); return popupMenu; } @@ -1136,7 +1137,7 @@ public abstract class ElementCasePane extends Tar public UIPopupMenu createColumnPopupMenu(MouseEvent evt, int selectedColumn) { UIPopupMenu popupMenu = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popupMenu.add(new CleanAuthorityAction(this).createMenuItem()); return popupMenu; } @@ -1237,7 +1238,7 @@ public abstract class ElementCasePane extends Tar public ShortCut[] shortCuts4Authority() { return new ShortCut[]{ new NameSeparator(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"DashBoard-Potence", "Edit"})), - BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), + DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), }; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java index a1902d6fb9..543268ea28 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.CellAttributeAction; @@ -51,7 +52,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { this.addSelectionChangeListener(new SelectionListener() { @Override public void selectionChanged(SelectionEvent e) { - if (!isEditable() && !BaseUtils.isAuthorityEditing()) { + if (!isEditable() && !DesignerMode.isAuthorityEditing()) { return; } refreshPropertyPanes(); @@ -71,7 +72,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { private void refreshPropertyPanes() { //在编辑权限,所以要更新权限编辑面板 - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this); authorityPropertyPane.populate(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); @@ -124,7 +125,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { * @return 返回MenuDef数组. */ public MenuDef[] menus4Target() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return super.menus4Target(); } return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()}); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index b85ecedd7a..a300b835ed 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -286,7 +286,7 @@ public class JWorkBook extends JTemplate { if (this.getEditingElementCasePane() == null) { return JWorkBook.this; } - this.getEditingElementCasePane().getGrid().setEditable(!BaseUtils.isAuthorityEditing()); + this.getEditingElementCasePane().getGrid().setEditable(!DesignerMode.isAuthorityEditing()); centerPane.needToShowCoverAndHidPane(); if (centerPane.isUpEditMode()) { return parameterPane; @@ -317,7 +317,7 @@ public class JWorkBook extends JTemplate { @Override public JPanel getEastUpPane() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return allowAuthorityUpPane(); } else { return exitEastUpPane(); @@ -682,7 +682,7 @@ public class JWorkBook extends JTemplate { public ShortCut[] shortCuts4Authority() { return new ShortCut[]{ new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Permissions_Edition")), - BaseUtils.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), + DesignerMode.isAuthorityEditing() ? new ExitAuthorityEditAction(this) : new AllowAuthorityEditAction(this), }; } @@ -728,7 +728,7 @@ public class JWorkBook extends JTemplate { protected void applyUndoState(WorkBookUndoState u) { try { this.setTarget((WorkBook) u.getWorkBook().clone()); - if (!BaseUtils.isAuthorityEditing()) { + if (!DesignerMode.isAuthorityEditing()) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { applyAll(u); this.undoState = u; @@ -993,7 +993,7 @@ public class JWorkBook extends JTemplate { } } } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(allowAuthorityUpPane()); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java index 775bfae173..ea74cc7b3b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponent.java @@ -4,6 +4,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.report.ReportBackgroundAction; @@ -68,7 +69,7 @@ public abstract class ReportComponent= 2 && !BaseUtils.isAuthorityEditing()) { + if (clickCount >= 2 && !DesignerMode.isAuthorityEditing()) { grid.startEditing(); } - if (clickCount == 1 && cellElement != null && cellElement.getWidget() != null && !BaseUtils.isAuthorityEditing()) { + if (clickCount == 1 && cellElement != null && cellElement.getWidget() != null && !DesignerMode.isAuthorityEditing()) { showWidetWindow(cellElement, report); } reportPane.repaint(); @@ -362,12 +363,12 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous } Selection selection = reportPane.getSelection(); - if (selection instanceof FloatSelection && !BaseUtils.isAuthorityEditing()) { + if (selection instanceof FloatSelection && !DesignerMode.isAuthorityEditing()) { doWithFloatElementDragged(evtX, evtY, (FloatSelection) selection); grid.setDragType(GridUtils.DRAG_FLOAT); - } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !BaseUtils.isAuthorityEditing()) { + } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION_BOTTOMRIGHT_CORNER && !DesignerMode.isAuthorityEditing()) { doWithCellElementDragged(evtX, evtY, (CellSelection) selection); - } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) { + } else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !DesignerMode.isAuthorityEditing()) { // peter:获得调整过的Selected Column Row. ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) { diff --git a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java index 303752e71c..44f1fe8749 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridRowUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridRowUI.java @@ -12,6 +12,7 @@ import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.design.constants.UIConstants; import com.fr.design.mainframe.ElementCasePane; @@ -137,7 +138,7 @@ public class GridRowUI extends ComponentUI { } private void drawAuthority(ElementCase elementCase, Graphics2D g2d, double tmpHeight1, double tmpIncreaseHeight, Dimension size, int i) { - boolean isAuthorityEdited = BaseUtils.isAuthorityEditing(); + boolean isAuthorityEdited = DesignerMode.isAuthorityEditing(); if (isAuthorityEdited) { ColumnRowPrivilegeControl cpc = elementCase.getRowPrivilegeControl(i); String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 45d8143c8d..f64fa08643 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -11,6 +11,7 @@ import com.fr.base.Utils; import com.fr.base.background.ColorBackground; import com.fr.base.background.ImageFileBackground; import com.fr.base.iofile.attr.WatermarkAttr; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; @@ -1060,7 +1061,7 @@ public class GridUI extends ComponentUI { throw new IllegalArgumentException("The component c to paint must be a Grid!"); } - isAuthority = BaseUtils.isAuthorityEditing(); + isAuthority = DesignerMode.isAuthorityEditing(); Graphics2D g2d = (Graphics2D) g; diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 3bbf8e952b..cff3f5ddcb 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -4,6 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.base.BaseUtils; import com.fr.base.NameStyle; import com.fr.base.Utils; +import com.fr.base.vcs.DesignerMode; import com.fr.cache.list.IntList; import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; @@ -463,7 +464,7 @@ public class CellSelection extends Selection { */ public UIPopupMenu createPopupMenu(ElementCasePane ePane) { UIPopupMenu popup = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popup.add(new CleanAuthorityAction(ePane).createMenuItem()); return popup; } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java index eaad78306d..da6f1d45a1 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java @@ -2,6 +2,7 @@ package com.fr.grid.selection; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.core.ActionFactory; @@ -125,7 +126,7 @@ public class FloatSelection extends Selection { @Override public JPopupMenu createPopupMenu(ElementCasePane ePane) { UIPopupMenu popup = new UIPopupMenu(); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { popup.add(new CleanAuthorityAction(ePane).createMenuItem()); return popup; } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java index ef48594d05..3a7fc58b36 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponetsBar.java @@ -5,6 +5,7 @@ import com.fr.base.FRContext; import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartNameID; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itooltip.MultiLineToolTip; @@ -53,7 +54,7 @@ public class PolyComponetsBar extends JToolBar { */ public void checkEnable() { for (SerIcon serIcon : serIcons) { - serIcon.setEnabled(!BaseUtils.isAuthorityEditing()); + serIcon.setEnabled(!DesignerMode.isAuthorityEditing()); } } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java index eefff3e1ec..2307765e33 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyDesigner.java @@ -7,6 +7,7 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -355,7 +356,7 @@ public class PolyDesigner extends ReportComponent { */ public void resetSelectionAndChooseState() { designer.setChooseType(SelectionType.INNER); - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jTemplate.isJWorkBook()) { //清参数面板 diff --git a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java index 1d211189a4..0f3c489c5b 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java @@ -4,6 +4,7 @@ package com.fr.poly.creator; import com.fr.base.BaseUtils; +import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.edit.HyperlinkAction; import com.fr.design.menu.KeySetUtils; @@ -55,7 +56,7 @@ public class ECBlockPane extends PolyElementCasePane { if (!isEditable()) { return; } - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { if (designer.getSelection().getEditingElementCasePane() == null) { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION_DISABLED); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(new NoSupportAuthorityEdit()); @@ -106,7 +107,7 @@ public class ECBlockPane extends PolyElementCasePane { * @return 返回MenuDef数组. */ public MenuDef[] menus4Target() { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return super.menus4Target(); } return (MenuDef[]) ArrayUtils.addAll(super.menus4Target(), new MenuDef[]{createInsertMenuDef(), createCellMenuDef()}); diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java b/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java index b55916e777..0985667eb6 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/BottomCornerMouseHanlder.java @@ -11,6 +11,7 @@ import javax.swing.event.MouseInputAdapter; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.design.beans.location.Absorptionline; import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils.RectangleDesigner; @@ -49,7 +50,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { * */ public void mousePressed(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } pressed = e.getPoint(); @@ -66,7 +67,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { * */ public void mouseReleased(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } editor.setDragging(false); @@ -92,7 +93,7 @@ public class BottomCornerMouseHanlder extends MouseInputAdapter { * */ public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); return; } diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java b/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java index 39b4c13213..6704e06289 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/ColumnOperationMouseHandler.java @@ -8,6 +8,7 @@ import java.awt.event.MouseEvent; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.general.ComparatorUtils; import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner.SelectionType; @@ -57,7 +58,7 @@ public abstract class ColumnOperationMouseHandler extends * */ public void mousePressed(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } startPoint = e.getPoint(); @@ -74,7 +75,7 @@ public abstract class ColumnOperationMouseHandler extends * */ public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } TemplateBlock block = editor.getValue(); diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java b/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java index bc105c684e..7317e3ecd9 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/PolyDesignerDropTarget.java @@ -19,6 +19,7 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.ScreenResolution; import com.fr.base.chart.BaseChart; +import com.fr.base.vcs.DesignerMode; import com.fr.design.mainframe.DesignerContext; import com.fr.grid.Grid; import com.fr.poly.PolyDesigner; @@ -55,7 +56,7 @@ public class PolyDesignerDropTarget extends DropTargetAdapter { */ public void dragEnter(DropTargetDragEvent dtde) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } // richer:避免在一次拖拽过程中重复查找 diff --git a/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java b/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java index eeef42e626..96c8bf5194 100644 --- a/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/poly/hanlder/RowOperationMouseHandler.java @@ -8,6 +8,7 @@ import java.awt.event.MouseEvent; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; +import com.fr.base.vcs.DesignerMode; import com.fr.general.ComparatorUtils; import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner.SelectionType; @@ -55,7 +56,7 @@ public abstract class RowOperationMouseHandler extends Bl * */ public void mousePressed(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { designer.noAuthorityEdit(); } startPoint = e.getPoint(); @@ -72,7 +73,7 @@ public abstract class RowOperationMouseHandler extends Bl * */ public void mouseDragged(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { + if (DesignerMode.isAuthorityEditing()) { return; } TemplateBlock block = editor.getValue(); From 588f9ed08b4448537b72b6a6a2b7df356287a10a Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 31 Jul 2018 18:42:04 +0800 Subject: [PATCH 13/13] =?UTF-8?q?REPORT-10160=2010.0=E5=86=92=E7=83=9F=20M?= =?UTF-8?q?ac=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8,=20=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E7=B3=8A=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 5 +++++ .../src/main/java/com/fr/start/jni/SplashMac.java | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index e4c119f7d5..29e84d031a 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -150,6 +150,11 @@ public class Designer extends BaseDesigner { private static SplashStrategy createSplash() { // 这里可以开接口加载自定义启动画面 + if (OperatingSystem.isWindows()) { + return new SplashFx(); + } else if (OperatingSystem.isMacOS()) { + return new SplashMac(); + } return new SplashFx(); } diff --git a/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java b/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java index f4e900aecb..964cf17a41 100644 --- a/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java +++ b/designer-realize/src/main/java/com/fr/start/jni/SplashMac.java @@ -7,6 +7,7 @@ import com.fr.stable.StringUtils; import com.fr.start.SplashContext; import com.fr.start.SplashStrategy; +import javax.swing.*; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -24,6 +25,7 @@ public class SplashMac implements SplashStrategy { private SplashJNI jni; + private static final int EXILE = 10000; public SplashMac() { jni = new SplashJNI(); @@ -62,6 +64,11 @@ public class SplashMac implements SplashStrategy { @Override public void show() { if (jni != null) { + // mac下安装版模糊的hack + JFrame jFrame = new JFrame(); + jFrame.setLocation(EXILE, EXILE); + jFrame.setVisible(true); + jFrame.setVisible(false); File splash = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SplashContext.SPLASH_CACHE_NAME)); String path = splash.exists() ? splash.getAbsolutePath() : loadResFromJar(); jni.show(path);