From b35dfc96e3b8e341a297a5e16424430544b04fed Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 27 Dec 2018 09:56:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-13895=20release=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E6=97=B6=E5=BC=82=E6=AD=A5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=A8=A1=E6=9D=BF=E5=90=8E=EF=BC=8C=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=B8=8D=E6=96=AD=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 48 +++++++++++-------- .../DesignerFrameFileDealerPane.java | 30 +++++++++++- 2 files changed, 56 insertions(+), 22 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 e68d00434..714c561e7 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 @@ -38,7 +38,6 @@ 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.exception.DecryptTemplateException; import com.fr.file.FILE; @@ -69,6 +68,7 @@ import javax.swing.JLayeredPane; import javax.swing.JMenuBar; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; @@ -102,8 +102,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { @@ -243,9 +241,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private ProgressDialog progressDialog; - private ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1); - - public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME); @@ -418,7 +413,16 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void on(PluginEvent event) { refreshNorthEastPane(northEastPane, ad); - DesignUtils.refreshDesignerFrame(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (DesignerContext.getDesignerFrame() == null) { + return; + } + DesignerContext.getDesignerFrame().refresh(); + DesignerContext.getDesignerFrame().repaint(); + } + }); } }, new PluginFilter() { @@ -820,21 +824,23 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * 报表运行环境改变时,需要刷新某些面板 */ public void refreshEnv() { + refresh(); + DesignerFrameFileDealerPane.getInstance().refreshDockingView(); + TemplateTreePane.getInstance().refreshDockingView(); + } + + /** + * 安装设计器相关插件时的刷新 + */ + public void refresh() { this.setTitle(); - fixedThreadPool.execute(new Runnable() { - @Override - public void run() { - 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(); - } - } - }); + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + DesignTableDataManager.clearGlobalDs(); + EastRegionContainerPane.getInstance().refreshDownPane(); + JTemplate template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (template != null) { + template.refreshToolArea(); + } } /** 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 7127c9763..4f43e998b 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 @@ -30,11 +30,18 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; @@ -68,6 +75,22 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { + static { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + + @Override + public void on(PluginEvent event) { + DesignUtils.refreshDesignerFrame(); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE); + } + }); + } + private static final String FILE = "file"; private static volatile DesignerFrameFileDealerPane THIS; @@ -163,7 +186,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt * 刷新菜单 */ public void refreshDockingView() { - + long start = System.currentTimeMillis(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(newFolderAction, refreshTreeAction); if (WorkContext.getCurrent().isLocal()) { @@ -176,7 +199,12 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } toolbarDef.updateToolBar(toolBar); resetActionStatus(); + long end = System.currentTimeMillis(); + System.out.println("----------------------->refreshDockingView 菜单: " + (end - start)); + long start1 = System.currentTimeMillis(); refresh(); + long end1 = System.currentTimeMillis(); + System.out.println("-------------------------->菜单 refresh: " + (end1 - start1)); } From dbd31a94ed0192eafa5c99613b3f84928a632e5f Mon Sep 17 00:00:00 2001 From: Hades Date: Thu, 27 Dec 2018 10:33:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrameFileDealerPane.java | 6 ------ 1 file changed, 6 deletions(-) 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 4f43e998b..d60735257 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 @@ -186,7 +186,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt * 刷新菜单 */ public void refreshDockingView() { - long start = System.currentTimeMillis(); ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(newFolderAction, refreshTreeAction); if (WorkContext.getCurrent().isLocal()) { @@ -199,12 +198,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } toolbarDef.updateToolBar(toolBar); resetActionStatus(); - long end = System.currentTimeMillis(); - System.out.println("----------------------->refreshDockingView 菜单: " + (end - start)); - long start1 = System.currentTimeMillis(); refresh(); - long end1 = System.currentTimeMillis(); - System.out.println("-------------------------->菜单 refresh: " + (end1 - start1)); }