diff --git a/designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java b/designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java index 6f752fa366..2aca0c60a0 100644 --- a/designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java +++ b/designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java @@ -51,7 +51,7 @@ public class ReportWriteAttrAction extends ReportComponentAction nameObjectList = new ArrayList<>(); int verifierCount = reportWriteAttr.getVerifierCount(); for (int i = 0; i < verifierCount; i++) { Verifier verifier = reportWriteAttr.getVerifier(i); nameObjectList.add(new NameObject(verifier.getName(), verifier)); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } public void updateReportWriteAttr(ReportWriteAttrProvider reportWriteAttr) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); reportWriteAttr.clearVerifiers(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; if (nameObject.getObject() instanceof Verifier) { Verifier verifier = (Verifier) nameObject.getObject(); verifier.setName(nameObject.getName()); reportWriteAttr.addVerifier(verifier); } } } } \ No newline at end of file +package com.fr.design.report; import com.fr.data.Verifier; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.VerifyDefineProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ObjectJControlPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.report.write.ReportWriteAttr; import com.fr.report.write.ValueVerifier; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import java.util.ArrayList; /** * 校验列表 */ public class VerifierListPane extends ObjectJControlPane { public VerifierListPane(ElementCasePane ePane) { super(ePane); } /** * 创建选项 * * @return 选项 */ public NameableCreator[] createNameableCreators() { NameableCreator[] creators = new NameableCreator[]{ new NameObjectCreator(Inter.getLocText(new String[]{"BuildIn", "Verify"}), "/com/fr/web/images/reportlet.png", ValueVerifier.class, BuildInVerifierPane.class) }; for (VerifyDefineProvider provider : ExtraDesignClassManager.getInstance().getVerifyDefineProviders()) { creators = ArrayUtils.add(creators, new NameObjectCreator( provider.nameForVerifier(), provider.iconPath(), provider.classForVerifier(), provider.appearanceForVerifier() ) { }); } creators = ArrayUtils.add(creators, new NameObjectCreator( Inter.getLocText(new String[]{"Custom", "Verify"}), "/com/fr/web/images/reportlet.png", WClassVerifier.class, CustomVerifierPane.class)); return creators; } @Override protected String title4PopupWindow() { return "Verify Collections"; } public void populate(ReportWriteAttr reportWriteAttr) { if (reportWriteAttr == null) { return; } java.util.List nameObjectList = new ArrayList<>(); int verifierCount = reportWriteAttr.getVerifierCount(); for (int i = 0; i < verifierCount; i++) { Verifier verifier = reportWriteAttr.getVerifier(i); nameObjectList.add(new NameObject(verifier.getName(), verifier)); } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); } public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length]; java.util.Arrays.asList(res).toArray(res_array); reportWriteAttr.clearVerifiers(); for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; if (nameObject.getObject() instanceof Verifier) { Verifier verifier = (Verifier) nameObject.getObject(); verifier.setName(nameObject.getName()); reportWriteAttr.addVerifier(verifier); } } } } \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/ReportWriteAttrPane.java b/designer/src/com/fr/design/webattr/ReportWriteAttrPane.java index f84c9b0fca..2b9d4fdd96 100644 --- a/designer/src/com/fr/design/webattr/ReportWriteAttrPane.java +++ b/designer/src/com/fr/design/webattr/ReportWriteAttrPane.java @@ -9,8 +9,7 @@ import com.fr.design.report.WriteShortCutsPane; import com.fr.design.write.submit.SubmitVisitorListPane; import com.fr.general.Inter; import com.fr.report.worksheet.WorkSheet; -import com.fr.stable.bridge.StableFactory; -import com.fr.write.ReportWriteAttrProvider; +import com.fr.report.write.ReportWriteAttr; import javax.swing.*; import java.awt.*; @@ -56,9 +55,9 @@ public class ReportWriteAttrPane extends LoadingBasicPane { return; } - ReportWriteAttrProvider reportWriteAttr = report.getReportWriteAttr(); + ReportWriteAttr reportWriteAttr = report.getAttributeTarget(ReportWriteAttr.XML_TAG); if (reportWriteAttr == null) { - reportWriteAttr = StableFactory.getMarkedInstanceObjectFromClass(ReportWriteAttrProvider.XML_TAG, ReportWriteAttrProvider.class); + reportWriteAttr = new ReportWriteAttr(); } this.submiterListPane.populate(reportWriteAttr); @@ -66,8 +65,8 @@ public class ReportWriteAttrPane extends LoadingBasicPane { } - public ReportWriteAttrProvider update() { - ReportWriteAttrProvider reportWriteAttr = StableFactory.getMarkedInstanceObjectFromClass(ReportWriteAttrProvider.XML_TAG, ReportWriteAttrProvider.class); + public ReportWriteAttr update() { + ReportWriteAttr reportWriteAttr = new ReportWriteAttr(); this.submiterListPane.updateReportWriteAttr(reportWriteAttr); this.verifierListPane.updateReportWriteAttr(reportWriteAttr); diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 527f5183d8..033a01e5e1 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -18,13 +18,13 @@ import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.report.write.BuiltInSQLSubmiter; +import com.fr.report.write.ReportWriteAttr; import com.fr.report.write.SubmitVisitor; import com.fr.report.write.WClassSubmiter; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.write.BuiltInSQLSubmiterProvider; import com.fr.write.DBManipulation; -import com.fr.write.ReportWriteAttrProvider; import com.fr.write.WClassSubmiterProvider; import javax.swing.*; @@ -66,7 +66,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { return "write"; } - public void populate(ReportWriteAttrProvider reportWriteAttr) { + public void populate(ReportWriteAttr reportWriteAttr) { if (reportWriteAttr == null) { return; } @@ -87,7 +87,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { * * @param reportWriteAttr 报表填报属性 */ - public void updateReportWriteAttr(ReportWriteAttrProvider reportWriteAttr) { + public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); NameObject[] res_array = new NameObject[res.length];