From 098e494eca7379a95976020cfdf2fc1adca7a7ac Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Wed, 1 Sep 2021 21:28:24 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55243=EF=BC=9A=E5=B0=86JStreamWork?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E7=9B=B8=E5=85=B3=E6=96=B9=E6=B3=95=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=88=B0=E8=AF=A5=E7=B1=BB=E9=87=8C=E9=9D=A2=20&=20?= =?UTF-8?q?=E5=B0=86=E9=A2=84=E7=BC=96=E8=AF=91=E6=B5=81=E7=A8=8B=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=88=B0cpt=E4=BF=9D=E5=AD=98=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E4=B8=AD=20&=20cptx=E7=9A=84=E5=8F=A6=E5=AD=98=E4=B8=BAcpt?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E6=B5=81=E7=A8=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) 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());