From 77272c368780b5a985d589d5b3eb6107f88391c0 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Sat, 29 Oct 2016 21:12:55 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-364=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/FormElementCaseEditorProvider.java | 2 +- ...bstractFormElementCaseEditorProcessor.java | 44 +++++++++++++++++++ .../design/designer/creator/XElementCase.java | 25 +++++++++-- 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java diff --git a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java index 5b7bd6fa2f..191f7fa998 100644 --- a/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java +++ b/designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java @@ -19,7 +19,7 @@ public interface FormElementCaseEditorProvider extends Mutable { //加个provider返回tab的接口 //design_base依赖了form - PropertyDescriptor[] createPropertyDescriptor (Class temp, Form reportAttr, ElementCaseEditor editor); + PropertyDescriptor[] createPropertyDescriptor (Class temp, Form form, ElementCaseEditor editor); /** * 生成属性表 diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java new file mode 100644 index 0000000000..08a5a1606f --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProcessor.java @@ -0,0 +1,44 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.FormElementCaseEditorProcessor; +import com.fr.stable.fun.ReportFitAttrProvider; +import com.fr.stable.fun.mark.API; + +import java.beans.PropertyDescriptor; + +/** + * Created by zhouping on 2015/9/10. + */ +@API(level = FormElementCaseEditorProcessor.CURRENT_LEVEL) +public abstract class AbstractFormElementCaseEditorProcessor implements FormElementCaseEditorProcessor { + + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + + + /** + * 生成属性表 + * @param temp 传入当前操作的class + * @param reportFitAttr 传入的自适应属性 + * @return 返回属性表 + */ + @Override + public PropertyDescriptor[] createPropertyDescriptor(Class temp, ReportFitAttrProvider reportFitAttr) { + return new PropertyDescriptor[0]; + } + + /** + * 返回pc自适应属性值 + * @param fitAttrProvider 传入的自适应属性 + * @return 返回pc自适应属性值 + */ + @Override + public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) { + return 0; + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index f5412107a1..f60ffaa0df 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.FormElementCaseEditorProcessor; import com.fr.design.fun.FormElementCaseEditorProvider; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; @@ -25,6 +26,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.CoreGraphHelper; import com.fr.stable.core.PropertyChangeAdapter; import com.fr.form.main.Form; +import com.fr.stable.fun.FitProvider; +import com.fr.stable.fun.ReportFitAttrProvider; import javax.swing.*; import java.awt.*; @@ -107,11 +110,27 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme continue; } this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); - Form formAttr = designer.getTarget(); - PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formAttr, this.toData()); + Form form = designer.getTarget(); + PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), form, this.toData()); propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } - return propertyTableEditor; + + FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); + if (processor == null) { + return propertyTableEditor; + } + this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + FitProvider wbTpl = (FitProvider) designer.getTarget(); + ReportFitAttrProvider fitAttr = wbTpl.getFitAttr(); + ElementCaseEditor editor = this.toData(); + //兼容之前报表块(之前三个选项为:默认 横向 双向 现在是:横向 双向 不自适应) + if (editor.getFitStateInPC() == 0) { + editor.setReportFitAttr(null); + } + ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); + PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); + + return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } @Override