Browse Source

Merge pull request #1508 in DESIGN/design from ~VITO/c-design:release/10.0 to release/10.0

* commit '4c30a05784f39d44b6e9937085d7fede4cccfbc2':
  REPORT-28363 点击产品演示启动内置服务器,没有进度条
feature/big-screen
vito 5 years ago
parent
commit
058260ee0e
  1. 12
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 15
      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 String VERSION_80 = "80";
private static final int CACHINGTEMPLATE_LIMIT = 5; private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps"; private static final String WEB_NAME = "webapps";
/**
* 指定默认工作空间
*/
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default";
private static DesignerEnvManager designerEnvManager; // gui. private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null; private String activationKey = null;
@ -555,6 +559,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private String getDefaultenvPath(String installHome) { 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(); 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 * @param locale
* @return * @return
*/ */
@ -1548,8 +1557,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readVcsAttr(reader); readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) { } else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader); readDesignerPort(reader);
} } else {
else {
readLayout(reader, name); readLayout(reader, name);
} }
} }

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

@ -471,7 +471,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
OSSupportCenter.buildAction(new OSBasedAction() { OSSupportCenter.buildAction(new OSBasedAction() {
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
bbsLoginPane[0] = ad.createBBSLoginPane(); bbsLoginPane[0] = ad.createBBSLoginPane();
} }
}, SupportOSImpl.USERINFOPANE); }, SupportOSImpl.USERINFOPANE);
processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]);
@ -483,7 +483,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
OSSupportCenter.buildAction(new OSBasedAction() { OSSupportCenter.buildAction(new OSBasedAction() {
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
northEastPane.add(ad.createBBSLoginPane()); northEastPane.add(ad.createBBSLoginPane());
} }
}, SupportOSImpl.USERINFOPANE); }, SupportOSImpl.USERINFOPANE);
@ -508,7 +508,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
if (OperatingSystem.isMacos()) { if (OperatingSystem.isMacos()) {
Class clazz = Class.forName("com.apple.eawt.Application"); Class clazz = Class.forName("com.apple.eawt.Application");
BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1); BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1);
Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon); Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon);
} else { } else {
this.setIconImages(image); this.setIconImages(image);
@ -1284,4 +1284,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
progressDialog.dispose(); 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() { private String getFullLatestVersion() {
try { 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"); return new JSONObject(res).optString("buildNO");
} catch (Throwable e) { } catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), 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.base.ServerConfig;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.stable.StableUtils;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.start.server.FineEmbedServerMonitor; import com.fr.start.server.FineEmbedServerMonitor;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -25,23 +24,11 @@ public class ServerStarter {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口 //有问题,这里拿不到远程的http端口
BrowseUtils.browser(WorkContext.getCurrent().getPath()); 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 { } else {
initDemoServerAndBrowser(); browserURLWithLocalEnv("http://localhost:"
} + DesignerEnvManager.getEnvManager().getEmbedServerPort()
+ "/" + GeneralContext.getCurrentAppNameOfEnv()
} + "/" + ServerConfig.getInstance().getServletName());
private static void initDemoServerAndBrowser() {
try {
FineEmbedServer.start();
} finally {
//先访问Demo, 后访问报表, 不需要重置服务器.
BrowseUtils.browser("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + GeneralContext.getCurrentAppNameOfEnv() + "/" + ServerConfig.getInstance().getServletName());
} }
} }
@ -51,8 +38,8 @@ public class ServerStarter {
* @param url 指定路径 * @param url 指定路径
*/ */
public static void browserURLWithLocalEnv(final String url) { public static void browserURLWithLocalEnv(final String url) {
// 内置服务器没有启动并且设计器已经打开,可以使用带进度条的启动方式
if (!FineEmbedServerMonitor.getInstance().isComplete()) { if (!FineEmbedServer.isRunning() && DesignerContext.getDesignerFrame().isDesignerOpened()) {
FineEmbedServerMonitor.getInstance().monitor(); FineEmbedServerMonitor.getInstance().monitor();
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("ServerStarter")); ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("ServerStarter"));
service.submit(new Runnable() { service.submit(new Runnable() {
@ -68,8 +55,15 @@ public class ServerStarter {
} }
}); });
service.shutdown(); service.shutdown();
} else if (!FineEmbedServer.isRunning()) {
// 普通方式启动内置服务器
try {
FineEmbedServer.start();
} finally {
BrowseUtils.browser(url);
}
} else { } else {
FineEmbedServer.start(); // 已经启动内置服务器只需打开链接
BrowseUtils.browser(url); BrowseUtils.browser(url);
} }
} }

Loading…
Cancel
Save