Browse Source

Merge pull request #139 in BA/design from ~RICHIE/design:dev to dev

* commit '8ef2ea935c62eea663b3ce7e29112587390803de':
  填报校验改进,designer暂时依赖engine-write
master
superman 9 years ago
parent
commit
a9485dda33
  1. 1
      designer/designer.iml
  2. 35
      designer/src/com/fr/design/report/BuildInVerifierPane.java
  3. 37
      designer/src/com/fr/design/report/CustomVerifierPane.java
  4. 113
      designer/src/com/fr/design/report/ValueVerifierEditPane.java
  5. 2
      designer/src/com/fr/design/report/VerifierListPane.java

1
designer/designer.iml

@ -17,5 +17,6 @@
<orderEntry type="module" module-name="designer_base" />
<orderEntry type="module" module-name="engine" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="module" module-name="engine-write" />
</component>
</module>

35
designer/src/com/fr/design/report/BuildInVerifierPane.java

@ -0,0 +1,35 @@
package com.fr.design.report;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.report.write.ValueVerifier;
import java.awt.*;
/**
* Created by richie on 16/6/12.
*/
public class BuildInVerifierPane extends BasicBeanPane<ValueVerifier> {
private ValueVerifierEditPane valueVerifierEditPane;
public BuildInVerifierPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
valueVerifierEditPane = new ValueVerifierEditPane();
this.add(valueVerifierEditPane, BorderLayout.CENTER);
}
@Override
public void populateBean(ValueVerifier ob) {
valueVerifierEditPane.populate(ob);
}
@Override
public ValueVerifier updateBean() {
return valueVerifierEditPane.update();
}
@Override
protected String title4PopupWindow() {
return "BuiltIn";
}
}

37
designer/src/com/fr/design/report/CustomVerifierPane.java

@ -0,0 +1,37 @@
package com.fr.design.report;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.report.write.WClassVerifier;
import java.awt.*;
/**
* Created by richie on 16/6/12.
*/
public class CustomVerifierPane extends BasicBeanPane<WClassVerifier> {
private CustomVerifyJobPane pane;
public CustomVerifierPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
pane = new CustomVerifyJobPane();
this.add(pane, BorderLayout.CENTER);
}
@Override
public void populateBean(WClassVerifier ob) {
this.pane.populateBean(ob.getClassVerifyJob());
}
@Override
public WClassVerifier updateBean() {
WClassVerifier verifier = new WClassVerifier();
verifier.setClassVerifyJob(this.pane.updateBean());
return verifier;
}
@Override
protected String title4PopupWindow() {
return "custom";
}
}

113
designer/src/com/fr/design/report/ValueVerifierEditPane.java

