Browse Source

REPORT-52936 saveWorker去掉对模板id的依赖

feature/10.0
hades 3 years ago
parent
commit
7dd528f133
  1. 6
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  2. 2
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  3. 16
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 6
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

6
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());
}
}
}

2
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);
}

16
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -129,6 +129,11 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
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<T extends BaseBook, U extends BaseUndoState<?>>
editingFILE = fileChooser.getSelectedFILE();
}
//收集和生成templateID 因为是另存为操作 无论怎么样都需要重新生成templateID
// TODO Hades https://work.fineres.com/browse/REPORT-52936
// initForCollect();
FILE finalEditingFILE = editingFILE;
CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() {
@Override
@ -1587,13 +1588,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
@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<T extends BaseBook, U extends BaseUndoState<?>>
return !isSaving() && !isOpening() && !isOpenFailed();
}
public String getRuntimeId() {
return runtimeId;
}
}

6
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());
}
}
}

Loading…
Cancel
Save