Browse Source

放到activitor里面

master
zack 6 years ago
parent
commit
154eb27a3c
  1. 31
      designer-base/src/com/fr/start/BaseDesigner.java
  2. 58
      designer-realize/src/com/fr/start/module/DesignerModuleActivator.java
  3. 30
      designer-realize/src/com/fr/start/module/DesignerStartup.java

31
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);

58
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() {

30
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();
}
/**
* 切换环境时重新启动所有相关模块
*/

Loading…
Cancel
Save