@ -2,11 +2,15 @@ package com.fr.design.report;
import com.fr.base.Formula;
import com.fr.data.Verifier;
import com.fr.data.VerifyItem;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.report.write.ValueVerifier;
import com.fr.stable.FormulaProvider;
import com.fr.stable.bridge.StableFactory;
import com.fr.write.ReportWriteAttrProvider;
import com.fr.write.ValueVerifierProvider;
@ -32,116 +36,35 @@ public class ValueVerifierEditPane extends JPanel {
/**
* populate
*/
public void populate(ReportWriteAttrProvider reportWriteAttr) {
if (reportWriteAttr == null) {
public void populate(ValueVerifier valueVerifier) {
if (valueVerifier == null) {
return;
}
int rowCount = reportWriteAttr.getVerifierCount();
Object[][] os = new Object[reportWriteAttr.getValueVerifierCount()][];
int cnt = 0;
for (int i = 0; i < rowCount; i++) {
if (!(reportWriteAttr.getVerifier(i) instanceof ValueVerifierProvider)) {
continue;
}
Formula formula = ((ValueVerifierProvider)reportWriteAttr.getVerifier(i)).getFormula();
int rowCount = valueVerifier.getVerifyItemsCount();
Object[][] os = new Object[rowCount][];
int tableDataCount = 0;
for (int i = 0; i < rowCount; i ++) {
VerifyItem item = valueVerifier.getVerifyItem(i);
FormulaProvider formula = item.getFormula();
if (formula == null) {
continue;
}
String formulaContent = formula.getContent().substring(1);
String message = reportWriteAttr.getVerifier(i).getMessage();
os[cnt++] = new Object[] { formulaContent, message };
os[tableDataCount++] = new Object[]{formula.getPureContent(), item.getMessage()};
}
this.tableEditorPane.populate(os);
}
/**
* update
*/
public void update(ReportWriteAttrProvider reportWriteAttr, String name) {
public ValueVerifier update() {
ValueVerifier valueVerifier = new ValueVerifier();
java.util.List<Object[]> list = tableEditorPane.update();
reportWriteAttr.clearVerifiers(true);
for (int i = 0; i < list.size(); i++) {
Object[] o = list.get(i);
if (o == null || o[0] == null) {
continue;
}
ValueVerifierProvider p = StableFactory.getMarkedInstanceObjectFromClass(ValueVerifierProvider.TAG, ValueVerifierProvider.class);
p.setFormula(new Formula(readValueVerifyObject(o[0])));
p.setMessage(readValueVerifyObject(o[1]));
reportWriteAttr.addVerifier(name, (Verifier) p);
// reportWriteAttr.addVerifier(name, new ValueVerifier(readValueVerifyObject(o[0]), readValueVerifyObject(o[1])));
VerifyItem item = new VerifyItem(new Formula(GeneralUtils.objectToString(o[0])), GeneralUtils.objectToString(o[1]));
valueVerifier.addVerifyItem(item);
}
}
private String readValueVerifyObject(Object obj) {
if (obj == null) {
return null;
}
return obj.toString();
return valueVerifier;
}
}
//public class ValueVerifierEditPane extends BasicBeanPane<ValueVerifier> {
// private ValueVerifier valueVerifier;
// private UITextArea formula = new UITextArea();
// private UITextArea message = new UITextArea();
// private int col = 60;
// private int row = 5;
//
// public ValueVerifierEditPane() {
// valueVerifier = new ValueVerifier();
//
// this.setLayout(new FlowLayout());
//
// JPanel formulaPane = new JPanel();
// UIScrollPane formulaScrollPane = new UIScrollPane(formula);
// formula.setRows(row);
// formula.setColumns(col);
// formula.setLineWrap(true);
// formula.setToolTipText(Inter.getLocText("Verify-ToolTips"));
// UILabel fl = new UILabel(Inter.getLocText("Verify-Verify_Formula"));
// fl.setPreferredSize(new Dimension(80, 20));
// formulaPane.add(fl);
// formulaPane.add(formulaScrollPane);
//
// JPanel messagePane = new JPanel();
// UIScrollPane messageScrollPane = new UIScrollPane(message);
// message.setRows(row);
// message.setColumns(col);
// message.setLineWrap(true);
// UILabel ml = new UILabel(Inter.getLocText("Verify-Error_Information"));
// ml.setPreferredSize(new Dimension(80, 20));
// messagePane.add(ml);
// messagePane.add(messageScrollPane);
//
// this.add(formulaPane);
// this.add(messagePane);
// }
//
// @Override
// public void populateBean(ValueVerifier ob) {
// valueVerifier = ob;
// if (ob != null) {
// if (ob.getFormula() != null) {
// String content = ob.getFormula().getContent();
// formula.setText(content.startsWith("=") ? content.substring(1) : content);
// } else {
// formula.setText("");
// }
// message.setText(ob.getMessage());
// }
// }
//
// @Override
// public ValueVerifier updateBean() {
// valueVerifier.setFormula(new Formula(formula.getText()));
// valueVerifier.setMessage(message.getText());
// return valueVerifier;
// }
//
// @Override
// protected String title4PopupWindow() {
// return "valueVerifierPane";
// }
//}

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

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save