From deef9be217e5bc93366e4173ce978a4873ac93bc Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 30 Jul 2018 19:51:27 +0800 Subject: [PATCH 1/2] REPORT-10159 --- .../com/fr/design/DesignerEnvManager.java | 19 +++++++++++++++++-- .../fr/design/actions/help/WebDemoAction.java | 2 ++ .../java/com/fr/design/utils/DesignUtils.java | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 40c3a12eb..62a0d53cf 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -8,12 +8,15 @@ import com.fr.base.FRContext; import com.fr.base.Utils; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.style.color.ColorSelectConfigManager; +import com.fr.design.utils.DesignUtils; import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; @@ -37,6 +40,7 @@ import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLableReader; import com.fr.workspace.WorkContext; +import com.fr.workspace.WorkContextCallback; import com.fr.workspace.connect.AuthException; import javax.swing.SwingWorker; @@ -498,7 +502,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回默认环境 */ public DesignerWorkspaceInfo getDefaultConfig() { - String installHome = StableUtils.getInstallHome(); + String installHome = "D:\\应用\\FineReport_10.0";// StableUtils.getInstallHome(); String defaultenvPath = getDefaultenvPath(installHome); defaultenvPath = new File(defaultenvPath).getPath(); Iterator> entryIt = nameEnvMap.entrySet().iterator(); @@ -549,7 +553,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { return; } try { - WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig())); + String envName = getDefaultEnvName(); + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()),new WorkContextCallback() { + + @Override + public void done() { + + DesignerEnvManager.getEnvManager().setCurEnvName(envName); + DesignUtils.refreshDesignerFrame(); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); + DesignTableDataManager.fireDSChanged(new HashMap()); + } + }); } catch (AuthException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java index 15473d9d6..8596d5e44 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions.help; import com.fr.base.BaseUtils; +import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; @@ -23,6 +24,7 @@ public class WebDemoAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { + DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); ServerStarter.browserDemoURL(); } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 7082268d2..b9f720e26 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -128,6 +128,7 @@ public class DesignUtils { String line = null; while ((line = reader.readLine()) != null) { if (line.startsWith("demo")) { + DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); ServerStarter.browserDemoURL(); } else if (StringUtils.isNotEmpty(line)) { File f = new File(line); From 432e3aaff995de34e0e62f660c88ada0aa23fb4b Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 30 Jul 2018 19:53:21 +0800 Subject: [PATCH 2/2] REPORT-10159 --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 62a0d53cf..4e45f0e0c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -502,7 +502,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回默认环境 */ public DesignerWorkspaceInfo getDefaultConfig() { - String installHome = "D:\\应用\\FineReport_10.0";// StableUtils.getInstallHome(); + String installHome = StableUtils.getInstallHome(); String defaultenvPath = getDefaultenvPath(installHome); defaultenvPath = new File(defaultenvPath).getPath(); Iterator> entryIt = nameEnvMap.entrySet().iterator();