Browse Source

填报属性抽取通用属性接口,定时器依赖填报

master
richie 9 years ago
parent
commit
32b1444a89
  1. 2
      designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java
  2. 2
      designer/src/com/fr/design/report/VerifierListPane.java
  3. 11
      designer/src/com/fr/design/webattr/ReportWriteAttrPane.java
  4. 6
      designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java

2
designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java

@ -51,7 +51,7 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
@Override @Override
public void doOk() { public void doOk() {
isChange = true; isChange = true;
tplEC.setReportWriteAttr(reportWritePane.update()); tplEC.addAttributeTarget(reportWritePane.update());
if (hasActionPerformed) { if (hasActionPerformed) {
final JTemplate targetComponent = DesignerContext.getDesignerFrame().getSelectedJTemplate(); final JTemplate targetComponent = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (targetComponent != null) { if (targetComponent != null) {

2
designer/src/com/fr/design/report/VerifierListPane.java

@ -1 +1 @@
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 com.fr.write.ReportWriteAttrProvider; 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(ReportWriteAttrProvider reportWriteAttr) { if (reportWriteAttr == null) { return; } java.util.List<NameObject> 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); } } } } 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<NameObject> 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); } } } }

11
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.design.write.submit.SubmitVisitorListPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.bridge.StableFactory; import com.fr.report.write.ReportWriteAttr;
import com.fr.write.ReportWriteAttrProvider;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -56,9 +55,9 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
return; return;
} }
ReportWriteAttrProvider reportWriteAttr = report.getReportWriteAttr(); ReportWriteAttr reportWriteAttr = report.getAttributeTarget(ReportWriteAttr.XML_TAG);
if (reportWriteAttr == null) { if (reportWriteAttr == null) {
reportWriteAttr = StableFactory.getMarkedInstanceObjectFromClass(ReportWriteAttrProvider.XML_TAG, ReportWriteAttrProvider.class); reportWriteAttr = new ReportWriteAttr();
} }
this.submiterListPane.populate(reportWriteAttr); this.submiterListPane.populate(reportWriteAttr);
@ -66,8 +65,8 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
} }
public ReportWriteAttrProvider update() { public ReportWriteAttr update() {
ReportWriteAttrProvider reportWriteAttr = StableFactory.getMarkedInstanceObjectFromClass(ReportWriteAttrProvider.XML_TAG, ReportWriteAttrProvider.class); ReportWriteAttr reportWriteAttr = new ReportWriteAttr();
this.submiterListPane.updateReportWriteAttr(reportWriteAttr); this.submiterListPane.updateReportWriteAttr(reportWriteAttr);
this.verifierListPane.updateReportWriteAttr(reportWriteAttr); this.verifierListPane.updateReportWriteAttr(reportWriteAttr);

6
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.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.report.write.BuiltInSQLSubmiter; import com.fr.report.write.BuiltInSQLSubmiter;
import com.fr.report.write.ReportWriteAttr;
import com.fr.report.write.SubmitVisitor; import com.fr.report.write.SubmitVisitor;
import com.fr.report.write.WClassSubmiter; import com.fr.report.write.WClassSubmiter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.write.BuiltInSQLSubmiterProvider; import com.fr.write.BuiltInSQLSubmiterProvider;
import com.fr.write.DBManipulation; import com.fr.write.DBManipulation;
import com.fr.write.ReportWriteAttrProvider;
import com.fr.write.WClassSubmiterProvider; import com.fr.write.WClassSubmiterProvider;
import javax.swing.*; import javax.swing.*;
@ -66,7 +66,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane {
return "write"; return "write";
} }
public void populate(ReportWriteAttrProvider reportWriteAttr) { public void populate(ReportWriteAttr reportWriteAttr) {
if (reportWriteAttr == null) { if (reportWriteAttr == null) {
return; return;
} }
@ -87,7 +87,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane {
* *
* @param reportWriteAttr 报表填报属性 * @param reportWriteAttr 报表填报属性
*/ */
public void updateReportWriteAttr(ReportWriteAttrProvider reportWriteAttr) { public void updateReportWriteAttr(ReportWriteAttr reportWriteAttr) {
// Nameable[]居然不能强转成NameObject[],一定要这么写... // Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update(); Nameable[] res = this.update();
NameObject[] res_array = new NameObject[res.length]; NameObject[] res_array = new NameObject[res.length];

Loading…
Cancel
Save