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 4fb13150e..c3b82646b 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 @@ -62,10 +62,15 @@ import com.fr.file.MemFILE; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.main.impl.WorkBook; +import com.fr.nx.app.designer.toolbar.CompileAction; +import com.fr.nx.app.designer.utils.CptCompileUtil; +import com.fr.nx.cptx.entry.metadata.CptxMetadata; +import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; -import com.fr.nx.app.designer.toolbar.CompileAction; import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -331,6 +336,15 @@ public abstract class JTemplate> return getEditingFILE().getPath(); } + private String getSuffix() { + CptxMetadata metadata = CptxFileUtils.getMetadata(this.getEditingFILE().getPath()); + if (metadata != null && metadata.isForceCpt()) { + //在不支持新引擎时,标题上需要显示分页引擎未生效 + return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Paging_Engine_Not_Work"); + } + return StringUtils.EMPTY; + } + protected abstract JComponent createCenterPane(); /** @@ -1404,7 +1418,7 @@ public abstract class JTemplate> * @return 按钮组 */ public UIButton[] createExtraButtons() { - UIButton[] uiButtons = new UIButton[] { + UIButton[] uiButtons = new UIButton[]{ (UIButton) new CompileAction().createToolBarComponent() }; Set providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG); @@ -1439,7 +1453,12 @@ public abstract class JTemplate> public abstract String route(); public String getTemplateName() { - return getEditingFILE().getName(); + boolean isNewEngine = CptCompileUtil.isNewEngine(this.getTarget()); + if (isNewEngine) { + return getEditingFILE().getName() + getSuffix(); + }else { + return getEditingFILE().getName(); + } } public String getTemplatePredefinedStyle() { @@ -1468,6 +1487,9 @@ public abstract class JTemplate> @Override public void run() { callBackForSave(); + //在保存后的回调中执行预编译流程 + CptCompileUtil.compile(JTemplate.this); + } }); @@ -1532,7 +1554,12 @@ public abstract class JTemplate> worker.addSuccessCallback(new Runnable() { @Override public void run() { - callBackForSave(); + //新添加代码,另存为流程中,有可能没有保存,在没有保存的情况下,应该进行预编译判断 + if (!JTemplate.this.isSaved() && !DesignModeContext.isVcsMode()){ + //这里要先调下面这行代码 + callBackForSave(); + CptCompileUtil.compile(JTemplate.this); + } // 当前打开的是正在保存的模板才刷新 if (ComparatorUtils.equals(JTemplate.this.template.getTemplateID(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().template.getTemplateID())) { @@ -1592,6 +1619,8 @@ public abstract class JTemplate> result = result || provider.saveToNewFile(this.editingFILE.getPath(), this); } if (!result) { + //在这里改变报表引擎属性 + CptCompileUtil.changeFrEngineAttr(oldName, this); result = this.saveRealFile(); // 更换最近打开 DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath());