|
|
@ -5,6 +5,7 @@ package com.fr.design; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseXMLUtils; |
|
|
|
import com.fr.base.BaseXMLUtils; |
|
|
|
import com.fr.base.Utils; |
|
|
|
import com.fr.base.Utils; |
|
|
|
|
|
|
|
import com.fr.collections.api.Callback; |
|
|
|
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; |
|
|
|
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; |
|
|
|
import com.fr.design.carton.SwitchForSwingChecker; |
|
|
|
import com.fr.design.carton.SwitchForSwingChecker; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
@ -21,8 +22,8 @@ import com.fr.design.locale.impl.ProductImproveMark; |
|
|
|
import com.fr.design.login.DesignerLoginType; |
|
|
|
import com.fr.design.login.DesignerLoginType; |
|
|
|
import com.fr.design.login.config.DesignerLoginConfigManager; |
|
|
|
import com.fr.design.login.config.DesignerLoginConfigManager; |
|
|
|
import com.fr.design.mainframe.ComponentReuseNotifyUtil; |
|
|
|
import com.fr.design.mainframe.ComponentReuseNotifyUtil; |
|
|
|
import com.fr.design.mainframe.simple.SimpleDesignerConfig; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; |
|
|
|
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.simple.SimpleDesignerConfig; |
|
|
|
import com.fr.design.mainframe.vcs.VcsConfigManager; |
|
|
|
import com.fr.design.mainframe.vcs.VcsConfigManager; |
|
|
|
import com.fr.design.notification.SnapChatConfig; |
|
|
|
import com.fr.design.notification.SnapChatConfig; |
|
|
|
import com.fr.design.os.impl.SupportOSImpl; |
|
|
|
import com.fr.design.os.impl.SupportOSImpl; |
|
|
@ -41,6 +42,12 @@ import com.fr.general.SupportLocale; |
|
|
|
import com.fr.general.locale.LocaleCenter; |
|
|
|
import com.fr.general.locale.LocaleCenter; |
|
|
|
import com.fr.general.locale.LocaleMark; |
|
|
|
import com.fr.general.locale.LocaleMark; |
|
|
|
import com.fr.general.xml.GeneralXMLTools; |
|
|
|
import com.fr.general.xml.GeneralXMLTools; |
|
|
|
|
|
|
|
import com.fr.general.xml.async.AsyncXmlElement; |
|
|
|
|
|
|
|
import com.fr.general.xml.async.AsyncXmlReadable; |
|
|
|
|
|
|
|
import com.fr.general.xml.async.SimpleXmlElement; |
|
|
|
|
|
|
|
import com.fr.general.xml.async.XmlElement; |
|
|
|
|
|
|
|
import com.fr.general.xml.async.XmlException; |
|
|
|
|
|
|
|
import com.fr.general.xml.async.XmlInitialFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.LogHandler; |
|
|
|
import com.fr.log.LogHandler; |
|
|
|
import com.fr.stable.CommonUtils; |
|
|
|
import com.fr.stable.CommonUtils; |
|
|
@ -58,8 +65,10 @@ import com.fr.stable.xml.XMLTools; |
|
|
|
import com.fr.stable.xml.XMLWriter; |
|
|
|
import com.fr.stable.xml.XMLWriter; |
|
|
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
import com.fr.start.common.DesignerStartupConfig; |
|
|
|
import com.fr.start.common.DesignerStartupConfig; |
|
|
|
|
|
|
|
import com.fr.start.common.DesignerStartupPool; |
|
|
|
import com.fr.third.apache.logging.log4j.core.appender.FileAppender; |
|
|
|
import com.fr.third.apache.logging.log4j.core.appender.FileAppender; |
|
|
|
import com.fr.third.apache.logging.log4j.core.layout.PatternLayout; |
|
|
|
import com.fr.third.apache.logging.log4j.core.layout.PatternLayout; |
|
|
|
|
|
|
|
import com.fr.third.org.apache.commons.io.FileUtils; |
|
|
|
import com.fr.third.org.apache.commons.io.FilenameUtils; |
|
|
|
import com.fr.third.org.apache.commons.io.FilenameUtils; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContextCallback; |
|
|
|
import com.fr.workspace.WorkContextCallback; |
|
|
@ -89,8 +98,13 @@ import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The manager of Designer GUI. |
|
|
|
* The manager of Designer GUI. |
|
|
|
|
|
|
|
* 下面的作者日期都是随手写的,具体作者已经无法考究。 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @author anonymous |
|
|
|
|
|
|
|
* @version 11.0 |
|
|
|
|
|
|
|
* created by anonymous on 2002/11/08 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReadable { |
|
|
|
|
|
|
|
|
|
|
|
private static final int MAX_SHOW_NUM = 10; |
|
|
|
private static final int MAX_SHOW_NUM = 10; |
|
|
|
private static final String VERSION_80 = "80"; |
|
|
|
private static final String VERSION_80 = "80"; |
|
|
@ -105,20 +119,25 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; |
|
|
|
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String LAST_EAST_REGION_LAYOUT = "LastEastRegionLayout"; |
|
|
|
|
|
|
|
public static final String LAST_WEST_REGION_LAYOUT = "LastWestRegionLayout"; |
|
|
|
|
|
|
|
|
|
|
|
private static DesignerEnvManager designerEnvManager; // gui.
|
|
|
|
private static DesignerEnvManager designerEnvManager; // gui.
|
|
|
|
private String activationKey = null; |
|
|
|
private String activationKey = null; |
|
|
|
private String logLocation = null; |
|
|
|
private String logLocation = null; |
|
|
|
private Rectangle windowBounds = null; // window bounds.
|
|
|
|
private Rectangle windowBounds = null; // window bounds.
|
|
|
|
private String DialogCurrentDirectory = null; |
|
|
|
private String DialogCurrentDirectory = null; |
|
|
|
private String CurrentDirectoryPrefix = null; |
|
|
|
private String CurrentDirectoryPrefix = null; |
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>(); |
|
|
|
private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>(); |
|
|
|
private List<String> tempRecentOpenedFilePathList = new ArrayList<String>(); |
|
|
|
private List<String> tempRecentOpenedFilePathList = new ArrayList<String>(); |
|
|
|
|
|
|
|
private XmlElement<Map<String, List<String>>> recentOpenedMapping = SimpleXmlElement.of(recentOpenedFileListMap); |
|
|
|
|
|
|
|
|
|
|
|
private boolean showPaintToolBar = true; |
|
|
|
private boolean showPaintToolBar = true; |
|
|
|
private int maxNumberOrPreviewRow = 200; |
|
|
|
private int maxNumberOrPreviewRow = 200; |
|
|
|
// name和Env的键值对
|
|
|
|
|
|
|
|
private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>(); |
|
|
|
private XmlElement<EnvConfiguration> envConfig = SimpleXmlElement.of(new EnvConfiguration()); |
|
|
|
// marks: 当前报表服务器名字
|
|
|
|
|
|
|
|
private String curEnvName = null; |
|
|
|
|
|
|
|
private boolean showProjectPane = true; |
|
|
|
private boolean showProjectPane = true; |
|
|
|
private boolean showDataPane = true; |
|
|
|
private boolean showDataPane = true; |
|
|
|
//p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到.
|
|
|
|
//p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到.
|
|
|
@ -181,7 +200,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* alphafine |
|
|
|
* alphafine |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance(); |
|
|
|
private XmlElement<AlphaFineConfigManager> alphaFineConfigManager; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 阅后即焚的配置项 |
|
|
|
* 阅后即焚的配置项 |
|
|
@ -230,7 +249,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
|
|
|
|
|
|
|
|
private boolean propertiesUsable; |
|
|
|
private boolean propertiesUsable; |
|
|
|
|
|
|
|
|
|
|
|
private SimpleDesignerConfig fvsDesignerConfig = SimpleDesignerConfig.getInstance("FvsDesignerConfig"); |
|
|
|
private XmlElement<SimpleDesignerConfig> fvsDesignerConfig = SimpleXmlElement.of(SimpleDesignerConfig.getInstance("FvsDesignerConfig")); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* DesignerEnvManager. |
|
|
|
* DesignerEnvManager. |
|
|
@ -245,12 +264,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
|
|
|
|
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
|
|
|
|
GeneralContext.setLocale(designerEnvManager.getLanguage()); |
|
|
|
GeneralContext.setLocale(designerEnvManager.getLanguage()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); |
|
|
|
designerEnvManager.initElements(designerEnvManager.getDesignerEnvFile()); |
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
} catch (Exception retryEx) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().debug("try async init DesignerEnvManager failed", retryEx); |
|
|
|
XmlHandler.Self.handle(e); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
try { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); |
|
|
|
|
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
XmlHandler.Self.handle(e); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// james:如果没有env定义,要设置一个默认的
|
|
|
|
// james:如果没有env定义,要设置一个默认的
|
|
|
@ -273,7 +298,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void checkNameEnvMap() { |
|
|
|
public static void checkNameEnvMap() { |
|
|
|
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) { |
|
|
|
|
|
|
|
|
|
|
|
if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
@ -443,8 +469,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
// 清空前一个版本中的工作目录和最近打开
|
|
|
|
// 清空前一个版本中的工作目录和最近打开
|
|
|
|
nameEnvMap = new ListMap<String, DesignerWorkspaceInfo>(); |
|
|
|
getEnvConfig().setNameEnvMap(new ListMap<>()); |
|
|
|
curEnvName = null; |
|
|
|
getEnvConfig().setCurEnvName(null); |
|
|
|
designerEnvManager.saveXMLFile(); |
|
|
|
designerEnvManager.saveXMLFile(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -606,7 +632,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
String defaultenvPath = getDefaultenvPath(installHome); |
|
|
|
String defaultenvPath = getDefaultenvPath(installHome); |
|
|
|
defaultenvPath = new File(defaultenvPath).getPath(); |
|
|
|
defaultenvPath = new File(defaultenvPath).getPath(); |
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator(); |
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = getNameEnvMap().entrySet().iterator(); |
|
|
|
while (entryIt.hasNext()) { |
|
|
|
while (entryIt.hasNext()) { |
|
|
|
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next(); |
|
|
|
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next(); |
|
|
|
DesignerWorkspaceInfo env = entry.getValue(); |
|
|
|
DesignerWorkspaceInfo env = entry.getValue(); |
|
|
@ -627,8 +653,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
String defaultenvPath = getDefaultenvPath(installHome); |
|
|
|
String defaultenvPath = getDefaultenvPath(installHome); |
|
|
|
defaultenvPath = new File(defaultenvPath).getPath(); |
|
|
|
defaultenvPath = new File(defaultenvPath).getPath(); |
|
|
|
if (nameEnvMap.size() >= 0) { |
|
|
|
if (getNameEnvMap().size() >= 0) { |
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator(); |
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = getNameEnvMap().entrySet().iterator(); |
|
|
|
while (entryIt.hasNext()) { |
|
|
|
while (entryIt.hasNext()) { |
|
|
|
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next(); |
|
|
|
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next(); |
|
|
|
DesignerWorkspaceInfo env = entry.getValue(); |
|
|
|
DesignerWorkspaceInfo env = entry.getValue(); |
|
|
@ -1019,21 +1045,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SimpleDesignerConfig getFvsDesignerConfig() { |
|
|
|
public SimpleDesignerConfig getFvsDesignerConfig() { |
|
|
|
return fvsDesignerConfig; |
|
|
|
return fvsDesignerConfig.getValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 返回环境名称迭代器 |
|
|
|
* 返回环境名称迭代器 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Iterator<String> getEnvNameIterator() { |
|
|
|
public Iterator<String> getEnvNameIterator() { |
|
|
|
return this.nameEnvMap.keySet().iterator(); |
|
|
|
return this.getNameEnvMap().keySet().iterator(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据名称返回环境 |
|
|
|
* 根据名称返回环境 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public DesignerWorkspaceInfo getWorkspaceInfo(String name) { |
|
|
|
public DesignerWorkspaceInfo getWorkspaceInfo(String name) { |
|
|
|
return this.nameEnvMap.get(name); |
|
|
|
return this.getNameEnvMap().get(name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1044,7 +1070,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void putEnv(String name, DesignerWorkspaceInfo info) { |
|
|
|
public void putEnv(String name, DesignerWorkspaceInfo info) { |
|
|
|
|
|
|
|
|
|
|
|
this.nameEnvMap.put(name, info); |
|
|
|
this.getNameEnvMap().put(name, info); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1053,14 +1079,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
* @param name 环境的名字 |
|
|
|
* @param name 环境的名字 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void removeEnv(String name) { |
|
|
|
public void removeEnv(String name) { |
|
|
|
this.nameEnvMap.remove(name); |
|
|
|
this.getNameEnvMap().remove(name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 清除全部环境 |
|
|
|
* 清除全部环境 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void clearAllEnv() { |
|
|
|
public void clearAllEnv() { |
|
|
|
this.nameEnvMap.clear(); |
|
|
|
this.getNameEnvMap().clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1082,14 +1108,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
* 返回当前环境的名称. |
|
|
|
* 返回当前环境的名称. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String getCurEnvName() { |
|
|
|
public String getCurEnvName() { |
|
|
|
return this.curEnvName; |
|
|
|
return getEnvConfig().getCurEnvName(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置当前环境的名称 |
|
|
|
* 设置当前环境的名称 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setCurEnvName(String envName) { |
|
|
|
public void setCurEnvName(String envName) { |
|
|
|
this.curEnvName = envName; |
|
|
|
getEnvConfig().setCurEnvName(envName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1146,12 +1172,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
if (StringUtils.isEmpty(envName)) { |
|
|
|
if (StringUtils.isEmpty(envName)) { |
|
|
|
return tempRecentOpenedFilePathList; |
|
|
|
return tempRecentOpenedFilePathList; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!recentOpenedFileListMap.containsKey(envName)) { |
|
|
|
if (!recentOpenedMapping.getValue().containsKey(envName)) { |
|
|
|
recentOpenedFileListMap.put(envName, tempRecentOpenedFilePathList); |
|
|
|
recentOpenedMapping.getValue().put(envName, tempRecentOpenedFilePathList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return recentOpenedFileListMap.get(envName); |
|
|
|
return recentOpenedMapping.getValue().get(envName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1755,11 +1781,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AlphaFineConfigManager getAlphaFineConfigManager() { |
|
|
|
public AlphaFineConfigManager getAlphaFineConfigManager() { |
|
|
|
return alphaFineConfigManager; |
|
|
|
return alphaFineConfigManager.getValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { |
|
|
|
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { |
|
|
|
this.alphaFineConfigManager = alphaFineConfigManager; |
|
|
|
this.alphaFineConfigManager.setValue(alphaFineConfigManager); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isImageCompress() { |
|
|
|
public boolean isImageCompress() { |
|
|
@ -1802,6 +1828,100 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
this.layoutTemplateStyle = layoutTemplateStyle; |
|
|
|
this.layoutTemplateStyle = layoutTemplateStyle; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void initElements(File xmlFile) throws XmlException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
backupOldXmlFile(); |
|
|
|
|
|
|
|
XmlInitialFactory xmlInitialFactory = XmlInitialFactory.create(xmlFile); |
|
|
|
|
|
|
|
xmlInitialFactory |
|
|
|
|
|
|
|
.init("XMLVersion", DesignerEnvManager.this::readXMLVersion) |
|
|
|
|
|
|
|
.init("Attributes", DesignerEnvManager.this::readAttributes) |
|
|
|
|
|
|
|
.init("ReportPaneAttributions", DesignerEnvManager.this::readReportPaneAttributions) |
|
|
|
|
|
|
|
.init("RecentOpenedFilePath", (e) -> { |
|
|
|
|
|
|
|
this.recentOpenedMapping = AsyncXmlElement.of(DesignerStartupPool.common(), () -> { |
|
|
|
|
|
|
|
DesignerEnvManager.this.readRecentOpenFileList0(e); |
|
|
|
|
|
|
|
return recentOpenedFileListMap; |
|
|
|
|
|
|
|
}).callback(new Callback<Map<String, List<String>>>() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void exec(Map<String, List<String>> stringListMap) { |
|
|
|
|
|
|
|
checkRecentOpenedFileNum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.init("EnvConfigMap", (e) -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final EnvConfiguration previousConfig = this.envConfig.getValue(); |
|
|
|
|
|
|
|
this.envConfig = AsyncXmlElement.of(DesignerStartupPool.common(), () -> { |
|
|
|
|
|
|
|
DesignerEnvManager.this.readEnvConfigMap(e, previousConfig); |
|
|
|
|
|
|
|
return previousConfig; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.init("LogLocation", DesignerEnvManager.this::readLogLocation) |
|
|
|
|
|
|
|
.init("Language", DesignerEnvManager.this::readLanguage) |
|
|
|
|
|
|
|
.init("JettyServerPort", DesignerEnvManager.this::readJettyPort) |
|
|
|
|
|
|
|
.init("PLengthUnit", DesignerEnvManager.this::readPageLengthUnit) |
|
|
|
|
|
|
|
.init("RLengthUnit", DesignerEnvManager.this::readReportLengthUnit) |
|
|
|
|
|
|
|
.init("LastOpenFilePath", DesignerEnvManager.this::readLastOpenFile) |
|
|
|
|
|
|
|
.init("EncryptionKey", DesignerEnvManager.this::readEncrytionKey) |
|
|
|
|
|
|
|
.init("jdkHome", (e) -> this.jdkHome = e.getElementValue()) |
|
|
|
|
|
|
|
.init("lastBBSTime", DesignerEnvManager.this::readLastBBSTime) |
|
|
|
|
|
|
|
.init("lastBBSNewsTime", DesignerEnvManager.this::readLastBBSNewsTime) |
|
|
|
|
|
|
|
.init("ActivationKey", DesignerEnvManager.this::readActiveKey) |
|
|
|
|
|
|
|
.init("status", DesignerEnvManager.this::readActiveStatus) |
|
|
|
|
|
|
|
.init(CAS_PARAS, DesignerEnvManager.this::readHttpsParas) |
|
|
|
|
|
|
|
.init(EnvDetectorConfig.XML_TAG, DesignerEnvManager.this::readEnvDetectorConfig) |
|
|
|
|
|
|
|
.init(DesignerStartupConfig.XML_TAG, DesignerEnvManager.this::readStartupConfig) |
|
|
|
|
|
|
|
.init("AlphaFineConfigManager", (e) -> { |
|
|
|
|
|
|
|
this.alphaFineConfigManager = AsyncXmlElement.of(DesignerStartupPool.common(), () -> { |
|
|
|
|
|
|
|
AlphaFineConfigManager config = AlphaFineConfigManager.getInstance(); |
|
|
|
|
|
|
|
e.readXMLObject(config); |
|
|
|
|
|
|
|
return config; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.init("RecentColors", DesignerEnvManager.this::readRecentColor) |
|
|
|
|
|
|
|
.init("OpenDebug", DesignerEnvManager.this::readOpenDebug) |
|
|
|
|
|
|
|
.init(ComponentReuseNotificationInfo.XML_TAG, DesignerEnvManager.this::readComponentReuseNotificationInfo) |
|
|
|
|
|
|
|
.init(DesignerPushUpdateConfigManager.XML_TAG, DesignerEnvManager.this::readDesignerPushUpdateAttr) |
|
|
|
|
|
|
|
.init(VcsConfigManager.XML_TAG, DesignerEnvManager.this::readVcsAttr) |
|
|
|
|
|
|
|
.init(DesignerPort.XML_TAG, DesignerEnvManager.this::readDesignerPort) |
|
|
|
|
|
|
|
.init(SnapChatConfig.XML_TAG, DesignerEnvManager.this::readSnapChatConfig) |
|
|
|
|
|
|
|
.init(DesignerLoginConfigManager.XML_TAG, DesignerEnvManager.this::readDesignerLoginAttr) |
|
|
|
|
|
|
|
.init(fvsDesignerConfig.getValue().getName(), (e) -> { |
|
|
|
|
|
|
|
SimpleDesignerConfig config = this.fvsDesignerConfig.getValue(); |
|
|
|
|
|
|
|
this.fvsDesignerConfig = AsyncXmlElement.of(() -> { |
|
|
|
|
|
|
|
e.readXMLObject(config); |
|
|
|
|
|
|
|
return config; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.init(SwitchForSwingChecker.XML_TAG, DesignerEnvManager.this::readSwitchForSwingCheckerAttr) |
|
|
|
|
|
|
|
.init(LAST_WEST_REGION_LAYOUT, DesignerEnvManager.this::readLastWestRegionLayout) |
|
|
|
|
|
|
|
.init(LAST_EAST_REGION_LAYOUT, DesignerEnvManager.this::readLastEastRegionLayout); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
throw new XmlException(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 备份老的 xml 文件, 防止第一次修改存在问题 |
|
|
|
|
|
|
|
* 但是,只备份一次。其他都走老逻辑 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void backupOldXmlFile() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
File oldFile = getEnvFile(); |
|
|
|
|
|
|
|
String newFilePath = ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_backup.xml"; |
|
|
|
|
|
|
|
File newFile = new File(newFilePath); |
|
|
|
|
|
|
|
if (newFile.exists()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (oldFile.exists()) { |
|
|
|
|
|
|
|
FileUtils.copyFile(oldFile, newFile); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Read XML.<br> |
|
|
|
* Read XML.<br> |
|
|
|
* The method will be invoked when read data from XML file.<br> |
|
|
|
* The method will be invoked when read data from XML file.<br> |
|
|
@ -1865,7 +1985,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
readComponentReuseNotificationInfo(reader); |
|
|
|
readComponentReuseNotificationInfo(reader); |
|
|
|
} else if (name.equals(DesignerPushUpdateConfigManager.XML_TAG)) { |
|
|
|
} else if (name.equals(DesignerPushUpdateConfigManager.XML_TAG)) { |
|
|
|
readDesignerPushUpdateAttr(reader); |
|
|
|
readDesignerPushUpdateAttr(reader); |
|
|
|
} else if (name.equals(vcsConfigManager.XML_TAG)) { |
|
|
|
} else if (name.equals(VcsConfigManager.XML_TAG)) { |
|
|
|
readVcsAttr(reader); |
|
|
|
readVcsAttr(reader); |
|
|
|
} else if (DesignerPort.XML_TAG.equals(name)) { |
|
|
|
} else if (DesignerPort.XML_TAG.equals(name)) { |
|
|
|
readDesignerPort(reader); |
|
|
|
readDesignerPort(reader); |
|
|
@ -1873,7 +1993,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
readSnapChatConfig(reader); |
|
|
|
readSnapChatConfig(reader); |
|
|
|
} else if (name.equals(DesignerLoginConfigManager.XML_TAG)) { |
|
|
|
} else if (name.equals(DesignerLoginConfigManager.XML_TAG)) { |
|
|
|
readDesignerLoginAttr(reader); |
|
|
|
readDesignerLoginAttr(reader); |
|
|
|
} else if (name.equals(fvsDesignerConfig.getName())) { |
|
|
|
} else if (name.equals(fvsDesignerConfig.getValue().getName())) { |
|
|
|
readFvsDesignerConfig(reader); |
|
|
|
readFvsDesignerConfig(reader); |
|
|
|
} else if (name.equals(SwitchForSwingChecker.XML_TAG)) { |
|
|
|
} else if (name.equals(SwitchForSwingChecker.XML_TAG)) { |
|
|
|
readSwitchForSwingCheckerAttr(reader); |
|
|
|
readSwitchForSwingCheckerAttr(reader); |
|
|
@ -1893,7 +2013,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void readAlphaFineAttr(XMLableReader reader) { |
|
|
|
private void readAlphaFineAttr(XMLableReader reader) { |
|
|
|
reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance()); |
|
|
|
|
|
|
|
|
|
|
|
AlphaFineConfigManager config = AlphaFineConfigManager.getInstance(); |
|
|
|
|
|
|
|
reader.readXMLObject(config); |
|
|
|
|
|
|
|
this.alphaFineConfigManager = SimpleXmlElement.of(config); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void readEnvDetectorConfig(XMLableReader reader) { |
|
|
|
private void readEnvDetectorConfig(XMLableReader reader) { |
|
|
@ -1918,9 +2041,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readLayout(XMLableReader reader, String name) { |
|
|
|
private void readLayout(XMLableReader reader, String name) { |
|
|
|
if ("LastEastRegionLayout".equals(name)) { |
|
|
|
if (LAST_EAST_REGION_LAYOUT.equals(name)) { |
|
|
|
this.readLastEastRegionLayout(reader); |
|
|
|
this.readLastEastRegionLayout(reader); |
|
|
|
} else if ("LastWestRegionLayout".equals(name)) { |
|
|
|
} else if (LAST_WEST_REGION_LAYOUT.equals(name)) { |
|
|
|
this.readLastWestRegionLayout(reader); |
|
|
|
this.readLastWestRegionLayout(reader); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2016,6 +2139,40 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readEnvConfigMap(XMLableReader reader, EnvConfiguration envConfigs) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY); |
|
|
|
|
|
|
|
envConfigs.setCurEnvName(currentEnv); |
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void readXML(XMLableReader reader) { |
|
|
|
|
|
|
|
if (reader.isAttr()) { |
|
|
|
|
|
|
|
envConfigs.getNameEnvMap().clear(); |
|
|
|
|
|
|
|
} else if (reader.isChildNode()) { |
|
|
|
|
|
|
|
String tagName = reader.getTagName(); |
|
|
|
|
|
|
|
if ("EnvConfigElement".equals(tagName)) { |
|
|
|
|
|
|
|
final String name = reader.getAttrAsString("name", StringUtils.EMPTY); |
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void readXML(XMLableReader reader) { |
|
|
|
|
|
|
|
if (reader.isChildNode()) { |
|
|
|
|
|
|
|
String tagName = reader.getTagName(); |
|
|
|
|
|
|
|
if (DesignerWorkspaceType.Local.toString().equals(tagName)) { |
|
|
|
|
|
|
|
LocalDesignerWorkspaceInfo envConfig = (LocalDesignerWorkspaceInfo) GeneralXMLTools.readXMLable(reader); |
|
|
|
|
|
|
|
envConfigs.getNameEnvMap().put(name, envConfig); |
|
|
|
|
|
|
|
} else if (DesignerWorkspaceType.Remote.toString().equals(tagName)) { |
|
|
|
|
|
|
|
RemoteDesignerWorkspaceInfo envConfig = (RemoteDesignerWorkspaceInfo) GeneralXMLTools.readXMLable(reader); |
|
|
|
|
|
|
|
envConfigs.getNameEnvMap().put(name, envConfig); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void readEnvConfigMap(XMLableReader reader) { |
|
|
|
private void readEnvConfigMap(XMLableReader reader) { |
|
|
|
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY); |
|
|
|
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY); |
|
|
|
this.setCurEnvName(currentEnv); |
|
|
|
this.setCurEnvName(currentEnv); |
|
|
@ -2050,6 +2207,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void readRecentOpenFileList(XMLableReader reader) { |
|
|
|
private void readRecentOpenFileList(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readRecentOpenFileList0(reader); |
|
|
|
|
|
|
|
checkRecentOpenedFileNum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readRecentOpenFileList0(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void readXML(XMLableReader reader) { |
|
|
|
public void readXML(XMLableReader reader) { |
|
|
@ -2081,7 +2245,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
checkRecentOpenedFileNum(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void readDesignerPushUpdateAttr(XMLableReader reader) { |
|
|
|
private void readDesignerPushUpdateAttr(XMLableReader reader) { |
|
|
@ -2151,7 +2314,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
|
|
|
|
|
|
|
|
private void writeAlphaFineAttr(XMLPrintWriter writer) { |
|
|
|
private void writeAlphaFineAttr(XMLPrintWriter writer) { |
|
|
|
if (this.alphaFineConfigManager != null) { |
|
|
|
if (this.alphaFineConfigManager != null) { |
|
|
|
this.alphaFineConfigManager.writeXML(writer); |
|
|
|
this.alphaFineConfigManager.getValue().writeXML(writer); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2228,10 +2391,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
writer.end(); |
|
|
|
writer.end(); |
|
|
|
|
|
|
|
|
|
|
|
writer.startTAG("EnvConfigMap"); |
|
|
|
writer.startTAG("EnvConfigMap"); |
|
|
|
if (this.curEnvName != null) { |
|
|
|
if (this.getCurEnvName() != null) { |
|
|
|
writer.attr("currentEnv", this.curEnvName); |
|
|
|
writer.attr("currentEnv", this.getCurEnvName()); |
|
|
|
} |
|
|
|
} |
|
|
|
for (Entry<String, DesignerWorkspaceInfo> entry : nameEnvMap.entrySet()) { |
|
|
|
for (Entry<String, DesignerWorkspaceInfo> entry : getNameEnvMap().entrySet()) { |
|
|
|
writer.startTAG("EnvConfigElement").attr("name", entry.getKey()); |
|
|
|
writer.startTAG("EnvConfigElement").attr("name", entry.getKey()); |
|
|
|
DesignerWorkspaceInfo envConfig = entry.getValue(); |
|
|
|
DesignerWorkspaceInfo envConfig = entry.getValue(); |
|
|
|
GeneralXMLTools.writeXMLable(writer, envConfig, envConfig.getType().toString()); |
|
|
|
GeneralXMLTools.writeXMLable(writer, envConfig, envConfig.getType().toString()); |
|
|
@ -2440,11 +2603,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void readFvsDesignerConfig(XMLableReader reader) { |
|
|
|
private void readFvsDesignerConfig(XMLableReader reader) { |
|
|
|
reader.readXMLObject(fvsDesignerConfig); |
|
|
|
|
|
|
|
|
|
|
|
SimpleDesignerConfig config = fvsDesignerConfig.getValue(); |
|
|
|
|
|
|
|
reader.readXMLObject(config); |
|
|
|
|
|
|
|
fvsDesignerConfig = SimpleXmlElement.of(config); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void writeFvsDesignerConfig(XMLPrintWriter writer) { |
|
|
|
private void writeFvsDesignerConfig(XMLPrintWriter writer) { |
|
|
|
this.fvsDesignerConfig.writeXML(writer); |
|
|
|
this.fvsDesignerConfig.getValue().writeXML(writer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void writeSwitchForSwingChecker(XMLPrintWriter writer) { |
|
|
|
private void writeSwitchForSwingChecker(XMLPrintWriter writer) { |
|
|
@ -2479,4 +2645,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { |
|
|
|
public SnapChatConfig getSnapChatConfig() { |
|
|
|
public SnapChatConfig getSnapChatConfig() { |
|
|
|
return snapChatConfig; |
|
|
|
return snapChatConfig; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private EnvConfiguration getEnvConfig() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return envConfig.getValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, DesignerWorkspaceInfo> getNameEnvMap() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return getEnvConfig().getNameEnvMap(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class EnvConfiguration { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// name和Env的键值对
|
|
|
|
|
|
|
|
private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>(); |
|
|
|
|
|
|
|
// marks: 当前报表服务器名字
|
|
|
|
|
|
|
|
private String curEnvName = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, DesignerWorkspaceInfo> getNameEnvMap() { |
|
|
|
|
|
|
|
return nameEnvMap; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setNameEnvMap(Map<String, DesignerWorkspaceInfo> nameEnvMap) { |
|
|
|
|
|
|
|
this.nameEnvMap = nameEnvMap; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getCurEnvName() { |
|
|
|
|
|
|
|
return curEnvName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setCurEnvName(String curEnvName) { |
|
|
|
|
|
|
|
this.curEnvName = curEnvName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|