Browse Source

改成循环存取

master
vito 9 years ago
parent
commit
f7229f3608
  1. 24
      designer/src/com/fr/design/report/ReportExportAttrPane.java
  2. 12
      designer_base/src/com/fr/design/fun/AbstractExportPane.java

24
designer/src/com/fr/design/report/ReportExportAttrPane.java

@ -8,18 +8,17 @@ import com.fr.design.fun.AbstractExportPane;
import com.fr.design.fun.ExportAttrTabProvider; import com.fr.design.fun.ExportAttrTabProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.io.attr.ImageExportAttr;
import com.fr.io.attr.ReportExportAttr; import com.fr.io.attr.ReportExportAttr;
import java.util.HashMap; import java.util.ArrayList;
import java.util.Map; import java.util.List;
public class ReportExportAttrPane extends BasicPane { public class ReportExportAttrPane extends BasicPane {
private ExcelExportPane excelExportPane; private ExcelExportPane excelExportPane;
private PDFExportPane pdfExportPane; private PDFExportPane pdfExportPane;
private WordExportPane wordExportPane; private WordExportPane wordExportPane;
Map<String, AbstractExportPane> paneMap; List<AbstractExportPane> paneList;
public ReportExportAttrPane() { public ReportExportAttrPane() {
UITabbedPane uiTabbedPane = new UITabbedPane(); UITabbedPane uiTabbedPane = new UITabbedPane();
@ -32,10 +31,10 @@ public class ReportExportAttrPane extends BasicPane {
wordExportPane = new WordExportPane(); wordExportPane = new WordExportPane();
uiTabbedPane.addTab("Word", wordExportPane); uiTabbedPane.addTab("Word", wordExportPane);
ExportAttrTabProvider[] providers = ExtraDesignClassManager.getInstance().getExportAttrTabProviders(); ExportAttrTabProvider[] providers = ExtraDesignClassManager.getInstance().getExportAttrTabProviders();
paneMap = new HashMap<String, AbstractExportPane>(); paneList = new ArrayList<AbstractExportPane>();
for (ExportAttrTabProvider provider : providers) { for (ExportAttrTabProvider provider : providers) {
uiTabbedPane.addTab(provider.title(), provider.toSwingComponent()); uiTabbedPane.addTab(provider.title(), provider.toSwingComponent());
paneMap.put(provider.tag(), provider.toExportPane()); paneList.add(provider.toExportPane());
} }
this.add(uiTabbedPane); this.add(uiTabbedPane);
} }
@ -62,9 +61,8 @@ public class ReportExportAttrPane extends BasicPane {
this.wordExportPane.populate(reportExportAttr.getWordExportAttr()); this.wordExportPane.populate(reportExportAttr.getWordExportAttr());
} }
AbstractExportPane exportPane = paneMap.get("Image"); for (AbstractExportPane exportpane : paneList) {
if(exportPane != null){ exportpane.populate(reportExportAttr);
exportPane.populate(reportExportAttr.getImageExportAttr());
} }
} }
@ -83,9 +81,11 @@ public class ReportExportAttrPane extends BasicPane {
reportExportAttr.setWordExportAttr(this.wordExportPane.update()); reportExportAttr.setWordExportAttr(this.wordExportPane.update());
} }
AbstractExportPane exportPane = paneMap.get("Image"); for (AbstractExportPane exportPane : paneList) {
if(exportPane != null){ ReportExportAttr exportAttr = exportPane.update(reportExportAttr, ReportExportAttr.class);
reportExportAttr.setImageExportAttr(exportPane.update(ImageExportAttr.class)); if (exportAttr != null) {
reportExportAttr = exportAttr;
}
} }
return reportExportAttr; return reportExportAttr;
} }

12
designer_base/src/com/fr/design/fun/AbstractExportPane.java

@ -9,16 +9,10 @@ public abstract class AbstractExportPane extends BasicPane {
public abstract void populate(Object t); public abstract void populate(Object t);
public abstract Object update(); public abstract Object update(Object t);
// public <T> void populate(Object object,Class<? extends T> clazz){ public <T> T update(Object t,Class<? extends T> clazz){
// if(object.getClass().isAssignableFrom(clazz)){ Object object = this.update(t);
// this.populate(clazz.cast(object));
// }
// }
public <T> T update(Class<? extends T> clazz){
Object object = this.update();
if(object == null){ if(object == null){
return null; return null;
} }

Loading…
Cancel
Save