帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.7 KiB

package com.fr.start.module;
7 years ago
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.Listener;
7 years ago
import com.fr.general.ComparatorUtils;
import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics;
import com.fr.start.Designer;
7 years ago
import com.fr.start.ServerStarter;
import com.fr.start.SplashContext;
import com.fr.startup.activators.BasicActivator;
7 years ago
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by juhaoyu on 2018/1/8.
*/
@EnableMetrics
public class DesignerStartup extends Activator {
@Override
@Metrics
public void start() {
startSub(PreStartActivator.class);
//启动基础部分
startSub(BasicActivator.class);
final String[] args = getModule().upFindSingleton(StartupArgs.class).get();
final Designer designer = new Designer(args);
7 years ago
7 years ago
startSub(DesignerWorkspaceProvider.class);
registerEnvListener();
//启动env
startSub(EnvBasedModule.class);
7 years ago
if (args != null) {
for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
break;
}
}
}
ExecutorService service = Executors.newSingleThreadExecutor();
service.submit(new Runnable() {
@Override
public void run() {
designer.show(args);
DesignerContext.getDesignerFrame().getProgressDialog().dispose();
}
});
service.shutdown();
DesignerContext.getDesignerFrame().setVisible(true);
//启动画面结束
SplashContext.getInstance().hide();
DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true);
startSub(StartFinishActivator.class);
}
/**
* 切换环境时重新启动所有相关模块
*/
private void registerEnvListener() {
7 years ago
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>() {
@Override
7 years ago
public void on(Event event, Workspace param) {
getSub(EnvBasedModule.class).stop();
}
});
7 years ago
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
7 years ago
public void on(Event event, Workspace param) {
getSub(EnvBasedModule.class).start();
}
});
}
@Override
public void stop() {
}
}