diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index 8f8d4ae139..2503db1de2 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -76,7 +76,7 @@ public final class WebPreviewUtils { browserTemplate(jt, baseRoute, map, actionType); } }); - worker.start(jt.getTarget().getTemplateID()); + worker.start(jt.getRuntimeId()); return; } browserTemplate(jt, baseRoute, map, actionType); @@ -97,7 +97,7 @@ public final class WebPreviewUtils { ); if (OK_OPTION == selVal) { CallbackSaveWorker worker = jt.saveAs(); - worker.start(jt.getTarget().getTemplateID()); + worker.start(jt.getRuntimeId()); worker.addSuccessCallback(new Runnable() { @Override public void run() { @@ -125,7 +125,7 @@ public final class WebPreviewUtils { browseUrl(jt.getEditingFILE(), baseRoute, map, actionType, jt); } }); - worker.start(jt.getTarget().getTemplateID()); + worker.start(jt.getRuntimeId()); } } } diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 9fa676f94e..87b7f2f25c 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -706,7 +706,7 @@ public class MutilTempalteTabPane extends JComponent { closeTpl(specifiedTemplate); } }); - worker.start(specifiedTemplate.getTarget().getTemplateID()); + worker.start(specifiedTemplate.getRuntimeId()); } else if (returnVal == JOptionPane.NO_OPTION) { closeTpl(specifiedTemplate); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 3c62f3b583..9e8df6b85f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -129,6 +129,11 @@ public abstract class JTemplate> private volatile boolean opening = false; private volatile boolean openFailed = false; + /** + * UI界面模板运行时唯一的id 不存储在模板中 仅在运行时使用 模板界面上关闭就不关注了 + */ + private final String runtimeId = UUID.randomUUID().toString(); + private PluginEventListener pluginListener; public JTemplate() { @@ -1492,10 +1497,6 @@ public abstract class JTemplate> editingFILE = fileChooser.getSelectedFILE(); } - //收集和生成templateID 因为是另存为操作 无论怎么样都需要重新生成templateID - // TODO Hades https://work.fineres.com/browse/REPORT-52936 - // initForCollect(); - FILE finalEditingFILE = editingFILE; CallbackSaveWorker worker = new CallbackSaveWorker(new Callable() { @Override @@ -1587,13 +1588,13 @@ public abstract class JTemplate> @Override public void saveDirectly() { CallbackSaveWorker worker = save(); - worker.start(this.template.getTemplateID()); + worker.start(getRuntimeId()); } @Override public void saveAsDirectly() { CallbackSaveWorker worker = saveAs(); - worker.start(this.template.getTemplateID()); + worker.start(getRuntimeId()); } @Override @@ -1634,4 +1635,7 @@ public abstract class JTemplate> return !isSaving() && !isOpening() && !isOpenFailed(); } + public String getRuntimeId() { + return runtimeId; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java index 7757ea2f42..0ec50ef248 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java @@ -116,7 +116,7 @@ public class CheckButton extends UIButton { startCheck(checkThread); } }); - worker.start(jtemplate.getTarget().getTemplateID()); + worker.start(jtemplate.getRuntimeId()); } } else { if (!jtemplate.isSaved()) { @@ -127,7 +127,7 @@ public class CheckButton extends UIButton { startCheck(checkThread); } }); - worker.start(jtemplate.getTarget().getTemplateID()); + worker.start(jtemplate.getRuntimeId()); } else { startCheck(checkThread); } @@ -148,7 +148,7 @@ public class CheckButton extends UIButton { startCheck(checkThread); } }); - worker.start(jtemplate.getTarget().getTemplateID()); + worker.start(jtemplate.getRuntimeId()); } } }