Browse Source

REPORT-65343 FR11-新自适应开发者调试-新建模板,直接点击开发者调试进行模板保存和预览,此时虽然弹出保存路径弹窗,但对话框弹窗还没有点击的时候模板web就打开了且报错,因为模板没保存成功;设计器端可以看到模板被关闭了

new-design
hades 3 years ago
parent
commit
0862c0aecf
  1. 9
      designer-base/src/main/java/com/fr/design/worker/save/CallbackSaveWorker.java
  2. 19
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

9
designer-base/src/main/java/com/fr/design/worker/save/CallbackSaveWorker.java

@ -63,6 +63,15 @@ public class CallbackSaveWorker extends SaveWorker {
}
}
public void addSuccessCallbackBeforeLast(Runnable successRunnable) {
if (successRunnableList == null) {
successRunnableList = new LinkedList<>();
}
if (successRunnable != null) {
successRunnableList.add(successRunnableList.size() - 1, successRunnable);
}
}
public void addFailCallback(Runnable failRunnable) {
if (failRunnableList == null) {
failRunnableList = new LinkedList<>();

19
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -6,10 +6,13 @@ import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.worker.WorkerManager;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.general.web.ParameterConstants;
import java.util.HashMap;
import java.util.Map;
import javax.swing.SwingWorker;
/**
* Created by kerry on 2020-04-23
@ -44,6 +47,22 @@ public class DeveloperPreview extends AbstractPreviewProvider {
@Override
public void onClick(JTemplate<?, ?> jt) {
super.onClick(jt);
SwingWorker worker = WorkerManager.getInstance().getWorker(jt.getRuntimeId());
if (worker instanceof CallbackSaveWorker) {
CallbackSaveWorker callbackSaveWorker = (CallbackSaveWorker) worker;
callbackSaveWorker.addSuccessCallbackBeforeLast(new Runnable() {
@Override
public void run() {
onPreview(jt);
}
});
} else if (jt.getEditingFILE().isEnvFile()) {
// 已经保存在当前工作目录了
onPreview(jt);
}
}
private void onPreview(JTemplate<?, ?> jt) {
MutilTempalteTabPane.getInstance().closeCurrentTpl();
jt.generateForBiddenTemplate();
}

Loading…
Cancel
Save