From 154eb27a3c3255de37cc5ccd2a88558341f8e99c Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 26 Jun 2018 11:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=88=B0activitor=E9=87=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/start/BaseDesigner.java | 31 ---------- .../start/module/DesignerModuleActivator.java | 58 ++++++++++++++++++- .../com/fr/start/module/DesignerStartup.java | 30 ---------- 3 files changed, 56 insertions(+), 63 deletions(-) diff --git a/designer-base/src/com/fr/start/BaseDesigner.java b/designer-base/src/com/fr/start/BaseDesigner.java index 15be19c0d..87d87e7ba 100644 --- a/designer-base/src/com/fr/start/BaseDesigner.java +++ b/designer-base/src/com/fr/start/BaseDesigner.java @@ -11,8 +11,6 @@ import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; -import com.fr.design.mainframe.EastRegionContainerPane; -import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.utils.DesignUtils; import com.fr.event.EventDispatcher; @@ -28,8 +26,6 @@ import com.fr.stable.OperatingSystem; import java.awt.Window; import java.io.File; import java.lang.reflect.Method; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; /** * The main class of Report Designer. @@ -48,38 +44,11 @@ public abstract class BaseDesigner extends ToolBarMenuDock { EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing")); // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 DesignUtils.initLookAndFeel(); - // 预加载一些耗时的单例面板 - preLoadPane(); - // 初始化Log Handler DesignerEnvManager.loadLogSetting(); createDesignerFrame(); } - private void preLoadPane() { - ExecutorService service = Executors.newCachedThreadPool(); - service.submit(new Runnable() { - @Override - public void run() { - LogMessageBar.getInstance(); - } - }); - - service.submit(new Runnable() { - @Override - public void run() { - HistoryTemplateListPane.getInstance(); - } - }); - service.submit(new Runnable() { - @Override - public void run() { - EastRegionContainerPane.getInstance(); - } - }); - service.shutdown(); - } - public void show(final String[] args) { collectUserInformation(); DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(10); diff --git a/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java b/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java index e544fb0ce..ecde873db 100644 --- a/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java +++ b/designer-realize/src/com/fr/start/module/DesignerModuleActivator.java @@ -51,9 +51,12 @@ import com.fr.design.javascript.ProcessTransitionAdapter; import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.App; import com.fr.design.mainframe.BaseJForm; +import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.DesignerFrame; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCaseThumbnail; import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.InformationCollector; @@ -69,6 +72,7 @@ import com.fr.design.mainframe.form.FormECDesignerProvider; import com.fr.design.mainframe.form.FormElementCaseDesigner; import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.loghandler.DesignerLogImpl; +import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.module.ChartHyperlinkGroup; import com.fr.design.module.ChartPreStyleAction; import com.fr.design.module.DesignModuleFactory; @@ -81,6 +85,7 @@ import com.fr.file.FILE; import com.fr.form.main.Form; import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.ui.ChartEditor; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.ModuleContext; @@ -137,8 +142,11 @@ import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.map.server.ChartMapEditorAction; import com.fr.xml.ReportXMLUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; @@ -148,6 +156,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import static com.fr.stable.module.Module.ENGINE_MODULE; @@ -204,6 +214,50 @@ public class DesignerModuleActivator extends Activator implements Prepare { ExtraDesignClassManager.getInstance().getFeedback().didFeedback(); StableFactory.registerMarkedObject(LogProvider.MARK_STRING, DesignerLogImpl.getInstance()); + preLoadPane(); + + } + private static void preLoadPane() { + ExecutorService service = Executors.newCachedThreadPool(); + service.submit(new Runnable() { + @Override + public void run() { + LogMessageBar.getInstance(); + } + }); + + service.submit(new Runnable() { + @Override + public void run() { + HistoryTemplateListPane.getInstance(); + } + }); + service.submit(new Runnable() { + @Override + public void run() { + WidgetInfoConfig.getInstance(); + } + }); + service.submit(new Runnable() { + @Override + public void run() { + CellElementPropertyPane.getInstance(); + } + }); + service.submit(new Runnable() { + @Override + public void run() { + DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane + } + }); + + service.submit(new Runnable() { + @Override + public void run() { + EastRegionContainerPane.getInstance(); + } + }); + service.shutdown(); } private static Class[] actionsForInsertCellElement() { diff --git a/designer-realize/src/com/fr/start/module/DesignerStartup.java b/designer-realize/src/com/fr/start/module/DesignerStartup.java index c8a9d8e67..1936451f2 100644 --- a/designer-realize/src/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/com/fr/start/module/DesignerStartup.java @@ -1,11 +1,8 @@ package com.fr.start.module; -import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.event.Event; import com.fr.event.Listener; -import com.fr.form.ui.WidgetInfoConfig; import com.fr.module.Activator; import com.fr.start.Designer; import com.fr.start.EnvSwitcher; @@ -29,7 +26,6 @@ public class DesignerStartup extends Activator { startSub(BasicActivator.class); final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final Designer designer = new Designer(args); - preLoadSomething(); //启动env startSub(DesignerWorkspaceProvider.class); startSub(EnvBasedModule.class); @@ -52,32 +48,6 @@ public class DesignerStartup extends Activator { startSub(StartFinishActivator.class); } - /** - * 基础模块结束后可以提前加载一部分依赖基础模块(国际化,图标样式之类)的东西 - */ - private void preLoadSomething(){ - ExecutorService service = Executors.newCachedThreadPool(); - service.submit(new Runnable() { - @Override - public void run() { - CellElementPropertyPane.getInstance(); - } - }); - service.submit(new Runnable() { - @Override - public void run() { - DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane - } - }); - service.submit(new Runnable() { - @Override - public void run() { - WidgetInfoConfig.getInstance(); - } - }); - service.shutdown(); - } - /** * 切换环境时,重新启动所有相关模块 */