From c7c511aa36e739a769f26d350cc40a5e225b6f9d Mon Sep 17 00:00:00 2001 From: "fly.li" Date: Mon, 13 Sep 2021 13:38:20 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55243=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8D=E5=90=88=E7=90=86=E7=9A=84=E6=96=B9=E6=B3=95=E5=90=8D?= =?UTF-8?q?=20&=20=E6=94=B9=E5=8F=98=E6=8A=A5=E8=A1=A8=E5=BC=95=E6=93=8E?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=95=8C=E9=9D=A2=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/JTemplate.java | 3 +-- .../designer/utils/CptAndCptxCompatibilityUtil.java | 8 ++++---- .../com/fr/nx/app/designer/utils/CptCompileUtil.java | 5 +---- .../design/actions/report/ReportEngineAttrAction.java | 6 +++--- .../main/java/com/fr/design/mainframe/JWorkBook.java | 6 ++---- ...ayerReportEnginePane.java => ReportEnginePane.java} | 10 +++++----- 6 files changed, 16 insertions(+), 22 deletions(-) rename designer-realize/src/main/java/com/fr/design/report/{LayerReportEnginePane.java => ReportEnginePane.java} (95%) 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 4b7c6abc8..7a64c77e1 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 @@ -69,7 +69,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; import com.fr.nx.app.designer.utils.CptAndCptxCompatibilityUtil; import com.fr.nx.app.designer.utils.CptCompileUtil; import com.fr.nx.cptx.entry.metadata.CptxMetadata; @@ -1471,7 +1470,7 @@ public abstract class JTemplate> * 设置新引擎后,有不支持的功能时,设计器中模板的标题需要加上“兼容模式”或者“不支持分页引擎”来提示用户 * */ private String compatibilityTip() { - if (!CptAndCptxCompatibilityUtil.enableNewEngine(this.getTarget(), getEditingFILE().getPath())){ + if (!CptAndCptxCompatibilityUtil.isEngineXEnable(this.getTarget(), getEditingFILE().getPath())){ return StringUtils.EMPTY; } String path = this.getEditingFILE().getPath(); diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java index c390579d7..63cab6c3e 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java @@ -33,7 +33,7 @@ public class CptAndCptxCompatibilityUtil { * 判断是不是cptx模板或者开启了的新引擎的cpt模板的另存为操作 **/ private static boolean isSaveAs(JTemplate jTemplate, String oldName, String newName){ - return enableNewEngine(jTemplate.getTarget(), newName) && ((FileExtension.CPTX.matchExtension(oldName) && FileExtension.CPTX.matchExtension(newName)) || (FileExtension.CPT.matchExtension(oldName) && FileExtension.CPT.matchExtension(newName))); + return isEngineXEnable(jTemplate.getTarget(), newName) && ((FileExtension.CPTX.matchExtension(oldName) && FileExtension.CPTX.matchExtension(newName)) || (FileExtension.CPT.matchExtension(oldName) && FileExtension.CPT.matchExtension(newName))); } /** @@ -59,10 +59,10 @@ public class CptAndCptxCompatibilityUtil { * 是否启用了新引擎的判断 * cptx自动走新引擎(非兼容模式),cpt需要进行设置 * */ - public static boolean enableNewEngine(Object workBook, String fileName){ + public static boolean isEngineXEnable(Object workBook, String fileName){ WorkSheet workSheet = gainWorkSheet(workBook); LayerReportAttr layerReportAttr = gainLayerReportAttr(workSheet); - return enableNewEngine(layerReportAttr, fileName); + return isEngineXEnable(layerReportAttr, fileName); } private static LayerReportAttr gainLayerReportAttr(WorkSheet workSheet){ @@ -82,7 +82,7 @@ public class CptAndCptxCompatibilityUtil { return report instanceof WorkSheet ? (WorkSheet)report : null; } - private static boolean enableNewEngine(LayerReportAttr layerReportAttr, String fileName){ + private static boolean isEngineXEnable(LayerReportAttr layerReportAttr, String fileName){ return (layerReportAttr!= null && layerReportAttr.isClientPaging() && layerReportAttr.getEngineState() == 0) || FileExtension.CPTX.matchExtension(fileName); } } diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java index 57f114aba..cb414589c 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java @@ -23,9 +23,6 @@ import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.nx.data.layer.LayerItem; import com.fr.nx.data.layer.LayerProps; import com.fr.nx.template.compile.CompiledReport; -import com.fr.report.report.Report; -import com.fr.report.stable.LayerReportAttr; -import com.fr.report.worksheet.WorkSheet; import java.io.OutputStream; @@ -44,7 +41,7 @@ public class CptCompileUtil { * 应该是流程的误改动,这里改回来,保存时仍然执行预编译。 * 预编译本不应该受引擎模式的影响,但是cpt文件在设置为新引擎后是需要进行编译的 * */ - if (!CptAndCptxCompatibilityUtil.enableNewEngine(workbook, path)){ + if (!CptAndCptxCompatibilityUtil.isEngineXEnable(workbook, path)){ return; } TransformResultInfo resultInfo = compile0(workbook, file); diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java index 310ce257a..4c7feab06 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportEngineAttrAction.java @@ -7,7 +7,7 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.menu.KeySetUtils; -import com.fr.design.report.LayerReportEnginePane; +import com.fr.design.report.ReportEnginePane; import com.fr.report.worksheet.WorkSheet; public class ReportEngineAttrAction extends ReportComponentAction { @@ -18,7 +18,7 @@ public class ReportEngineAttrAction extends ReportComponentAction { } protected void addShortCut(MenuDef exportMenuDef, MenuDef excelExportMenuDef) { - if (CptAndCptxCompatibilityUtil.enableNewEngine(this.getTarget(), getEditingFILE().getPath())){ + if (CptAndCptxCompatibilityUtil.isEngineXEnable(this.getTarget(), getEditingFILE().getPath())){ exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this), new CSVExportAction(this), new TextExportAction(this)); }else { @@ -750,7 +748,7 @@ public class JWorkBook extends JTemplate { */ @Override public ShortCut[] shortcut4TemplateMenu() { - boolean enableNewEngine = CptAndCptxCompatibilityUtil.enableNewEngine(this.getTarget(), getEditingFILE().getPath()); + boolean enableNewEngine = CptAndCptxCompatibilityUtil.isEngineXEnable(this.getTarget(), getEditingFILE().getPath()); ShortCut[] commonShortCut = ArrayUtils.addAll(new ShortCut[]{ new ReportWebAttrAction(this), new ReportExportAttrAction(this), diff --git a/designer-realize/src/main/java/com/fr/design/report/LayerReportEnginePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java similarity index 95% rename from designer-realize/src/main/java/com/fr/design/report/LayerReportEnginePane.java rename to designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java index f64c6ad60..0b75780a1 100644 --- a/designer-realize/src/main/java/com/fr/design/report/LayerReportEnginePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java @@ -31,7 +31,7 @@ import java.util.List; * @version 10.0 * Created on 2021/08/22 */ -public class LayerReportEnginePane extends BasicBeanPane { +public class ReportEnginePane extends BasicBeanPane { private static final int LABEL_HEIGHT = 55; private UICheckBox isClientPaging; private UICheckBox isShowDataNumber; @@ -40,12 +40,12 @@ public class LayerReportEnginePane extends BasicBeanPane { private WorkSheet worksheet; private List radioButtons = new ArrayList<>(2); - public LayerReportEnginePane(WorkSheet worksheet) { + public ReportEnginePane(WorkSheet worksheet) { this.worksheet = worksheet; this.initComponents(); } - public LayerReportEnginePane() { + public ReportEnginePane() { this(null); } @@ -162,8 +162,8 @@ public class LayerReportEnginePane extends BasicBeanPane { isPageQueryBox.setSelected(false); countPerPageEditor.setEnabled(false); } - radioButtons.get(0).setSelected(ob.getEngineState() == 0 ? true : false); - radioButtons.get(1).setSelected(ob.getEngineState() == 1 ? true : false); + radioButtons.get(0).setSelected(ob.getEngineState() == LayerReportAttr.ENGINE_X ? true : false); + radioButtons.get(1).setSelected(ob.getEngineState() == LayerReportAttr.LINE_ENGINE ? true : false); } @Override