Browse Source

校验改进

master
richie 9 years ago
parent
commit
b7a6beeb20
  1. 2
      designer/src/com/fr/design/report/VerifierListPane.java
  2. 27
      designer/src/com/fr/design/webattr/ReportWriteAttrPane.java
  3. 24
      designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java

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.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(nameObject.getName(), 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 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); } } } }

27
designer/src/com/fr/design/webattr/ReportWriteAttrPane.java

@ -6,7 +6,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.report.VerifierListPane; import com.fr.design.report.VerifierListPane;
import com.fr.design.report.WriteShortCutsPane; import com.fr.design.report.WriteShortCutsPane;
import com.fr.design.write.submit.SubmiterListPane; 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.stable.bridge.StableFactory;
@ -16,7 +16,7 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
public class ReportWriteAttrPane extends LoadingBasicPane { public class ReportWriteAttrPane extends LoadingBasicPane {
private SubmiterListPane submiterListPane; private SubmitVisitorListPane submiterListPane;
// private ValueVerifierEditPane valueVerifierEditPane; // private ValueVerifierEditPane valueVerifierEditPane;
private VerifierListPane verifierListPane; private VerifierListPane verifierListPane;
private WriteShortCutsPane writeShortCutsPane; private WriteShortCutsPane writeShortCutsPane;
@ -33,7 +33,7 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
// peter: writeSQLAttrList的编辑. // peter: writeSQLAttrList的编辑.
if (submiterListPane == null) { if (submiterListPane == null) {
submiterListPane = new SubmiterListPane(ePane); submiterListPane = new SubmitVisitorListPane(ePane);
} }
// valueVerifierEditPane = new ValueVerifierEditPane(); // valueVerifierEditPane = new ValueVerifierEditPane();
if (verifierListPane == null) { if (verifierListPane == null) {
@ -44,27 +44,6 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
tabbedPane.addTab(Inter.getLocText("FR-Utils_Submit"), submiterListPane); tabbedPane.addTab(Inter.getLocText("FR-Utils_Submit"), submiterListPane);
tabbedPane.addTab(Inter.getLocText("Verify-Data_Verify"), verifierListPane); tabbedPane.addTab(Inter.getLocText("Verify-Data_Verify"), verifierListPane);
tabbedPane.addTab(Inter.getLocText("Writer-ShortCuts_Setting"), writeShortCutsPane); tabbedPane.addTab(Inter.getLocText("Writer-ShortCuts_Setting"), writeShortCutsPane);
// tabbedPane.addChangeListener(new ChangeListener() {
// @Override
// public void stateChanged(ChangeEvent e) {
// // 切换的时候这里会先于UITabbedPaneUI的MousePressed事件
// // 会导致弹窗两次
// int idx = ReportWriteAttrPane.this.getInvalidIndex();
// if (idx >= 0 && idx != tabbedPane.getSelectedIndex()) {
// try {
// if (idx == 0) {
// ReportWriteAttrPane.this.submiterListPane.checkValid();
// } else {
// ReportWriteAttrPane.this.verifierListPane.checkValid();
// }
// } catch (Exception exp) {
// JOptionPane.showMessageDialog(ReportWriteAttrPane.this, exp.getMessage());
// tabbedPane.setSelectedIndex(idx);
// }
// }
// }
// });
} }
@Override @Override

24
designer/src/com/fr/design/write/submit/SubmiterListPane.java → designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java

@ -17,10 +17,11 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; 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.SubmitVisitor; import com.fr.report.write.SubmitVisitor;
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.stable.bridge.StableFactory;
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.ReportWriteAttrProvider;
@ -35,9 +36,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class SubmiterListPane extends ObjectJControlPane { public class SubmitVisitorListPane extends ObjectJControlPane {
public SubmiterListPane(ElementCasePane ePane) { public SubmitVisitorListPane(ElementCasePane ePane) {
super(ePane); super(ePane);
} }
@ -50,14 +51,12 @@ public class SubmiterListPane extends ObjectJControlPane {
return new NameableCreator[]{ return new NameableCreator[]{
new NameObjectCreator(Inter.getLocText("RWA-BuildIn_SQL"), new NameObjectCreator(Inter.getLocText("RWA-BuildIn_SQL"),
"/com/fr/web/images/reportlet.png", "/com/fr/web/images/reportlet.png",
// BuiltInSQLSubmiter.class, BuiltInSQLSubmiter.class,
StableFactory.getRegisteredClass(BuiltInSQLSubmiterProvider.TAG),
BuildInSQLPane.class), BuildInSQLPane.class),
new NameObjectCreator( new NameObjectCreator(
Inter.getLocText(new String[]{"Custom", "RWA-Submit"}), Inter.getLocText(new String[]{"Custom", "RWA-Submit"}),
"/com/fr/web/images/reportlet.png", "/com/fr/web/images/reportlet.png",
// WClassSubmiter.class, WClassSubmiter.class,
StableFactory.getRegisteredClass(WClassSubmiterProvider.TAG),
CustomPane.class) CustomPane.class)
}; };
} }
@ -72,13 +71,12 @@ public class SubmiterListPane extends ObjectJControlPane {
return; return;
} }
List<NameObject> nameObjectList = new ArrayList<NameObject>(); List<NameObject> nameObjectList = new ArrayList<>();
int submiterCount = reportWriteAttr.getSubmitVisitorCount(); int submiterCount = reportWriteAttr.getSubmitVisitorCount();
for (int i = 0; i < submiterCount; i++) { for (int i = 0; i < submiterCount; i++) {
SubmitVisitor submiter = reportWriteAttr.getSubmitVisitor(i); SubmitVisitor visitor = reportWriteAttr.getSubmitVisitor(i);
String name = reportWriteAttr.getSubmitVisitorNameList(i); nameObjectList.add(new NameObject(visitor.getName(), visitor));
nameObjectList.add(new NameObject(name, submiter));
} }
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
@ -100,7 +98,9 @@ public class SubmiterListPane extends ObjectJControlPane {
for (int i = 0; i < res_array.length; i++) { for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i]; NameObject nameObject = res_array[i];
if (nameObject.getObject() instanceof SubmitVisitor) { if (nameObject.getObject() instanceof SubmitVisitor) {
reportWriteAttr.addSubmitVisitor(nameObject.getName(), (SubmitVisitor) nameObject.getObject()); SubmitVisitor visitor = (SubmitVisitor) nameObject.getObject();
visitor.setName(nameObject.getName());
reportWriteAttr.addSubmitVisitor(visitor);
} }
} }
} }
Loading…
Cancel
Save