Browse Source

REPORT-9480 & REPORT-9159 解决切换目录窗口被挡住问题

master
Mata.Li 6 years ago
parent
commit
5b68f75f7a
  1. 9
      designer-base/src/main/java/com/fr/start/Demo.java
  2. 54
      designer-base/src/main/java/com/fr/start/ServerStarter.java
  3. 13
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

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

@ -5,12 +5,11 @@ import com.fr.base.FRContext;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils;
import java.io.File;
import java.io.IOException;
public class Demo {
public static void main(String[] args) {
String installHome = StableUtils.getInstallHome();
String installHome = "D:\\应用\\FineReport_10.1";//StableUtils.getInstallHome();
if (installHome == null) {
FRContext.getLogger().error("Can not find the install home, please check it.");
return;
@ -21,11 +20,7 @@ public class Demo {
if (OperatingSystem.isMacOS()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else {
//转成反斜杠格式
executorPath = new File(StableUtils.pathJoin(installHome, "bin", "designer.exe demo")).getPath();
}
if (!new java.io.File(executorPath).exists()) {
FRContext.getLogger().error(executorPath + " can not be found.");
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}
if (OperatingSystem.isMacOS()) {

54
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,18 +40,22 @@ 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;
}else{
initDemoServerAndBrowser();
}
}
public static void switchWorkContext(){
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
if (!envManager.isCurrentEnvDefault()) {
InformationPane inf = new InformationPane(envManager.getDefaultEnvName());
inf.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
try {
@ -60,12 +65,9 @@ public class ServerStarter {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
initDemoServerAndBrowser();
}
}).setVisible(true);
} else {
initDemoServerAndBrowser();
}
}
@ -123,35 +125,35 @@ public class ServerStarter {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
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");
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");
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));
@ -160,13 +162,13 @@ public class ServerStarter {
a.setLineWrap(true);
this.add(a);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Tooltips");
}
}
}

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

@ -1,13 +1,16 @@
package com.fr.start.module;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.Listener;
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;
import com.fr.start.EnvSwitcher;
import com.fr.start.ServerStarter;
import com.fr.start.SplashContext;
import com.fr.startup.activators.BasicActivator;
import com.fr.workspace.Workspace;
@ -49,6 +52,16 @@ public class DesignerStartup extends Activator {
SplashContext.getInstance().hide();
DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true);
//需要切换工作目录的弹窗放在打开设计器后,以免被挡住
if (args != null) {
for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) {
ServerStarter.switchWorkContext();
break;
}
}
}
startSub(StartFinishActivator.class);
}

Loading…
Cancel
Save