diff --git a/designer/src/com/fr/design/report/ExcelExportPane.java b/designer/src/com/fr/design/report/ExcelExportPane.java index 9b97c2e8e..f2b699f3b 100644 --- a/designer/src/com/fr/design/report/ExcelExportPane.java +++ b/designer/src/com/fr/design/report/ExcelExportPane.java @@ -4,8 +4,10 @@ package com.fr.design.report; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import com.fr.design.fun.AbstractExportPane; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; + +import javax.swing.*; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itextfield.UITextField; @@ -32,7 +34,7 @@ public class ExcelExportPane extends BasicPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JPanel outnorthPane =FRGUIPaneFactory.createTitledBorderPane("Excel" + Inter.getLocText("ReportD-Excel_Export")); JPanel northPane=FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); this.add(outnorthPane); diff --git a/designer/src/com/fr/design/report/PDFExportPane.java b/designer/src/com/fr/design/report/PDFExportPane.java index 8e5e7c64c..d66ded01a 100644 --- a/designer/src/com/fr/design/report/PDFExportPane.java +++ b/designer/src/com/fr/design/report/PDFExportPane.java @@ -4,7 +4,7 @@ package com.fr.design.report; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JPanel; +import javax.swing.*; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -26,7 +26,7 @@ public class PDFExportPane extends BasicPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JPanel outnorthPane =FRGUIPaneFactory.createTitledBorderPane("PDF" + Inter.getLocText("ReportD-Excel_Export")); JPanel northPane=FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); this.add(outnorthPane); diff --git a/designer/src/com/fr/design/report/ReportExportAttrPane.java b/designer/src/com/fr/design/report/ReportExportAttrPane.java index 4819d9ff7..93a690bb9 100644 --- a/designer/src/com/fr/design/report/ReportExportAttrPane.java +++ b/designer/src/com/fr/design/report/ReportExportAttrPane.java @@ -1,67 +1,89 @@ package com.fr.design.report; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; +import javax.swing.*; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.AbstractExportPane; +import com.fr.design.fun.ExportAttrTabProvider; +import com.fr.design.gui.frpane.UITabbedPane; import com.fr.general.Inter; import com.fr.io.attr.ReportExportAttr; +import java.util.ArrayList; +import java.util.List; + public class ReportExportAttrPane extends BasicPane { - private ExcelExportPane excelExportPane; - private PDFExportPane pdfExportPane; - private WordExportPane wordExportPane; - - public ReportExportAttrPane() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - excelExportPane = new ExcelExportPane(); - this.add(excelExportPane); - pdfExportPane = new PDFExportPane(); - this.add(pdfExportPane); - wordExportPane = new WordExportPane(); - this.add(wordExportPane); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("ReportD-Excel_Export"); - } - - public void populate(ReportExportAttr reportExportAttr) { - if (reportExportAttr == null) { - reportExportAttr = new ReportExportAttr(); - } - - if (this.excelExportPane != null) { - this.excelExportPane.populate(reportExportAttr.getExcelExportAttr()); - } - - if (this.pdfExportPane != null) { - this.pdfExportPane.populate(reportExportAttr.getPDFExportAttr()); - } - - if (this.wordExportPane != null) { - this.wordExportPane.populate(reportExportAttr.getWordExportAttr()); - } - } - - public ReportExportAttr update() { - - ReportExportAttr reportExportAttr = new ReportExportAttr(); - if (this.excelExportPane != null) { - reportExportAttr.setExcelExportAttr(this.excelExportPane.update()); - } - - if (this.pdfExportPane != null) { - reportExportAttr.setPDFExportAttr(this.pdfExportPane.update()); - } - - if (this.wordExportPane != null) { - reportExportAttr.setWordExportAttr(this.wordExportPane.update()); - } - - return reportExportAttr; - } + private ExcelExportPane excelExportPane; + private PDFExportPane pdfExportPane; + private WordExportPane wordExportPane; + private List paneList; + + public ReportExportAttrPane() { + UITabbedPane uiTabbedPane = new UITabbedPane(); + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + excelExportPane = new ExcelExportPane(); + uiTabbedPane.addTab("Excel", excelExportPane); + pdfExportPane = new PDFExportPane(); + uiTabbedPane.addTab("PDF", pdfExportPane); + wordExportPane = new WordExportPane(); + uiTabbedPane.addTab("Word", wordExportPane); + ExportAttrTabProvider[] providers = ExtraDesignClassManager.getInstance().getExportAttrTabProviders(); + paneList = new ArrayList(); + for (ExportAttrTabProvider provider : providers) { + uiTabbedPane.addTab(provider.title(), provider.toSwingComponent()); + paneList.add(provider.toExportPane()); + } + this.add(uiTabbedPane); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("ReportD-Excel_Export"); + } + + public void populate(ReportExportAttr reportExportAttr) { + if (reportExportAttr == null) { + reportExportAttr = new ReportExportAttr(); + } + + if (this.excelExportPane != null) { + this.excelExportPane.populate(reportExportAttr.getExcelExportAttr()); + } + + if (this.pdfExportPane != null) { + this.pdfExportPane.populate(reportExportAttr.getPDFExportAttr()); + } + + if (this.wordExportPane != null) { + this.wordExportPane.populate(reportExportAttr.getWordExportAttr()); + } + + for (AbstractExportPane exportpane : paneList) { + exportpane.populate(reportExportAttr); + } + } + + public ReportExportAttr update() { + + ReportExportAttr reportExportAttr = new ReportExportAttr(); + if (this.excelExportPane != null) { + reportExportAttr.setExcelExportAttr(this.excelExportPane.update()); + } + + if (this.pdfExportPane != null) { + reportExportAttr.setPDFExportAttr(this.pdfExportPane.update()); + } + + if (this.wordExportPane != null) { + reportExportAttr.setWordExportAttr(this.wordExportPane.update()); + } + + for (AbstractExportPane exportPane : paneList) { + exportPane.update(reportExportAttr); + } + return reportExportAttr; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/report/WordExportPane.java b/designer/src/com/fr/design/report/WordExportPane.java index e220583ea..aa58795d2 100644 --- a/designer/src/com/fr/design/report/WordExportPane.java +++ b/designer/src/com/fr/design/report/WordExportPane.java @@ -4,7 +4,7 @@ package com.fr.design.report; import java.awt.Color; import java.awt.Dimension; -import javax.swing.JPanel; +import javax.swing.*; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.MultilineLabel; @@ -23,7 +23,7 @@ public class WordExportPane extends BasicPane { protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JPanel outnorthPane =FRGUIPaneFactory.createTitledBorderPane("Word" + Inter.getLocText("ReportD-Excel_Export")); this.add(outnorthPane); diff --git a/designer_base/src/com/fr/design/ExtraDesignClassManager.java b/designer_base/src/com/fr/design/ExtraDesignClassManager.java index a861772c9..7099bf3a0 100644 --- a/designer_base/src/com/fr/design/ExtraDesignClassManager.java +++ b/designer_base/src/com/fr/design/ExtraDesignClassManager.java @@ -132,6 +132,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi private Set widgetAttrProviders; + private Set exportAttrTabProviders; + public TableDataTreePaneProcessor getTableDataTreePaneProcessor() { return tableDataTreePaneProcessor; } @@ -753,6 +755,21 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi widgetAttrProviders.add((WidgetAttrProvider) level); } + public ExportAttrTabProvider[] getExportAttrTabProviders() { + if (exportAttrTabProviders == null) { + return new ExportAttrTabProvider[0]; + } + return exportAttrTabProviders.toArray(new ExportAttrTabProvider[exportAttrTabProviders.size()]); + } + + public void addExportAttrTabProvider(Level level, PluginSimplify simplify) throws Exception { + if (exportAttrTabProviders == null) { + exportAttrTabProviders = new HashSet(); + } + validAPILevel(level, ExportAttrTabProvider.CURRENT_LEVEL, simplify.getPluginName()); + exportAttrTabProviders.add((ExportAttrTabProvider) level); + } + /** * 文件名 * @@ -847,6 +864,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi addElementUIProvider(impl, simplify); } else if (tagName.equals(WidgetAttrProvider.XML_TAG)) { addWidgetAttrProvider(impl, simplify); + } else if (tagName.equals(ExportAttrTabProvider.XML_TAG)) { + addExportAttrTabProvider(impl, simplify); } } catch (PluginInvalidLevelException e) { PluginMessage.remindUpdate(e.getMessage()); diff --git a/designer_base/src/com/fr/design/fun/AbstractExportPane.java b/designer_base/src/com/fr/design/fun/AbstractExportPane.java new file mode 100644 index 000000000..bb585a02d --- /dev/null +++ b/designer_base/src/com/fr/design/fun/AbstractExportPane.java @@ -0,0 +1,13 @@ +package com.fr.design.fun; + +import com.fr.design.dialog.BasicPane; + +/** + * Created by vito on 16/5/5. + */ +public abstract class AbstractExportPane extends BasicPane { + + public abstract void populate(Object t); + + public abstract void update(Object t); +} diff --git a/designer_base/src/com/fr/design/fun/ExportAttrTabProvider.java b/designer_base/src/com/fr/design/fun/ExportAttrTabProvider.java new file mode 100644 index 000000000..d16db4ea1 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/ExportAttrTabProvider.java @@ -0,0 +1,22 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.Level; + +import javax.swing.*; + +/** + * Created by vito on 16/5/5. + */ +public interface ExportAttrTabProvider extends Level{ + String XML_TAG = "ExportAttrTabProvider"; + + int CURRENT_LEVEL = 1; + + JComponent toSwingComponent(); + + AbstractExportPane toExportPane(); + + String title(); + + String tag(); +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractExportAttrTabProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractExportAttrTabProvider.java new file mode 100644 index 000000000..f1654ff6b --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractExportAttrTabProvider.java @@ -0,0 +1,19 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.ExportAttrTabProvider; +import com.fr.stable.fun.impl.AbstractProvider; + +/** + * Created by vito on 16/5/5. + */ +public abstract class AbstractExportAttrTabProvider extends AbstractProvider implements ExportAttrTabProvider { + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return this.getClass().getName(); + } +}