|
|
|
@ -886,6 +886,54 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
|
|
|
|
|
layeredPane.repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 激活模板 |
|
|
|
|
* <p> |
|
|
|
|
* activateJTemplate需要模板存在,openTemplate需要模板保存过,该方法模板保存与未保存皆可激活,模板如果关闭,并且保存过,会重新打开 |
|
|
|
|
* |
|
|
|
|
* @param templatePath 模板路径 template.getPath() |
|
|
|
|
*/ |
|
|
|
|
public void openOrActiveTemplate(String templatePath) { |
|
|
|
|
//没保存过的模板如果要激活就要从当前历史模板列表里面找
|
|
|
|
|
String templateName = getTemplateNameFromPath(templatePath); |
|
|
|
|
if (isTemplateNeverSaved(templatePath)) { |
|
|
|
|
int index = HistoryTemplateListCache.getInstance().contains(templateName); |
|
|
|
|
//如果历史模板列表中存在则激活
|
|
|
|
|
if (index != -1) { |
|
|
|
|
DesignerContext.getDesignerFrame().activateJTemplate(HistoryTemplateListCache.getInstance().getTemplate(index)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(templatePath)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 指定路径的模板是否保存过 |
|
|
|
|
* |
|
|
|
|
* @param templatePath 模板路径 template.getPath() |
|
|
|
|
* @return 如果模板没保存过则返回true |
|
|
|
|
*/ |
|
|
|
|
private boolean isTemplateNeverSaved(String templatePath) { |
|
|
|
|
FILE tplFile = FILEFactory.createFILE(templatePath); |
|
|
|
|
//没保存过的模板获取到的templatePath所生成的FILE文件会不存在
|
|
|
|
|
return tplFile == null || !tplFile.exists() || StringUtils.isEmpty(templatePath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据模板路径获取模板名称 |
|
|
|
|
* @param templatePath 模板路径 template.getPath() |
|
|
|
|
* @return 模板名 |
|
|
|
|
*/ |
|
|
|
|
private String getTemplateNameFromPath(String templatePath) { |
|
|
|
|
FILE tplFile = FILEFactory.createFILE(templatePath); |
|
|
|
|
String templateName = StringUtils.EMPTY; |
|
|
|
|
if (tplFile != null) { |
|
|
|
|
templateName = tplFile.getName(); |
|
|
|
|
} |
|
|
|
|
return templateName; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 当前模板 停用失败 |
|
|
|
|
* |
|
|
|
@ -1231,6 +1279,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断是否正在进行服务器配置 |
|
|
|
|
* |
|
|
|
|
* @return boolean |
|
|
|
|
*/ |
|
|
|
|
public boolean isServerConfig() { |
|
|
|
@ -1239,6 +1288,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设置是否正在进行服务器配置 |
|
|
|
|
* |
|
|
|
|
* @param serverConfig |
|
|
|
|
*/ |
|
|
|
|
public void setServerConfig(boolean serverConfig) { |
|
|
|
|