neil 9 years ago
parent
commit
7de9c8e911
  1. 2
      designer/src/com/fr/design/actions/report/ReportWriteAttrAction.java
  2. 4
      designer/src/com/fr/design/report/ValueVerifierEditPane.java
  3. 2
      designer/src/com/fr/design/report/VerifierListPane.java
  4. 38
      designer/src/com/fr/design/webattr/ReportWriteAttrPane.java
  5. 508
      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
public void doOk() {
isChange = true;
tplEC.setReportWriteAttr(reportWritePane.update());
tplEC.addAttributeTarget(reportWritePane.update());
if (hasActionPerformed) {
final JTemplate targetComponent = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (targetComponent != null) {

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

@ -1,7 +1,6 @@
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;
@ -11,9 +10,6 @@ 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;
import javax.swing.*;
import java.awt.*;

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; /** * 校验列表 ValueVerifier; ValueVerifier; ValueVerifier; ValueVerifier; import com.fr.report.write.WClassVerifier; ValueVerifier; import com.fr.stable.ArrayUtils; ValueVerifier; import com.fr.stable.Nameable; ValueVerifier; import com.fr.write.ReportWriteAttrProvider; ValueVerifier; ValueVerifier; import java.util.ArrayList; ValueVerifier; /** ValueVerifier; * 校验列表 import com.fr.report.write.WClassVerifier; import com.fr.report.write.WClassVerifier; ValueVerifier; import com.fr.report.write.WClassVerifier; import com.fr.report.write.WClassVerifier; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.report.write.WClassVerifier; import com.fr.stable.Nameable; import com.fr.report.write.WClassVerifier; import com.fr.write.ReportWriteAttrProvider; import com.fr.report.write.WClassVerifier; import com.fr.report.write.WClassVerifier; import java.util.ArrayList; import com.fr.report.write.WClassVerifier; /** import com.fr.report.write.WClassVerifier; * 校验列表 import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils; ValueVerifier; import com.fr.stable.ArrayUtils; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.ArrayUtils; import com.fr.write.ReportWriteAttrProvider; import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils; import java.util.ArrayList; import com.fr.stable.ArrayUtils; /** import com.fr.stable.ArrayUtils; * 校验列表 import com.fr.stable.Nameable; import com.fr.stable.Nameable; ValueVerifier; ValueVerifier; import com.fr.stable.Nameable; @Override import com.fr.stable.Nameable; import com.fr.stable.ArrayUtils; return "Verify Collections"; ValueVerifier; import com.fr.stable.Nameable; import com.fr.stable.Nameable; import com.fr.write.ReportWriteAttrProvider; import com.fr.stable.Nameable; import com.fr.stable.Nameable; import java.util.ArrayList; } import com.fr.stable.Nameable; /** import com.fr.stable.Nameable; * 校验列表 import com.fr.write.ReportWriteAttrProvider; import com.fr.write.ReportWriteAttrProvider; ValueVerifier; import com.fr.write.ReportWriteAttrProvider; import com.fr.report.write.WClassVerifier; import com.fr.stable.ArrayUtils; import com.fr.write.ReportWriteAttrProvider; this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); ValueVerifier; import com.fr.stable.Nameable; public void updateReportWriteAttr(ReportWriteAttrProvider reportWriteAttr) { import com.fr.write.ReportWriteAttrProvider; import com.fr.write.ReportWriteAttrProvider; import com.fr.write.ReportWriteAttrProvider; import com.fr.write.ReportWriteAttrProvider; import java.util.ArrayList; import com.fr.write.ReportWriteAttrProvider; /** import com.fr.write.ReportWriteAttrProvider; * 校验列表 for (int i = 0; i < res_array.length; i++) { ValueVerifier; if (nameObject.getObject() instanceof Verifier) { import com.fr.stable.ArrayUtils; 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 java.util.ArrayList; ValueVerifier; import java.util.ArrayList; import com.fr.report.write.WClassVerifier; import java.util.ArrayList; import com.fr.stable.ArrayUtils; import java.util.ArrayList; import com.fr.stable.Nameable; import java.util.ArrayList; import com.fr.write.ReportWriteAttrProvider; import java.util.ArrayList; import java.util.ArrayList; ValueVerifier; public VerifierListPane(ElementCasePane ePane) { import java.util.ArrayList; /** import java.util.ArrayList; * 校验列表 import java.util.ArrayList; ValueVerifier; /** /** 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; /** /** /** * 校验列表 * 校验列表 * 校验列表 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; * 校验列表 /** * 校验列表 * 校验列表 */ */ 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 class VerifierListPane extends ObjectJControlPane { ValueVerifier; ValueVerifier; public VerifierListPane(ElementCasePane ePane) { } public class VerifierListPane extends ObjectJControlPane { import com.fr.stable.ArrayUtils; ValueVerifier; ValueVerifier; import com.fr.stable.Nameable; public class VerifierListPane extends ObjectJControlPane { import com.fr.write.ReportWriteAttrProvider; public class VerifierListPane extends ObjectJControlPane { public class VerifierListPane extends ObjectJControlPane { import java.util.ArrayList; } public class VerifierListPane extends ObjectJControlPane { /** } public class VerifierListPane extends ObjectJControlPane { * 校验列表 public VerifierListPane(ElementCasePane ePane) { public VerifierListPane(ElementCasePane ePane) { ValueVerifier; public VerifierListPane(ElementCasePane ePane) { import com.fr.report.write.WClassVerifier; public VerifierListPane(ElementCasePane ePane) { import com.fr.stable.ArrayUtils; ValueVerifier; import com.fr.report.write.WClassVerifier; import com.fr.stable.Nameable; public VerifierListPane(ElementCasePane ePane) { import com.fr.write.ReportWriteAttrProvider; public VerifierListPane(ElementCasePane ePane) { public VerifierListPane(ElementCasePane ePane) { import java.util.ArrayList; public VerifierListPane(ElementCasePane ePane) { /** public VerifierListPane(ElementCasePane ePane) { * 校验列表 ValueVerifier; import com.fr.stable.ArrayUtils; verifier); } } } }

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

@ -6,17 +6,16 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.report.VerifierListPane;
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.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.*;
public class ReportWriteAttrPane extends LoadingBasicPane {
private SubmiterListPane submiterListPane;
private SubmitVisitorListPane submiterListPane;
// private ValueVerifierEditPane valueVerifierEditPane;
private VerifierListPane verifierListPane;
private WriteShortCutsPane writeShortCutsPane;
@ -33,7 +32,7 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
// peter: writeSQLAttrList的编辑.
if (submiterListPane == null) {
submiterListPane = new SubmiterListPane(ePane);
submiterListPane = new SubmitVisitorListPane(ePane);
}
// valueVerifierEditPane = new ValueVerifierEditPane();
if (verifierListPane == null) {
@ -44,27 +43,6 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
tabbedPane.addTab(Inter.getLocText("FR-Utils_Submit"), submiterListPane);
tabbedPane.addTab(Inter.getLocText("Verify-Data_Verify"), verifierListPane);
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
@ -77,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);
@ -87,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);

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

@ -1,255 +1,255 @@
package com.fr.design.write.submit;
import com.fr.data.SubmitJob;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.SubmitProvider;
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.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.report.write.SubmitVisitor;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.bridge.StableFactory;
import com.fr.write.BuiltInSQLSubmiterProvider;
import com.fr.write.DBManipulation;
import com.fr.write.ReportWriteAttrProvider;
import com.fr.write.WClassSubmiterProvider;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SubmiterListPane extends ObjectJControlPane {
public SubmiterListPane(ElementCasePane ePane) {
super(ePane);
}
/**
* 创建选项
*
* @return 选项
*/
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
new NameObjectCreator(Inter.getLocText("RWA-BuildIn_SQL"),
"/com/fr/web/images/reportlet.png",
// BuiltInSQLSubmiter.class,
StableFactory.getRegisteredClass(BuiltInSQLSubmiterProvider.TAG),
BuildInSQLPane.class),
new NameObjectCreator(
Inter.getLocText(new String[]{"Custom", "RWA-Submit"}),
"/com/fr/web/images/reportlet.png",
// WClassSubmiter.class,
StableFactory.getRegisteredClass(WClassSubmiterProvider.TAG),
CustomPane.class)
};
}
@Override
protected String title4PopupWindow() {
return "write";
}
public void populate(ReportWriteAttrProvider reportWriteAttr) {
if (reportWriteAttr == null) {
return;
}
List<NameObject> nameObjectList = new ArrayList<NameObject>();
int submiterCount = reportWriteAttr.getSubmitVisitorCount();
for (int i = 0; i < submiterCount; i++) {
SubmitVisitor submiter = reportWriteAttr.getSubmitVisitor(i);
String name = reportWriteAttr.getSubmitVisitorNameList(i);
nameObjectList.add(new NameObject(name, submiter));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
/**
* 更新填报属性
*
* @param reportWriteAttr 报表填报属性
*/
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.clearSubmitVisitors();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
if (nameObject.getObject() instanceof SubmitVisitor) {
reportWriteAttr.addSubmitVisitor(nameObject.getName(), (SubmitVisitor) nameObject.getObject());
}
}
}
public static class BuildInSQLPane extends BasicBeanPane<BuiltInSQLSubmiterProvider> {
protected DBManipulationPane dbManipulationPane;
private BuiltInSQLSubmiterProvider editing;
public BuildInSQLPane() {
}
public BuildInSQLPane(ElementCasePane ePane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
dbManipulationPane = new SmartInsertDBManipulationPane(ePane);
this.add(dbManipulationPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return "builtinsql";
}
@Override
public void populateBean(BuiltInSQLSubmiterProvider ob) {
editing = ob;
DBManipulation dbManipulation = ob.getDBManipulation();
dbManipulationPane.populateBean(dbManipulation);
}
@Override
public BuiltInSQLSubmiterProvider updateBean() {
DBManipulation dbManipulation = dbManipulationPane.updateBean();
//复制对象用于撤销
try{
editing = (BuiltInSQLSubmiterProvider)editing.clone();
}catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
}
editing.setDBManipulation(dbManipulation);
return editing;
}
/**
* 检查是否符合规范
*
* @throws Exception
*/
public void checkValid() throws Exception {
this.dbManipulationPane.checkValid();
}
}
public static class CustomPane extends BasicBeanPane<WClassSubmiterProvider> {
private UIComboBox csjConfigComboBox = null;
private JPanel customCardPane = null;
private Map<String, BasicBeanPane> customSubmitPanes = null;
private final Map<String, String> comboItemsMap;
private List<String> configTypes = null;
private WClassSubmiterProvider editing;
private static final String DEFAULT_PANE_TYPE = "submitnormal";
public CustomPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
customCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
customSubmitPanes = new HashMap<String, BasicBeanPane>();
comboItemsMap = new HashMap<String, String>();
SubmitProvider[] providers = ExtraDesignClassManager.getInstance().getSubmitProviders();
providers = (SubmitProvider[])ArrayUtils.add(providers, new DefaultSubmit());
for (SubmitProvider provider : providers) {
customSubmitPanes.put(provider.keyForSubmit(), provider.appearanceForSubmit());
comboItemsMap.put(provider.keyForSubmit(), provider.dataForSubmit());
}
configTypes = new ArrayList<String>();
for (Map.Entry<String, BasicBeanPane> entry : customSubmitPanes.entrySet()) {
String key = entry.getKey();
configTypes.add(comboItemsMap.get(key));
customCardPane.add(entry.getValue(), key);
}
csjConfigComboBox = new UIComboBox(configTypes.toArray());
JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(Inter.getLocText(new String[]{"Choose", "Type"}) + ":"), csjConfigComboBox},
FlowLayout.LEFT, 10);
typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Type"})));
this.add(typePane, BorderLayout.NORTH);
this.add(customCardPane, BorderLayout.CENTER);
csjConfigComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
Object ob = e.getItem();
CardLayout c1 = (CardLayout) customCardPane.getLayout();
for (String key : customSubmitPanes.keySet()) {
String item = comboItemsMap.get(key);
if ((ComparatorUtils.equals(ob, item))) {
c1.show(customCardPane, key);
}
}
}
}
});
}
@Override
public void populateBean(WClassSubmiterProvider ob) {
editing = ob;
SubmitJob submitJob = ob.getSubmitJob();
if (submitJob == null) {
csjConfigComboBox.setSelectedItem(comboItemsMap.get(DEFAULT_PANE_TYPE));
for (Map.Entry<String, BasicBeanPane> entry : customSubmitPanes.entrySet()) {
entry.getValue().populateBean(submitJob);
}
return;
}
String pantype=submitJob.getJobType();
BasicBeanPane pane = customSubmitPanes.get(pantype);
if (pane != null) {
csjConfigComboBox.setSelectedItem(comboItemsMap.get(pantype));
pane.populateBean(submitJob);
}
}
@Override
public WClassSubmiterProvider updateBean() {
for (Map.Entry<String, BasicBeanPane> entry : customSubmitPanes.entrySet()) {
BasicBeanPane pane = entry.getValue();
if (pane != null && pane.isVisible()) {
editing.setSubmitJob((SubmitJob) pane.updateBean());
}
}
return editing;
}
@Override
protected String title4PopupWindow() {
return "custom";
}
}
package com.fr.design.write.submit;
import com.fr.data.SubmitJob;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.SubmitProvider;
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.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
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.WClassSubmiterProvider;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SubmitVisitorListPane extends ObjectJControlPane {
public SubmitVisitorListPane(ElementCasePane ePane) {
super(ePane);
}
/**
* 创建选项
*
* @return 选项
*/
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
new NameObjectCreator(Inter.getLocText("RWA-BuildIn_SQL"),
"/com/fr/web/images/reportlet.png",
BuiltInSQLSubmiter.class,
BuildInSQLPane.class),
new NameObjectCreator(
Inter.getLocText(new String[]{"Custom", "RWA-Submit"}),
"/com/fr/web/images/reportlet.png",
WClassSubmiter.class,
CustomPane.class)
};
}
@Override
protected String title4PopupWindow() {
return "write";
}
public void populate(ReportWriteAttr reportWriteAttr) {
if (reportWriteAttr == null) {
return;
}
List<NameObject> nameObjectList = new ArrayList<>();
int submiterCount = reportWriteAttr.getSubmitVisitorCount();
for (int i = 0; i < submiterCount; i++) {
SubmitVisitor visitor = reportWriteAttr.getSubmitVisitor(i);
nameObjectList.add(new NameObject(visitor.getName(), visitor));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
/**
* 更新填报属性
*
* @param reportWriteAttr 报表填报属性
*/
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.clearSubmitVisitors();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
if (nameObject.getObject() instanceof SubmitVisitor) {
SubmitVisitor visitor = (SubmitVisitor) nameObject.getObject();
visitor.setName(nameObject.getName());
reportWriteAttr.addSubmitVisitor(visitor);
}
}
}
public static class BuildInSQLPane extends BasicBeanPane<BuiltInSQLSubmiterProvider> {
protected DBManipulationPane dbManipulationPane;
private BuiltInSQLSubmiterProvider editing;
public BuildInSQLPane() {
}
public BuildInSQLPane(ElementCasePane ePane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
dbManipulationPane = new SmartInsertDBManipulationPane(ePane);
this.add(dbManipulationPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return "builtinsql";
}
@Override
public void populateBean(BuiltInSQLSubmiterProvider ob) {
editing = ob;
DBManipulation dbManipulation = ob.getDBManipulation();
dbManipulationPane.populateBean(dbManipulation);
}
@Override
public BuiltInSQLSubmiterProvider updateBean() {
DBManipulation dbManipulation = dbManipulationPane.updateBean();
//复制对象用于撤销
try {
editing = (BuiltInSQLSubmiterProvider) editing.clone();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
editing.setDBManipulation(dbManipulation);
return editing;
}
/**
* 检查是否符合规范
*
* @throws Exception
*/
public void checkValid() throws Exception {
this.dbManipulationPane.checkValid();
}
}
public static class CustomPane extends BasicBeanPane<WClassSubmiterProvider> {
private UIComboBox csjConfigComboBox = null;
private JPanel customCardPane = null;
private Map<String, BasicBeanPane> customSubmitPanes = null;
private final Map<String, String> comboItemsMap;
private List<String> configTypes = null;
private WClassSubmiterProvider editing;
private static final String DEFAULT_PANE_TYPE = "submitnormal";
public CustomPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
customCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
customSubmitPanes = new HashMap<String, BasicBeanPane>();
comboItemsMap = new HashMap<String, String>();
SubmitProvider[] providers = ExtraDesignClassManager.getInstance().getSubmitProviders();
providers = (SubmitProvider[]) ArrayUtils.add(providers, new DefaultSubmit());
for (SubmitProvider provider : providers) {
customSubmitPanes.put(provider.keyForSubmit(), provider.appearanceForSubmit());
comboItemsMap.put(provider.keyForSubmit(), provider.dataForSubmit());
}
configTypes = new ArrayList<String>();
for (Map.Entry<String, BasicBeanPane> entry : customSubmitPanes.entrySet()) {
String key = entry.getKey();
configTypes.add(comboItemsMap.get(key));
customCardPane.add(entry.getValue(), key);
}
csjConfigComboBox = new UIComboBox(configTypes.toArray());
JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(Inter.getLocText(new String[]{"Choose", "Type"}) + ":"), csjConfigComboBox},
FlowLayout.LEFT, 10);
typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Type"})));
this.add(typePane, BorderLayout.NORTH);
this.add(customCardPane, BorderLayout.CENTER);
csjConfigComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
Object ob = e.getItem();
CardLayout c1 = (CardLayout) customCardPane.getLayout();
for (String key : customSubmitPanes.keySet()) {
String item = comboItemsMap.get(key);
if ((ComparatorUtils.equals(ob, item))) {
c1.show(customCardPane, key);
}
}
}
}
});
}
@Override
public void populateBean(WClassSubmiterProvider ob) {
editing = ob;
SubmitJob submitJob = ob.getSubmitJob();
if (submitJob == null) {
csjConfigComboBox.setSelectedItem(comboItemsMap.get(DEFAULT_PANE_TYPE));
for (Map.Entry<String, BasicBeanPane> entry : customSubmitPanes.entrySet()) {
entry.getValue().populateBean(submitJob);
}
return;
}
String pantype = submitJob.getJobType();
BasicBeanPane pane = customSubmitPanes.get(pantype);
if (pane != null) {
csjConfigComboBox.setSelectedItem(comboItemsMap.get(pantype));
pane.populateBean(submitJob);
}
}
@Override
public WClassSubmiterProvider updateBean() {
for (Map.Entry<String, BasicBeanPane> entry : customSubmitPanes.entrySet()) {
BasicBeanPane pane = entry.getValue();
if (pane != null && pane.isVisible()) {
editing.setSubmitJob((SubmitJob) pane.updateBean());
}
}
return editing;
}
@Override
protected String title4PopupWindow() {
return "custom";
}
}
}
Loading…
Cancel
Save