From 6c1067c19b37802d72c66d7b6321c61ab3db7791 Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 18 Jul 2018 17:16:31 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-9565=20=E9=83=A8=E7=BD=B2=E9=9B=86?= =?UTF-8?q?=E6=88=90-=E8=BF=9C=E7=A8=8B-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E4=B8=8A=E6=96=B9=E8=B7=AF=E5=BE=84=E6=98=BE=E7=A4=BA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 487 +++++++++--------- 1 file changed, 252 insertions(+), 235 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 3636a18da..893f5a9ae 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 @@ -51,14 +51,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 com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; +import com.fr.workspace.connect.WorkspaceConnection; -import javax.swing.*; +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; @@ -83,74 +99,74 @@ import java.util.Iterator; import java.util.List; 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 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; - + // 左边的虚线 private DottedLine leftDottedLine; - + // 右边的虚线 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) { - + } - + @Override public void windowClosing(WindowEvent e) { - + SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); // 只有一个文件未保存时 if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) { @@ -164,83 +180,83 @@ 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); + 0, 360); closeMode.paintIcon(this, g, 0, 0); } }; - + private MouseListener closeMouseListener = new MouseAdapter() { - + public void mousePressed(MouseEvent e) { - + closeMode = UIConstants.CLOSE_PRESS_AUTHORITY; closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); closeButton.repaint(); } - + public void mouseExited(MouseEvent e) { - + closeMode = UIConstants.CLOSE_OF_AUTHORITY; closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); closeButton.repaint(); } - + public void mouseMoved(MouseEvent e) { - + closeMode = UIConstants.CLOSE_OVER_AUTHORITY; closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); closeButton.repaint(); } - + public void mouseReleased(MouseEvent e) { - + if (BaseUtils.isAuthorityEditing()) { BaseUtils.setAuthorityEditing(false); WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); needToAddAuhtorityPaint(); refreshDottedLine(); fireAuthorityStateToNomal(); } } - + 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); this.ad = ad; this.initTitleIcon(); this.setTitle();// james:因为有默认的了 // set this to context. DesignerContext.setDesignerFrame(this); - + // the content pane basePane.setLayout(new BorderLayout()); toolbarPane = new JPanel() { - + public Dimension getPreferredSize() { - + Dimension dim = super.getPreferredSize(); // dim.height = TOOLBAR_HEIGHT; return dim; @@ -255,37 +271,37 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST); panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); eastCenterPane.add(panel, BorderLayout.CENTER); - + eastPane.add(eastCenterPane, BorderLayout.CENTER); toolbarPane.add(eastPane, BorderLayout.NORTH); toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); centerPane.add(toolbarPane, BorderLayout.NORTH); - - + + basePane.add(centerPane, BorderLayout.CENTER); laoyoutWestPane(); basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); basePane.setBounds(0, 0, contentWidth, contentHeight); - + // 数值越小。越在底层 layeredPane.add(basePane); // 调整Window大小 modWindowBounds(); - - + + // p:检查所有按钮的可见性和是否可以编辑性. checkToolbarMenuEnable(); - + // window close listener. this.addWindowListeners(getFrameListeners()); - + this.addComponentListener(new ComponentAdapter() { - + public void componentResized(ComponentEvent e) { - + reCalculateFrameSize(); if (BaseUtils.isAuthorityEditing()) { doResize(); @@ -293,10 +309,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } }); this.addDesignerOpenedListener(new DesignerOpenedListener() { - + @Override public void designerOpened() { - + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); reCalculateFrameSize(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); @@ -310,61 +326,61 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta initMenuPane(); this.progressDialog = new ProgressDialog(this); } - + /** * 注册app. * * @param app 注册app. */ public static void registApp(App app) { - + if (app != null) { appList.add(app); } } - + public static void removeApp(App app) { - + if (app != null) { appList.remove(app); } } - + /** * 注册"设计器初始化完成"的监听 */ public void addDesignerOpenedListener(DesignerOpenedListener listener) { - + designerOpenedListenerList.add(listener); } - + /** * 触发"设计器初始化完成"事件 */ public void fireDesignerOpened() { - + for (DesignerOpenedListener listener : designerOpenedListenerList) { listener.designerOpened(); } } - + protected DesktopCardPane getCenterTemplateCardPane() { - + return centerTemplateCardPane; } - + /** * 初始menuPane的方法 方便OEM时修改该组件 */ protected void initMenuPane() { - + menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); basePane.add(menuPane, BorderLayout.NORTH); this.resetToolkitByPlus(null); } - + /** * @param ad * @return @@ -393,9 +409,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta refreshNorthEastPane(northEastPane, ad); return northEastPane; } - + private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { - + northEastPane.removeAll(); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.add(LogMessageBar.getInstance()); @@ -409,43 +425,43 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } northEastPane.add(ad.createBBSLoginPane()); } - + public void initTitleIcon() { - + try { @SuppressWarnings("unchecked") List image = ICODecoder.read(DesignerFrame.class - .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); this.setIconImages(image); } catch (IOException 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; } - - + + protected void laoyoutWestPane() { - + basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST); } - + // 调整windows大小 private void reCalculateFrameSize() { - + contentHeight = layeredPane.getHeight(); contentWidth = layeredPane.getWidth(); layeredPane.remove(basePane); @@ -453,63 +469,63 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta layeredPane.add(basePane); layeredPane.repaint(); } - + /** * 更新 */ public void populateAuthorityArea() { - + int centerWidth = contentWidth - WestRegionContainerPane.getInstance().getContainerWidth() - - EastRegionContainerPane.getInstance().getContainerWidth(); + - EastRegionContainerPane.getInstance().getContainerWidth(); // 上面的虚线 upDottedLine = new DottedLine(UIScrollBar.HORIZONTAL, centerWidth); upDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), MENU_HEIGHT - 1, centerWidth, - 3); - + 3); + // 下面的虚线 downDottedLine = new DottedLine(UIScrollBar.HORIZONTAL, centerWidth); downDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), contentHeight - 3, centerWidth, 3); - + // 左边的虚线 leftDottedLine = new DottedLine(UIScrollBar.VERTICAL, contentHeight - MENU_HEIGHT); leftDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), MENU_HEIGHT, 3, contentHeight - MENU_HEIGHT); - + rightDottedLine = new DottedLine(UIScrollBar.VERTICAL, contentHeight - MENU_HEIGHT); rightDottedLine.setBounds(contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - 3, MENU_HEIGHT, 3, contentHeight - MENU_HEIGHT); - + } - + private void addDottedLine() { - + layeredPane.add(upDottedLine, SECOND_LAYER); layeredPane.add(downDottedLine, SECOND_LAYER); layeredPane.add(leftDottedLine, SECOND_LAYER); layeredPane.add(rightDottedLine, SECOND_LAYER); layeredPane.add(closeButton, TOP_LAYER); } - + private void removeDottedLine() { - + layeredPane.remove(upDottedLine); layeredPane.remove(downDottedLine); layeredPane.remove(leftDottedLine); layeredPane.remove(rightDottedLine); layeredPane.remove(closeButton); } - + public JLayeredPane getContentFrame() { - + return layeredPane; } - + /** * 刷新 */ public void refreshDottedLine() { - + if (BaseUtils.isAuthorityEditing()) { populateAuthorityArea(); populateCloseButton(); @@ -519,37 +535,37 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } layeredPane.repaint(); } - + /** * 刷新DottedLine */ public void doResize() { - + removeDottedLine(); populateAuthorityArea(); populateCloseButton(); addDottedLine(); } - + /** * 刷新CloseButton */ public void populateCloseButton() { - + closeButton.addMouseListener(closeMouseListener); closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); closeButton.setBorder(null); int x = contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - closeMode.getIconWidth() / 2; int y = MENU_HEIGHT - closeMode.getIconHeight() / 2; closeButton.setBounds(x, y, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, - UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH); + UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH); } - + /** * 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体 */ private void fireAuthorityStateToNomal() { - + java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 @@ -558,14 +574,14 @@ 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)); @@ -581,24 +597,24 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } } - + //添加分享按钮 addShareButton(); - + //添加插件中的按钮 addExtraButtons(); - + return combineUp; } - + private void addExtraButtons() { - + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; } - - + + UIButton[] extraButtons = jt.createExtraButtons(); for (int i = 0; i < extraButtons.length; i++) { combineUp.add(extraButtons[i]); @@ -607,21 +623,21 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta combineUp.addSeparator(new Dimension(2, 16)); } } - + private void addShareButton() { - + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; } - + combineUp.addSeparator(new Dimension(2, 16)); UIButton[] shareButtons = jt.createShareButton(); for (int i = 0; i < shareButtons.length; i++) { combineUp.add(shareButtons[i]); } } - + /** * 检查 * @@ -629,86 +645,86 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param al 组件名称 */ public void checkCombineUp(boolean flag, ArrayList al) { - + combineUp.checkComponentsByNames(flag, al); - + } - + /** * 刷新工具条. */ public void refreshToolbar() { - + this.ad.updateToolBarDef(); } - + /** * 重置相关的工具条. * * @param plus 工具条中相关信息 */ public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { - + if (plus == null) { plus = ToolBarMenuDock.NULLAVOID; } - + DesignState designState = new DesignState(plus); MenuManager.getInstance().setMenus4Designer(designState); if (menuBar != null) { menuPane.remove(menuBar); } menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); - + if (combineUp != null) { eastCenterPane.remove(combineUp); combineUp = null; } - + // 保存撤销那些按钮的面板 eastCenterPane.add(combineUp = combineUpTooBar(ad.resetUpToolBar(plus)), BorderLayout.NORTH); - + if (toolbarComponent != null) { toolbarPane.remove(toolbarComponent); } - + // 颜色,字体那些按钮的工具栏 toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); - + this.checkToolbarMenuEnable(); this.validate(); layeredPane.repaint(); } - + public JComponent getToolbarComponent() { - + return this.toolbarComponent; } - + /** * 判断是否在权限编辑状态,若是在权限编辑状态,则需要有虚线框和关闭突变 */ public void needToAddAuhtorityPaint() { - + newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); } - + /** * 检查工具条. */ private void checkToolbarMenuEnable() { - + if (this.ad != null) { this.ad.updateMenuDef(); this.ad.updateToolBarDef(); } } - + /** * 设置标题 */ public void setTitle() { - + JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); defaultTitleSB.append(ProductConstants.PRODUCT_NAME); @@ -721,8 +737,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); String username = null; - if (info != null){ - username = info.getName(); + 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) { @@ -734,10 +751,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } defaultTitleSB.append(" " + path); } - + setTitle(defaultTitleSB.toString()); } - + /** * modify window bounds. */ @@ -748,14 +765,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (windowBounds != null) { int locX = windowBounds.x; int locY = windowBounds.y; - + if (!OperatingSystem.isWindows()) { locX = Math.max(1, locX); locY = Math.max(1, locY); } - + this.setLocation(new Point(locX, locY)); - + int width = windowBounds.width; int height = windowBounds.height; if (width > MIN_SIZE.width && height > MIN_SIZE.height) { @@ -767,13 +784,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta GUICoreUtils.setWindowFullScreen(this); } } - - + + /** * 报表运行环境改变时,需要刷新某些面板 */ public void refreshEnv() { - + this.setTitle(); DesignerFrameFileDealerPane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); @@ -781,21 +798,21 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta DesignTableDataManager.clearGlobalDs(); EastRegionContainerPane.getInstance().refreshDownPane(); } - + /** * 返回选中的模板. */ public JTemplate getSelectedJTemplate() { - + return this.centerTemplateCardPane.getSelectedJTemplate(); } - + /** * 保存当前编辑的模板 */ - + public void saveCurrentEditingTemplate() { - + JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (editingTemplate == null) { return; @@ -808,33 +825,33 @@ 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() - + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); + 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(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ - editingTemplate.getEditingFILE().getName(), "."})); + editingTemplate.getEditingFILE().getName(), "."})); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ - editingTemplate.getEditingFILE().getName(), "."})); + editingTemplate.getEditingFILE().getName(), "."})); } } } } - + /** * 添加新建模板, 并激活. */ public void addAndActivateJTemplate() { - + addAndActivateJTemplate(ad.createNewTemplate()); layeredPane.repaint(); } - + /** * 添加 模板, 并激活. * @@ -852,7 +869,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta setTitle(); layeredPane.repaint(); } - + /** * 激活已经存在的模板 * @@ -868,45 +885,45 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta setTitle(); layeredPane.repaint(); } - + /** * 对象侦听 * * @param e 事件 */ public void targetModified(TargetModifiedEvent e) { - + this.checkToolbarMenuEnable(); } - + /** * 模板关闭时 处理. * * @param jt 模板 */ public void templateClosed(JTemplate jt) { - + } - + /** * 模板打开时 处理. * * @param jt 模板 */ public void templateOpened(JTemplate jt) { - + } - + /** * 模板保存时 处理. * * @param jt 模板 */ public void templateSaved(JTemplate jt) { - + this.checkToolbarMenuEnable(); } - + /** * 打开模板文件,如果是已经打开的就激活此模板所对应的JInternalFrame * @@ -926,24 +943,24 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // } catch (Exception e) { // FineLoggerFactory.getLogger().error(e.getMessage()); // } - + // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); + ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); DesignerFrameFileDealerPane.getInstance().refresh(); return; } - + try { openFile(tplFile); } catch (Throwable t) { FineLoggerFactory.getLogger().error(t.getMessage(), t); addAndActivateJTemplate(); } - + } - + /** * 是否不合版本的设计器 * @@ -952,10 +969,10 @@ 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()); } - + /** * 打开指定的文件 * @@ -963,7 +980,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) { @@ -978,7 +995,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { // 不要catch JTemplate jt = app.openTemplate(tplFile); - + if (jt == null) { return; } @@ -986,7 +1003,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (inValidDesigner(jt)) { this.addAndActivateJTemplate(); MutilTempalteTabPane.getInstance().setTemTemplate( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } else { activeTemplate(tplFile, jt); } @@ -999,7 +1016,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } } - + /** * 激活指定的模板 * @@ -1026,88 +1043,88 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.addAndActivateJTemplate(jt); } } - + /** * Exit退出 */ public void exit() { - + Thread thread = new Thread() { - + @Override public void run() { - + DesignerEnvManager.doEndMapSaveWorkersIndesign(); } }; thread.start(); - + try { thread.join(); } catch (InterruptedException e) { FineLoggerFactory.getLogger().error("Map Thread Error"); } - + DesignerEnvManager.getEnvManager().setLastOpenFile( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); - + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); + DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY( - WestRegionContainerPane.getInstance().getToolPaneY()); + WestRegionContainerPane.getInstance().getToolPaneY()); DesignerEnvManager.getEnvManager().setLastWestRegionContainerWidth( - WestRegionContainerPane.getInstance().getContainerWidth()); + WestRegionContainerPane.getInstance().getContainerWidth()); DesignerEnvManager.getEnvManager().setLastEastRegionToolPaneY( - EastRegionContainerPane.getInstance().getToolPaneY()); + EastRegionContainerPane.getInstance().getToolPaneY()); DesignerEnvManager.getEnvManager().setLastEastRegionContainerWidth( - EastRegionContainerPane.getInstance().getContainerWidth()); - + EastRegionContainerPane.getInstance().getContainerWidth()); + DesignerEnvManager.getEnvManager().saveXMLFile(); - + WorkContext.switchTo(null); - + this.setVisible(false); this.dispose(); - + this.ad.shutDown(); - + System.exit(0); } - + // harry:添加程序外拖拽文件进来打开的功能 class FileDropTargetListener implements DropTargetListener { - + @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; } } - + @SuppressWarnings("unchecked") @Override public void drop(DropTargetDropEvent event) { - + if (!isDropAcceptable(event)) { event.rejectDrop(); return; } - + event.acceptDrop(DnDConstants.ACTION_MOVE); Transferable transferable = event.getTransferable(); DataFlavor[] flavors = transferable.getTransferDataFlavors(); @@ -1128,20 +1145,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } 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 b2be93d90d5c1bdce806c22028efce616f20f7a2 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 19 Jul 2018 11:20:34 +0800 Subject: [PATCH 2/6] . --- .../com/fr/design/mainframe/socketio/DesignerSocketIO.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index a8d328e16..af9667919 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.socketio; import com.fr.config.RemoteConfigEvent; import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.TemplatePane; import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.event.EventDispatcher; import com.fr.general.Inter; @@ -14,6 +15,7 @@ import com.fr.third.guava.base.Optional; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; +import com.fr.workspace.engine.connector.FineWorkspaceConnector; import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient; import com.fr.workspace.server.socket.SocketInfoOperator; import io.socket.client.IO; @@ -81,6 +83,7 @@ public class DesignerSocketIO { if (status != Status.Disconnecting) { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), null, 0, UIManager.getIcon("OptionPane.errorIcon")); + TemplatePane.getInstance().editItems(); } status = Status.Disconnected; } From 9d5157989f480d9afa1810ec1e695cf9123828b8 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 19 Jul 2018 14:06:41 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-9856=E3=80=9010.0=E4=BA=8C=E8=BD=AE?= =?UTF-8?q?=E5=9B=9E=E5=BD=92=E3=80=91=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E5=AF=86=E7=A0=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=B6=E6=8F=90=E7=A4=BA=E4=B8=8D=E6=98=8E=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/SwitchExistEnv.java | 2 +- .../java/com/fr/design/mainframe/TemplatePane.java | 2 +- .../src/main/java/com/fr/env/RemoteEnvPane.java | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 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 a3d940fc3..dcfb954d5 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 @@ -125,7 +125,7 @@ public class SwitchExistEnv extends MenuDef { } }); } catch (AuthException exception) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed", "Failed"}), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"}), null, 0, UIManager.getIcon("OptionPane.errorIcon")); } } 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 e9bdce267..6da82863e 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 @@ -153,7 +153,7 @@ public class TemplatePane extends JPanel implements MouseListener { } setJLabel(selectedName); } catch (AuthException e) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed", "Failed"}), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"}), null, 0, UIManager.getIcon("OptionPane.errorIcon")); return false; } diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 68945319f..7087c9785 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -16,12 +16,14 @@ import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.third.guava.base.Strings; import com.fr.workspace.WorkContext; +import com.fr.workspace.connect.AuthException; import com.fr.workspace.connect.WorkspaceConnection; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JDialog; import javax.swing.JFileChooser; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.SwingConstants; @@ -488,8 +490,13 @@ public class RemoteEnvPane extends BasicBeanPane { WorkspaceConnection connection = remoteEnv.getConnection(); DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); - - return WorkContext.getConnector().testConnection(connection); + try { + return WorkContext.getConnector().testConnection(connection); + } catch (AuthException e) { + message.setText(Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Auth_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + return null; + } } @Override From 6892513e2aa2b1249d9a2424a29ff398f5233d16 Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 20 Jul 2018 09:36:42 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/actions/file/SwitchExistEnv.java | 2 +- .../src/main/java/com/fr/design/mainframe/TemplatePane.java | 2 +- .../java/com/fr/design/mainframe/socketio/DesignerSocketIO.java | 2 +- 3 files changed, 3 insertions(+), 3 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 dcfb954d5..9357ad7cd 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 @@ -125,7 +125,7 @@ public class SwitchExistEnv extends MenuDef { } }); } catch (AuthException exception) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"}), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Auth_Failed"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); } } 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 6da82863e..28af3e104 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 @@ -153,7 +153,7 @@ public class TemplatePane extends JPanel implements MouseListener { } setJLabel(selectedName); } catch (AuthException e) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"}), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Fine-Designer_Basic_Remote_Connect_Auth_Failed"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); return false; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index af9667919..603d9ce5b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -81,7 +81,7 @@ public class DesignerSocketIO { @Override public void call(Object... objects) { if (status != Status.Disconnecting) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Fine-Designer_Basic_Remote_Disconnected"), null, 0, UIManager.getIcon("OptionPane.errorIcon")); TemplatePane.getInstance().editItems(); } From ec4d6b19c49a65dd0a011c45797556e0320394bc Mon Sep 17 00:00:00 2001 From: zheng Date: Fri, 20 Jul 2018 11:44:41 +0800 Subject: [PATCH 5/6] CHART-2492 910 --- .../fr/van/chart/designer/other/VanChartInteractivePane.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index d23eea910..2c5e20352 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -183,7 +183,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void checkZoomEnabled() { if (zoomWidget != null && axisRotation != null) { - zoomWidget.setSelectedIndex(1); + if (axisRotation.getSelectedIndex() == 0) { + //只有开启坐标轴翻转,才需要将缩放控件强制关闭。 + zoomWidget.setSelectedIndex(1); + } checkZoomPane(); zoomWidget.setEnabled(axisRotation.getSelectedIndex() == 1); } From 091c2d4c96fdd6de93c50730e18bb557017de339 Mon Sep 17 00:00:00 2001 From: hzzz Date: Mon, 23 Jul 2018 11:40:17 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-9113=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A0=8F-=E6=96=87=E4=BB=B6-=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=85=8D=E7=BD=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=9C=80=E8=A6=81=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=20REPORT-9082=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=A0=8F-=E6=96=87=E4=BB=B6-=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E4=B8=8B=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=B7=B2=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 7087c9785..c47c67444 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -279,6 +279,10 @@ public class RemoteEnvPane extends BasicBeanPane { this.certPathInput.setText(certPath); this.certSecretKeyInput.setText(certSecretKey); + } else { + this.remoteEnvURL = RemoteEnvURL.createDefaultURL(); + this.usernameInput.setText(StringUtils.EMPTY); + this.passwordInput.setText(StringUtils.EMPTY); } fillRemoteEnvURLField();