|
|
|
@ -5,6 +5,7 @@ package com.fr.design;
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseXMLUtils; |
|
|
|
|
import com.fr.base.Utils; |
|
|
|
|
import com.fr.collections.api.Callback; |
|
|
|
|
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; |
|
|
|
|
import com.fr.design.carton.SwitchForSwingChecker; |
|
|
|
|
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.config.DesignerLoginConfigManager; |
|
|
|
|
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.simple.SimpleDesignerConfig; |
|
|
|
|
import com.fr.design.mainframe.vcs.VcsConfigManager; |
|
|
|
|
import com.fr.design.notification.SnapChatConfig; |
|
|
|
|
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.LocaleMark; |
|
|
|
|
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.LogHandler; |
|
|
|
|
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.XMLableReader; |
|
|
|
|
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.layout.PatternLayout; |
|
|
|
|
import com.fr.third.org.apache.commons.io.FileUtils; |
|
|
|
|
import com.fr.third.org.apache.commons.io.FilenameUtils; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.WorkContextCallback; |
|
|
|
@ -89,9 +98,14 @@ import java.util.Map.Entry;
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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 String VERSION_80 = "80"; |
|
|
|
|
private static final String VERSION_90 = "90"; |
|
|
|
@ -104,21 +118,26 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
* 指定默认工作空间 |
|
|
|
|
*/ |
|
|
|
|
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 String activationKey = null; |
|
|
|
|
private String logLocation = null; |
|
|
|
|
private Rectangle windowBounds = null; // window bounds.
|
|
|
|
|
private String DialogCurrentDirectory = null; |
|
|
|
|
private String CurrentDirectoryPrefix = null; |
|
|
|
|
|
|
|
|
|
private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>(); |
|
|
|
|
private List<String> tempRecentOpenedFilePathList = new ArrayList<String>(); |
|
|
|
|
private XmlElement<Map<String, List<String>>> recentOpenedMapping = SimpleXmlElement.of(recentOpenedFileListMap); |
|
|
|
|
|
|
|
|
|
private boolean showPaintToolBar = true; |
|
|
|
|
private int maxNumberOrPreviewRow = 200; |
|
|
|
|
// name和Env的键值对
|
|
|
|
|
private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>(); |
|
|
|
|
// marks: 当前报表服务器名字
|
|
|
|
|
private String curEnvName = null; |
|
|
|
|
|
|
|
|
|
private XmlElement<EnvConfiguration> envConfig = SimpleXmlElement.of(new EnvConfiguration()); |
|
|
|
|
|
|
|
|
|
private boolean showProjectPane = true; |
|
|
|
|
private boolean showDataPane = true; |
|
|
|
|
//p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到.
|
|
|
|
@ -181,7 +200,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
/** |
|
|
|
|
* alphafine |
|
|
|
|
*/ |
|
|
|
|
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance(); |
|
|
|
|
private XmlElement<AlphaFineConfigManager> alphaFineConfigManager; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 阅后即焚的配置项 |
|
|
|
@ -230,7 +249,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
|
|
|
|
|
private boolean propertiesUsable; |
|
|
|
|
|
|
|
|
|
private SimpleDesignerConfig fvsDesignerConfig = SimpleDesignerConfig.getInstance("FvsDesignerConfig"); |
|
|
|
|
private XmlElement<SimpleDesignerConfig> fvsDesignerConfig = SimpleXmlElement.of(SimpleDesignerConfig.getInstance("FvsDesignerConfig")); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* DesignerEnvManager. |
|
|
|
@ -245,12 +264,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
|
|
|
|
|
GeneralContext.setLocale(designerEnvManager.getLanguage()); |
|
|
|
|
try { |
|
|
|
|
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); |
|
|
|
|
designerEnvManager.initElements(designerEnvManager.getDesignerEnvFile()); |
|
|
|
|
} catch (Exception retryEx) { |
|
|
|
|
FineLoggerFactory.getLogger().debug("try async init DesignerEnvManager failed", retryEx); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
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定义,要设置一个默认的
|
|
|
|
@ -273,7 +298,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void checkNameEnvMap() { |
|
|
|
|
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) { |
|
|
|
|
|
|
|
|
|
if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
@ -443,8 +469,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
// 清空前一个版本中的工作目录和最近打开
|
|
|
|
|
nameEnvMap = new ListMap<String, DesignerWorkspaceInfo>(); |
|
|
|
|
curEnvName = null; |
|
|
|
|
getEnvConfig().setNameEnvMap(new ListMap<>()); |
|
|
|
|
getEnvConfig().setCurEnvName(null); |
|
|
|
|
designerEnvManager.saveXMLFile(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -606,7 +632,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
|
String defaultenvPath = getDefaultenvPath(installHome); |
|
|
|
|
defaultenvPath = new File(defaultenvPath).getPath(); |
|
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator(); |
|
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = getNameEnvMap().entrySet().iterator(); |
|
|
|
|
while (entryIt.hasNext()) { |
|
|
|
|
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next(); |
|
|
|
|
DesignerWorkspaceInfo env = entry.getValue(); |
|
|
|
@ -627,8 +653,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
String installHome = StableUtils.getInstallHome(); |
|
|
|
|
String defaultenvPath = getDefaultenvPath(installHome); |
|
|
|
|
defaultenvPath = new File(defaultenvPath).getPath(); |
|
|
|
|
if (nameEnvMap.size() >= 0) { |
|
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator(); |
|
|
|
|
if (getNameEnvMap().size() >= 0) { |
|
|
|
|
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = getNameEnvMap().entrySet().iterator(); |
|
|
|
|
while (entryIt.hasNext()) { |
|
|
|
|
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next(); |
|
|
|
|
DesignerWorkspaceInfo env = entry.getValue(); |
|
|
|
@ -1019,21 +1045,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public SimpleDesignerConfig getFvsDesignerConfig() { |
|
|
|
|
return fvsDesignerConfig; |
|
|
|
|
return fvsDesignerConfig.getValue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 返回环境名称迭代器 |
|
|
|
|
*/ |
|
|
|
|
public Iterator<String> getEnvNameIterator() { |
|
|
|
|
return this.nameEnvMap.keySet().iterator(); |
|
|
|
|
return this.getNameEnvMap().keySet().iterator(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据名称返回环境 |
|
|
|
|
*/ |
|
|
|
|
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) { |
|
|
|
|
|
|
|
|
|
this.nameEnvMap.put(name, info); |
|
|
|
|
this.getNameEnvMap().put(name, info); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1053,14 +1079,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
* @param name 环境的名字 |
|
|
|
|
*/ |
|
|
|
|
public void removeEnv(String name) { |
|
|
|
|
this.nameEnvMap.remove(name); |
|
|
|
|
this.getNameEnvMap().remove(name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 清除全部环境 |
|
|
|
|
*/ |
|
|
|
|
public void clearAllEnv() { |
|
|
|
|
this.nameEnvMap.clear(); |
|
|
|
|
this.getNameEnvMap().clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1082,14 +1108,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
* 返回当前环境的名称. |
|
|
|
|
*/ |
|
|
|
|
public String getCurEnvName() { |
|
|
|
|
return this.curEnvName; |
|
|
|
|
return getEnvConfig().getCurEnvName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设置当前环境的名称 |
|
|
|
|
*/ |
|
|
|
|
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)) { |
|
|
|
|
return tempRecentOpenedFilePathList; |
|
|
|
|
} else { |
|
|
|
|
if (!recentOpenedFileListMap.containsKey(envName)) { |
|
|
|
|
recentOpenedFileListMap.put(envName, tempRecentOpenedFilePathList); |
|
|
|
|
if (!recentOpenedMapping.getValue().containsKey(envName)) { |
|
|
|
|
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() { |
|
|
|
|
return alphaFineConfigManager; |
|
|
|
|
return alphaFineConfigManager.getValue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { |
|
|
|
|
this.alphaFineConfigManager = alphaFineConfigManager; |
|
|
|
|
this.alphaFineConfigManager.setValue(alphaFineConfigManager); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean isImageCompress() { |
|
|
|
@ -1801,7 +1827,101 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
public void setLayoutTemplateStyle(int 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> |
|
|
|
|
* The method will be invoked when read data from XML file.<br> |
|
|
|
@ -1865,7 +1985,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
readComponentReuseNotificationInfo(reader); |
|
|
|
|
} else if (name.equals(DesignerPushUpdateConfigManager.XML_TAG)) { |
|
|
|
|
readDesignerPushUpdateAttr(reader); |
|
|
|
|
} else if (name.equals(vcsConfigManager.XML_TAG)) { |
|
|
|
|
} else if (name.equals(VcsConfigManager.XML_TAG)) { |
|
|
|
|
readVcsAttr(reader); |
|
|
|
|
} else if (DesignerPort.XML_TAG.equals(name)) { |
|
|
|
|
readDesignerPort(reader); |
|
|
|
@ -1873,7 +1993,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
readSnapChatConfig(reader); |
|
|
|
|
} else if (name.equals(DesignerLoginConfigManager.XML_TAG)) { |
|
|
|
|
readDesignerLoginAttr(reader); |
|
|
|
|
} else if (name.equals(fvsDesignerConfig.getName())) { |
|
|
|
|
} else if (name.equals(fvsDesignerConfig.getValue().getName())) { |
|
|
|
|
readFvsDesignerConfig(reader); |
|
|
|
|
} else if (name.equals(SwitchForSwingChecker.XML_TAG)) { |
|
|
|
|
readSwitchForSwingCheckerAttr(reader); |
|
|
|
@ -1893,7 +2013,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
@ -1918,9 +2041,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readLayout(XMLableReader reader, String name) { |
|
|
|
|
if ("LastEastRegionLayout".equals(name)) { |
|
|
|
|
if (LAST_EAST_REGION_LAYOUT.equals(name)) { |
|
|
|
|
this.readLastEastRegionLayout(reader); |
|
|
|
|
} else if ("LastWestRegionLayout".equals(name)) { |
|
|
|
|
} else if (LAST_WEST_REGION_LAYOUT.equals(name)) { |
|
|
|
|
this.readLastWestRegionLayout(reader); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2015,6 +2138,40 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
this.setPaginationLineColor(new Color(Integer.parseInt(tmpVal))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
|
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY); |
|
|
|
@ -2048,8 +2205,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readRecentOpenFileList(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
readRecentOpenFileList0(reader); |
|
|
|
|
checkRecentOpenedFileNum(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void readRecentOpenFileList0(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
|
@Override |
|
|
|
|
public void readXML(XMLableReader reader) { |
|
|
|
@ -2081,7 +2245,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
checkRecentOpenedFileNum(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void readDesignerPushUpdateAttr(XMLableReader reader) { |
|
|
|
@ -2151,7 +2314,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
|
|
|
|
|
private void writeAlphaFineAttr(XMLPrintWriter writer) { |
|
|
|
|
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.startTAG("EnvConfigMap"); |
|
|
|
|
if (this.curEnvName != null) { |
|
|
|
|
writer.attr("currentEnv", this.curEnvName); |
|
|
|
|
if (this.getCurEnvName() != null) { |
|
|
|
|
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()); |
|
|
|
|
DesignerWorkspaceInfo envConfig = entry.getValue(); |
|
|
|
|
GeneralXMLTools.writeXMLable(writer, envConfig, envConfig.getType().toString()); |
|
|
|
@ -2440,11 +2603,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void readFvsDesignerConfig(XMLableReader reader) { |
|
|
|
|
reader.readXMLObject(fvsDesignerConfig); |
|
|
|
|
|
|
|
|
|
SimpleDesignerConfig config = fvsDesignerConfig.getValue(); |
|
|
|
|
reader.readXMLObject(config); |
|
|
|
|
fvsDesignerConfig = SimpleXmlElement.of(config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void writeFvsDesignerConfig(XMLPrintWriter writer) { |
|
|
|
|
this.fvsDesignerConfig.writeXML(writer); |
|
|
|
|
this.fvsDesignerConfig.getValue().writeXML(writer); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void writeSwitchForSwingChecker(XMLPrintWriter writer) { |
|
|
|
@ -2479,4 +2645,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
|
|
|
|
|
public SnapChatConfig getSnapChatConfig() { |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|