|
|
|
@ -104,12 +104,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
* The manager of Designer GUI. |
|
|
|
|
* 下面的作者日期都是随手写的,具体作者已经无法考究。 |
|
|
|
|
* |
|
|
|
|
* @author anonymous |
|
|
|
|
* @version 11.0 |
|
|
|
|
* @author anonymous |
|
|
|
|
* @version 11.0 |
|
|
|
|
* created by anonymous on 2002/11/08 |
|
|
|
|
*/ |
|
|
|
|
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"; |
|
|
|
@ -122,26 +122,26 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
* 指定默认工作空间 |
|
|
|
|
*/ |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private XmlElement<EnvConfiguration> envConfig = SimpleXmlElement.of(new EnvConfiguration()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean showProjectPane = true; |
|
|
|
|
private boolean showDataPane = true; |
|
|
|
|
//p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到.
|
|
|
|
@ -195,12 +195,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
private boolean embedServerLazyStartup = false; |
|
|
|
|
//最近使用的颜色
|
|
|
|
|
private ColorSelectConfigManager configManager = new ColorSelectConfigManager(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 环境检测配置 |
|
|
|
|
*/ |
|
|
|
|
private EnvDetectorConfig envDetectorConfig = EnvDetectorConfig.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* alphafine |
|
|
|
|
*/ |
|
|
|
@ -214,11 +214,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); |
|
|
|
|
|
|
|
|
|
private VcsConfigManager vcsConfigManager = VcsConfigManager.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DesignerStartupConfig designerStartupConfig = DesignerStartupConfig.getInstance(); |
|
|
|
|
|
|
|
|
|
private SwitchForSwingChecker switchForSwingChecker = SwitchForSwingChecker.getInstance(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String CAS_CERTIFICATE_PATH = "certificatePath"; |
|
|
|
|
|
|
|
|
|
public static final String CAS_CERTIFICATE_PASSWORD = "certificatePass"; |
|
|
|
@ -267,7 +267,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
designerEnvManager = new DesignerEnvManager(); |
|
|
|
|
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
|
|
|
|
|
GeneralContext.setLocale(designerEnvManager.getLanguage()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!asyncInitEnvManager()) { |
|
|
|
|
// 如果异步读取失败, 则恢复原来的逻辑
|
|
|
|
|
compatibleInitEnvManager(); |
|
|
|
@ -287,9 +287,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
|
|
|
|
|
return designerEnvManager; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void compatibleInitEnvManager() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); |
|
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
@ -299,7 +299,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 异步初始化环境管理, 提供配置, 帮助处理预期外的问题 |
|
|
|
|
* 1-当优化开启时,才走异步逻辑 |
|
|
|
@ -308,7 +308,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
* @return 是/否 |
|
|
|
|
*/ |
|
|
|
|
private static boolean asyncInitEnvManager() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AtomicBoolean noEx = new AtomicBoolean(false); |
|
|
|
|
OptimizeUtil.initiateOpen(DesignerEnvManager.class.getSimpleName().toLowerCase(), () -> { |
|
|
|
|
try { |
|
|
|
@ -326,7 +326,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void checkNameEnvMap() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -1060,11 +1060,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
public void setLanguage(Locale locale) { |
|
|
|
|
this.language = locale; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isStartupPageEnabled() { |
|
|
|
|
return this.designerStartupConfig.isEnabled(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setStartupPageEnabled(boolean enabled) { |
|
|
|
|
this.designerStartupConfig.setEnabled(enabled); |
|
|
|
|
} |
|
|
|
@ -1191,9 +1191,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
public void setCurrentDirectoryPrefix(String prefix) { |
|
|
|
|
this.CurrentDirectoryPrefix = prefix; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<String> getRecentOpenedFilePathList4Env(String envName) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(envName)) { |
|
|
|
|
return tempRecentOpenedFilePathList; |
|
|
|
|
} else { |
|
|
|
@ -1201,7 +1201,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
recentOpenedMapping.getValue().put(envName, tempRecentOpenedFilePathList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return recentOpenedMapping.getValue().get(envName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1209,7 +1209,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
* 返回最近打开的文件路径列表 |
|
|
|
|
*/ |
|
|
|
|
public List<String> getRecentOpenedFilePathList() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.getRecentOpenedFilePathList4Env(getCurEnvName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1713,7 +1713,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Carina.config(LanguageConfigProvider.class).setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage())); |
|
|
|
|
setLocale(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void setLocale() { |
|
|
|
|
try { |
|
|
|
|
Carina.config(LanguageConfigProvider.class) |
|
|
|
|
.setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage())); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1853,10 +1862,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
public void setLayoutTemplateStyle(int layoutTemplateStyle) { |
|
|
|
|
this.layoutTemplateStyle = layoutTemplateStyle; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void initElements(File xmlFile) throws XmlException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
backupOldXmlFile(); |
|
|
|
|
XmlInitialFactory xmlInitialFactory = XmlInitialFactory.create(xmlFile); |
|
|
|
@ -1876,7 +1885,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.init("EnvConfigMap", (e) -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final EnvConfiguration previousConfig = this.envConfig.getValue(); |
|
|
|
|
this.envConfig = AsyncXmlElement.of(DesignerStartupPool.common(), () -> { |
|
|
|
|
DesignerEnvManager.this.readEnvConfigMap(e, previousConfig); |
|
|
|
@ -1928,13 +1937,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
throw new XmlException(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 备份老的 xml 文件, 防止第一次修改存在问题 |
|
|
|
|
* 但是,只备份一次。其他都走老逻辑 |
|
|
|
|
*/ |
|
|
|
|
private void backupOldXmlFile() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
File oldFile = getEnvFile(); |
|
|
|
|
String newFilePath = ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_backup.xml"; |
|
|
|
@ -1948,7 +1957,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Read XML.<br> |
|
|
|
|
* The method will be invoked when read data from XML file.<br> |
|
|
|
@ -2040,16 +2049,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void readAlphaFineAttr(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlphaFineConfigManager config = AlphaFineConfigManager.getInstance(); |
|
|
|
|
reader.readXMLObject(config); |
|
|
|
|
this.alphaFineConfigManager = SimpleXmlElement.of(config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readEnvDetectorConfig(XMLableReader reader) { |
|
|
|
|
reader.readXMLObject(this.envDetectorConfig); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readStartupConfig(XMLableReader reader) { |
|
|
|
|
reader.readXMLObject(this.designerStartupConfig); |
|
|
|
|
} |
|
|
|
@ -2165,9 +2174,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
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() { |
|
|
|
@ -2232,15 +2241,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void readRecentOpenFileList(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readRecentOpenFileList0(reader); |
|
|
|
|
checkRecentOpenedFileNum(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void readRecentOpenFileList0(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reader.readXMLObject(new XMLReadable() { |
|
|
|
|
@Override |
|
|
|
|
public void readXML(XMLableReader reader) { |
|
|
|
@ -2358,13 +2367,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
writer.end(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void writeEnvDetectorConfig(XMLPrintWriter writer) { |
|
|
|
|
if (this.envDetectorConfig != null) { |
|
|
|
|
this.envDetectorConfig.writeXML(writer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void writeStartupConfig(XMLPrintWriter writer) { |
|
|
|
|
if (this.designerStartupConfig != null) { |
|
|
|
|
this.designerStartupConfig.writeXML(writer); |
|
|
|
@ -2630,7 +2639,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void readFvsDesignerConfig(XMLableReader reader) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDesignerConfig config = fvsDesignerConfig.getValue(); |
|
|
|
|
reader.readXMLObject(config); |
|
|
|
|
fvsDesignerConfig = SimpleXmlElement.of(config); |
|
|
|
@ -2672,39 +2681,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
|
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|