From cdaa29cd4339bb0b33615a803425c5c84197f6fe Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 5 Jul 2022 17:19:07 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-75174=20FR11=E6=96=B0=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94-PC=E7=AB=AF=E8=87=AA=E9=80=82=E5=BA=94=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=8A=A5=E8=A1=A8=E5=9D=97=E9=80=89=E6=8B=A9=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=EF=BC=8C=E6=8A=A5=E8=A1=A8=E5=9D=97=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7Pc=E6=B5=8F=E8=A7=88=E5=99=A8=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E8=AE=BE=E7=BD=AE=E9=A1=B9=E9=80=89=E6=8B=A9=E5=8F=8C?= =?UTF-8?q?=E5=90=91=E8=87=AA=E9=80=82=E5=BA=94=EF=BC=8C=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E4=B8=BA=E6=96=B0=E6=A8=A1=E5=BC=8F=E5=90=8E=EF=BC=8C=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E5=8F=98=E4=B8=BA=E4=B8=8D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XCreatorUtils.java | 24 ++++++++++++++++--- .../design/designer/creator/XElementCase.java | 10 +------- .../design/fit/common/AdaptiveSwitchUtil.java | 23 ++++++++++++++++++ 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 395521a7fa..eb1f3497a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -4,9 +4,6 @@ package com.fr.design.designer.creator; import com.fr.base.chart.BaseChartCollection; -import com.fr.base.theme.FineColorFlushUtils; -import com.fr.base.theme.FineColorGather; -import com.fr.base.theme.FineColorManager; import com.fr.base.theme.FineColorSynchronizer; import com.fr.base.theme.FormTheme; import com.fr.base.theme.TemplateTheme; @@ -82,6 +79,9 @@ import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; +import com.fr.report.fit.FitProvider; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; import com.fr.stable.StringUtils; import com.fr.third.javax.annotation.Nonnull; import java.util.Set; @@ -486,4 +486,22 @@ public class XCreatorUtils { } } + + public static ReportFitAttr getElementCaseEditorReportFitAttr(ElementCaseEditor editor, FitProvider wbTpl) { + //这边获取到的全局要考虑到服务器的配置 + ReportFitAttr fitAttr = wbTpl.getReportFitAttr() == null ? ReportFitConfig.getInstance().getFrmFitAttr() : wbTpl.getReportFitAttr(); + return getElementCaseEditorReportFitAttr(editor, fitAttr); + } + + public static ReportFitAttr getElementCaseEditorReportFitAttr(ElementCaseEditor editor, ReportFitAttr fitAttr) { + //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) + if (editor.getFitStateInPC() == 0) { + editor.setReportFitAttr(null); + } + ReportFitAttr reportFit = editor.getReportFitAttr(); + if (fitAttr != null) { + reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr; + } + return editor.getReportFitAttr() == null ? fitAttr : reportFit; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java index 2f4a699379..6b452bd08d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java @@ -131,15 +131,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme //这边获取到的全局要考虑到服务器的配置 ReportFitAttr fitAttr = wbTpl.getReportFitAttr() == null ? ReportFitConfig.getInstance().getFrmFitAttr() : wbTpl.getReportFitAttr(); ElementCaseEditor editor = this.toData(); - //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) - if (editor.getFitStateInPC() == 0) { - editor.setReportFitAttr(null); - } - ReportFitAttr reportFit = editor.getReportFitAttr(); - if (fitAttr != null) { - reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr; - } - ReportFitAttr reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit; + ReportFitAttr reportFitAttr = XCreatorUtils.getElementCaseEditorReportFitAttr(editor, fitAttr); BrowserFitPropertyEditor browserFitPropertyEditor = new BrowserFitPropertyEditor(); CRPropertyDescriptor extraEditor = browserFitPropertyEditor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); if (editor.getReportFitAttr() == null) { diff --git a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java index 031d698498..062ffa1504 100644 --- a/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java +++ b/designer-form/src/main/java/com/fr/design/fit/common/AdaptiveSwitchUtil.java @@ -1,6 +1,7 @@ package com.fr.design.fit.common; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.fit.NewJForm; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -11,6 +12,7 @@ import com.fr.file.MemFILE; import com.fr.form.fit.NewFormMarkAttr; import com.fr.form.main.Form; import com.fr.form.main.WidgetGather; +import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteLayout; @@ -94,15 +96,36 @@ public class AdaptiveSwitchUtil { } //如果是从旧的设计模板转化为新的设计模式,并且不是全局配置的模板。则更新新模板的Pc端自适应属性 if (newJForm.getTarget().getReportFitAttr() != null && newJForm.isNewJFrom()) { + //兼容处理老模式下报表块自适应属性设置为跟随报表整体自适应 + compatibleProcessECReportFitAttr(newJForm.getTarget()); //修改自适应属性 newJForm.getTarget().setReportFitAttr(shiftReportFitAttr(oldForm, newJForm.getTarget().getReportFitAttr().isFitFont())); //修改绝对布局中的缩放属性 processAbsoluteLayoutCompatible(newJForm.getTarget()); + } TemplateTool.saveForm(newJForm); return newJForm; } + private static void compatibleProcessECReportFitAttr(Form form) { + Form.traversalWidget(form.getContainer(), new WidgetGather() { + @Override + public void dealWith(Widget widget) { + ElementCaseEditor editor = (ElementCaseEditor) widget; + ReportFitAttr reportFitAttr = XCreatorUtils.getElementCaseEditorReportFitAttr(editor, form); + if (reportFitAttr.fitStateInPC() != 0) { + editor.setReportFitAttr(reportFitAttr); + } + } + + @Override + public boolean dealWithAllCards() { + return true; + } + }, ElementCaseEditor.class); + } + private static void processAbsoluteLayoutCompatible(Form form) { Form.traversalWidget(form.getContainer(), new WidgetGather() {