帆软报表设计器源代码。
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.
 
 
 
 

69 lines
2.4 KiB

package com.fr.start;
import com.fine.theme.utils.GlassLayerLoader;
import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.GeneralContext;
import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext;
public class ServerStarter {
// FBP 下默认进入管理系统
public static final String DEFAULT_SERVER_BASE_ROUTE = "#/management";
/**
* 预览Demo
* 找默认工作目录,不应该按照名字去找,而应该按照安装路径,因为默认工作目录的名字可能会改变。
*/
public static void browserDemoURL() {
if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口
BrowseUtils.browser(WorkContext.getCurrent().getPath());
} else {
browserURLWithLocalEnv("http://localhost:"
+ DesignerEnvManager.getEnvManager().getEmbedServerPort()
+ "/" + GeneralContext.getCurrentAppNameOfEnv()
+ "/" + ServerConfig.getInstance().getServletName());
}
}
/**
* 本地环境浏览url
*
* @param url 指定路径
*/
public static void browserURLWithLocalEnv(final String url) {
// 内置服务器没有启动并且设计器已经打开,可以使用带进度条的启动方式
if (!FineEmbedServer.isRunning() && DesignerContext.getDesignerFrame().isDesignerOpened()) {
GlassLayerLoader.getInstance().runWithProgressLoader(() -> {
try {
FineEmbedServer.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
BrowseUtils.browser(url);
return null;
}, Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"), 10);
} else if (!FineEmbedServer.isRunning()) {
// 普通方式启动内置服务器
try {
try {
FineEmbedServer.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
} finally {
BrowseUtils.browser(url);
}
} else {
// 已经启动内置服务器只需打开链接
BrowseUtils.browser(url);
}
}
}