Browse Source

REPORT-28363 点击产品演示启动内置服务器,没有进度条

feature/big-screen
vito 5 years ago
parent
commit
4c30a05784
  1. 12
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 9
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  3. 9
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java
  4. 36
      designer-base/src/main/java/com/fr/start/ServerStarter.java

12
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -82,6 +82,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final String VERSION_80 = "80";
private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps";
/**
* 指定默认工作空间
*/
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default";
private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null;
@ -555,6 +559,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private String getDefaultenvPath(String installHome) {
String defaultWorkspacePath = System.getProperty(DEFAULT_WORKSPACE_PATH);
if (defaultWorkspacePath != null) {
return defaultWorkspacePath;
}
//这里需要转成反斜杠和生成默认路径一致
return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath();
}
@ -1397,6 +1405,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* 对国际化进行校验
* 非简繁英日韩的默认环境 设计器全部默认为英文版本
*
* @param locale
* @return
*/
@ -1548,8 +1557,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
}
else {
} else {
readLayout(reader, name);
}
}

9
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -1284,4 +1284,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
progressDialog.dispose();
}
/**
* 设计器是否已经打开
*
* @return 设计器是否已经打开
*/
public boolean isDesignerOpened() {
return designerOpened;
}
}

9
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java

@ -58,7 +58,14 @@ public class DesignerPushUpdateManager {
private String getFullLatestVersion() {
try {
String res = HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update"));
String url = CloudCenter.getInstance().acquireUrlByKind("jar10.update");
if(StringUtils.isBlank(url)){
return StringUtils.EMPTY;
}
String res = HttpToolbox.get(url);
if(StringUtils.isBlank(res)){
return StringUtils.EMPTY;
}
return new JSONObject(res).optString("buildNO");
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

36
designer-base/src/main/java/com/fr/start/ServerStarter.java

@ -3,10 +3,9 @@ package com.fr.start;
import com.fr.base.ServerConfig;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.stable.StableUtils;
import com.fr.start.server.FineEmbedServer;
import com.fr.start.server.FineEmbedServerMonitor;
import com.fr.workspace.WorkContext;
@ -25,23 +24,11 @@ public class ServerStarter {
if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口
BrowseUtils.browser(WorkContext.getCurrent().getPath());
} else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
String web = GeneralContext.getCurrentAppNameOfEnv();
browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + web + "/" + ServerConfig.getInstance().getServletName());
} else {
initDemoServerAndBrowser();
}
}
private static void initDemoServerAndBrowser() {
try {
FineEmbedServer.start();
} finally {
//先访问Demo, 后访问报表, 不需要重置服务器.
BrowseUtils.browser("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + GeneralContext.getCurrentAppNameOfEnv() + "/" + ServerConfig.getInstance().getServletName());
browserURLWithLocalEnv("http://localhost:"
+ DesignerEnvManager.getEnvManager().getEmbedServerPort()
+ "/" + GeneralContext.getCurrentAppNameOfEnv()
+ "/" + ServerConfig.getInstance().getServletName());
}
}
@ -51,8 +38,8 @@ public class ServerStarter {
* @param url 指定路径
*/
public static void browserURLWithLocalEnv(final String url) {
if (!FineEmbedServerMonitor.getInstance().isComplete()) {
// 内置服务器没有启动并且设计器已经打开,可以使用带进度条的启动方式
if (!FineEmbedServer.isRunning() && DesignerContext.getDesignerFrame().isDesignerOpened()) {
FineEmbedServerMonitor.getInstance().monitor();
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("ServerStarter"));
service.submit(new Runnable() {
@ -68,8 +55,15 @@ public class ServerStarter {
}
});
service.shutdown();
} else {
} else if (!FineEmbedServer.isRunning()) {
// 普通方式启动内置服务器
try {
FineEmbedServer.start();
} finally {
BrowseUtils.browser(url);
}
} else {
// 已经启动内置服务器只需打开链接
BrowseUtils.browser(url);
}
}

Loading…
Cancel
Save