Browse Source

Merge pull request #210 in DESIGN/design from ~MATA.LI/designrel:release/10.0 to release/10.0

* commit '2db223b1c74a412682649a9019bd0dd19bda9cd5':
  REPORT-9480 & REPORT-9159
  REPORT-9480 & REPORT-9159
  REPORT-9480 & REPORT-9159
  REPORT-9480 & REPORT-9159 解决切换目录窗口被挡住问题
  REPORT-9480 & REPORT-9159 解决切换目录窗口被挡住问题
  REPORT-9480 & REPORT-9159
master
Mata.Li 7 years ago
parent
commit
6bdda893cd
  1. 18
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 3
      designer-base/src/main/java/com/fr/start/Demo.java
  3. 72
      designer-base/src/main/java/com/fr/start/ServerStarter.java
  4. 1
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

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

@ -67,6 +67,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80";
private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps";
private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null;
@ -200,10 +201,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) {
return;
}
String installHome = StableUtils.getInstallHome();
String installHome = StableUtils.getInstallHome();
if (installHome != null && !".".equals(installHome)) {
String name = Inter.getLocText("FR-Engine_DEFAULT");
String envPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
String envPath = designerEnvManager.getDefaultenvPath(installHome);
designerEnvManager.putEnv(name, LocalDesignerWorkspaceInfo.create(name, envPath));
designerEnvManager.setCurEnvName(name);
}
@ -486,8 +487,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public boolean isCurrentEnvDefault() {
DesignerWorkspaceInfo current = this.getWorkspaceInfo(curEnvName);
String defaultEnvPath = StableUtils.pathJoin(new String[]{StableUtils.getInstallHome(), ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME});
return ComparatorUtils.equals(new File(defaultEnvPath).getPath(), current.getPath());
String defaultEnvPath = getDefaultenvPath(StableUtils.getInstallHome());
return ComparatorUtils.equals(defaultEnvPath, current.getPath());
}
/**
@ -495,7 +496,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public DesignerWorkspaceInfo getDefaultConfig() {
String installHome = StableUtils.getInstallHome();
String defaultenvPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
String defaultenvPath = getDefaultenvPath(installHome);
defaultenvPath = new File(defaultenvPath).getPath();
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) {
@ -516,7 +517,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public String getDefaultEnvName() {
String installHome = StableUtils.getInstallHome();
String defaultenvPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME});
String defaultenvPath = getDefaultenvPath(installHome);
defaultenvPath = new File(defaultenvPath).getPath();
if (nameEnvMap.size() >= 0) {
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator();
@ -531,6 +532,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"});
}
private String getDefaultenvPath(String installHome){
//这里需要转成反斜杠和生成默认路径一致
return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath();
}
/**
* 设置当前环境为默认
*/

3
designer-base/src/main/java/com/fr/start/Demo.java

@ -22,9 +22,6 @@ public class Demo {
} else {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}
if (!new java.io.File(executorPath).exists()) {
FRContext.getLogger().error(executorPath + " can not be found.");
}
if (OperatingSystem.isMacOS()) {
ProcessBuilder builder = new ProcessBuilder();

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

@ -22,6 +22,7 @@ import com.fr.stable.StringUtils;
import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
@ -39,36 +40,17 @@ public class ServerStarter {
if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口
browser(WorkContext.getCurrent().getPath());
return;
}
if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
String web = GeneralContext.getCurrentAppNameOfEnv();
browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + web + "/" + ServerConfig.getInstance().getServletName());
return;
}
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
if (!envManager.isCurrentEnvDefault()) {
InformationPane inf = new InformationPane(envManager.getDefaultEnvName());
inf.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
try {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getDefaultConfig()));
TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
initDemoServerAndBrowser();
}
}).setVisible(true);
} else {
}else{
initDemoServerAndBrowser();
}
}
private static void initDemoServerAndBrowser() {
try {
@ -124,49 +106,5 @@ public class ServerStarter {
}
}
private static class InformationPane extends BasicPane {
private static final long serialVersionUID = 1L;
private static final int FREE_STYLE_TOP = 15;
private static final int FREE_STYLE_OTHER = 5;
InformationPane(String message) {
init(message);
}
private void init(String message) {
this.setLayout(new BorderLayout(10, 10));
this.setBorder(BorderFactory.createEmptyBorder(FREE_STYLE_TOP, FREE_STYLE_OTHER, FREE_STYLE_OTHER, FREE_STYLE_OTHER));
String text;
if (!ComparatorUtils.equals(message, Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}))) {
text = Inter.getLocText("FR-Designer_Open") +
ProductConstants.APP_NAME +
Inter.getLocText("FR-Designer_Utils-OpenDemoEnv") +
message + Inter.getLocText("FR-Designer_Utils-switch");
} else {
text = Inter.getLocText("FR-Designer_Open") +
ProductConstants.APP_NAME +
Inter.getLocText("FR-Designer_Utils-NewDemoEnv") +
message + Inter.getLocText("FR-Designer_Utils-switch");
}
UITextArea a = new UITextArea(text);
a.setFont(new Font("Dialog", Font.PLAIN, 12));
a.setEditable(false);
a.setBackground(this.getBackground());
a.setLineWrap(true);
this.add(a);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Tooltips");
}
}
}

1
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -1,5 +1,6 @@
package com.fr.start.module;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.Listener;

Loading…
Cancel
Save