diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index c67a6aea57..1fd230b504 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -11,6 +11,7 @@ import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.chartinterface.*; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.AbstractChartAttrPane; @@ -409,6 +410,21 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane parent) { return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); } + public BasicPane getChartConfigPane(Plot plot, ChartDataPane parent) { + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry entry = (Map.Entry) iterator.next(); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getChartConfigPane(priority, plot, parent); + } + } + return getChartConfigPane(ChartTypeManager.CHART_PRIORITY, plot, parent); + } + + private BasicBeanPane getChartConfigPane(String priority, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getChartConfigPane(plot, parent); + } public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { diff --git a/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java b/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java index 1b90382d6a..009da81896 100644 --- a/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java +++ b/designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java @@ -89,5 +89,6 @@ public interface IndependentChartUIProvider extends Level { */ String getPlotTypeTitle4PopupWindow(); + BasicBeanPane getChartConfigPane(Plot plot, ChartDataPane parent); } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java index a44efb38c1..bcc892b2f3 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java @@ -53,4 +53,6 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr public ConditionAttributesPane getPlotConditionPane(Plot plot){ return new DataSeriesConditionPane(); } + public BasicBeanPane getChartConfigPane(Plot plot, ChartDataPane parent){ return null;} + } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java index 17451bb874..7cc82a99c7 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java @@ -6,13 +6,12 @@ import com.fr.design.chart.fun.IndependentChartUIProvider; import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.CustomChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; -import com.fr.design.mainframe.chart.gui.data.report.PiePlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; -import com.fr.design.mainframe.chart.gui.data.table.PiePlotTableDataContentPane; -import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.general.ComparatorUtils; /** @@ -23,6 +22,11 @@ public abstract class AbstractIndependentChartUI4Custom implements IndependentCh int CURRENT_API_LEVEL = 3; + @Override + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new CustomChartDataPane(listener); + } + @Override public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { return null; @@ -50,8 +54,8 @@ public abstract class AbstractIndependentChartUI4Custom implements IndependentCh } @Override - public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new ChartDataPane(listener); + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + return new AbstractChartAttrPane[]{}; } @Override @@ -62,7 +66,7 @@ public abstract class AbstractIndependentChartUI4Custom implements IndependentCh @Override public String getIconPath() { - return "com/fr/solution/plugin/chart/echarts/pie/images/pie.png"; + return "com/fr/design/images/form/toolbar/ChartF-Column.png"; } @Override diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index ff0eaa81db..d49d3d465b 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -65,4 +65,6 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ public String getPlotTypeTitle4PopupWindow(){ return getPlotTypePane().title4PopupWindow(); } + + public BasicBeanPane getChartConfigPane(Plot plot, ChartDataPane parent){ return null;} } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java index 9e03f4ec07..ccccdc3cc1 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -28,7 +28,7 @@ public class ChartDataPane extends AbstractChartAttrPane { super(); this.listener = listener; } - + @Override protected JPanel createContentPane() { contentsPane = new NormalChartDataPane(listener, ChartDataPane.this); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/CustomChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/CustomChartDataPane.java new file mode 100644 index 0000000000..78dc912ac7 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/CustomChartDataPane.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe.chart.gui; + + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.data.CustomChartDataContentsPane; + +import javax.swing.*; +import java.awt.*; + + +/** + * Created by mengao on 2017/4/26. + */ +public class CustomChartDataPane extends ChartDataPane { + private boolean supportCellData = true; + + public CustomChartDataPane(AttributeChangeListener listener) { + super(listener); + this.listener = listener; + } + + @Override + protected JPanel createContentPane() { + contentsPane = new CustomChartDataContentsPane(listener, CustomChartDataPane.this); + return contentsPane; + } + + protected void repeatLayout(ChartCollection collection) { + Plot plot =collection.getSelectedChart().getPlot(); + if (contentsPane != null) { + this.remove(contentsPane); + } + + this.setLayout(new BorderLayout(0, 0)); + contentsPane = new CustomChartDataContentsPane(listener, CustomChartDataPane.this ,plot); + + if (contentsPane != null) { + contentsPane.setSupportCellData(supportCellData); + } + } + +} diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/CustomChartDataContentsPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/CustomChartDataContentsPane.java new file mode 100644 index 0000000000..d7d253feb3 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/CustomChartDataContentsPane.java @@ -0,0 +1,157 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; + +/** + * Created by mengao on 2017/4/26. + */ +public class CustomChartDataContentsPane extends DataContentsPane { + + + public UIComboBoxPane dataPane; + private TableDataPane tableDataPane; + private ReportDataPane reportDataPane; + private BasicBeanPane configPane; + private AttributeChangeListener listener; + private Plot plot; + + private ChartDataPane parent; + + public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent) { + this.listener = listener; + this.parent = parent; + initAll(); + } + + + public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent, boolean supportCellData) { + this.listener = listener; + this.parent = parent; + initAll(); + dataPane.justSupportOneSelect(true); + } + + public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent, Plot plot) { + this.listener = listener; + this.parent = parent; + this.plot= plot; + initAll(); + } + + + public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent, boolean supportCellData, Plot plot) { + this.listener = listener; + this.parent = parent; + this.plot= plot; + initAll(); + dataPane.justSupportOneSelect(true); + } + + public UIComboBoxPane getDataPane() { + return dataPane; + } + + @Override + protected JPanel createContentPane() { + return new BasicScrollPane() { + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + dataPane = new UIComboBoxPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6)); + JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); + JButton jButton = new JButton(); + if(plot!=null){ + configPane = (BasicBeanPane)ChartTypeInterfaceManager.getInstance().getChartConfigPane(plot, parent); + northPane.add(configPane, BorderLayout.CENTER); + }else { + northPane.add(jButton, BorderLayout.CENTER); + + } + this.add(northPane, BorderLayout.NORTH); + + } + + @Override + protected String title4PopupWindow() { + return null; + } + + @Override + protected java.util.List> initPaneList() { + tableDataPane = getTableDataPane(parent); + reportDataPane = getReportDataPane(parent); + java.util.List> paneList = new ArrayList>(); + paneList.add(tableDataPane); + paneList.add(reportDataPane); + return paneList; + } + }; + contentPane.add(dataPane, BorderLayout.CENTER); + dataPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + return contentPane; + } + + @Override + protected String title4PopupWindow() { + return ""; + } + + @Override + public void populateBean(ChartCollection ob) { + + } + }; + + } + + protected ReportDataPane getReportDataPane(ChartDataPane parent) { + return new ReportDataPane(parent); + } + + protected TableDataPane getTableDataPane(ChartDataPane chartDataPane) { + return new TableDataPane(chartDataPane); + } + + /** + * 更新界面 数据内容 + */ + public void populate(ChartCollection collection) { + Plot plot = collection.getSelectedChart().getPlot(); + dataPane.populateBean(collection); + configPane.populateBean(plot); + } + + /** + * 保存 数据界面内容 + */ + public void update(ChartCollection collection) { + Plot plot = collection.getSelectedChart().getPlot(); + configPane.updateBean(plot); + dataPane.updateBean(collection); + configPane.updateBean(); + } + + /** + * 是否支持单元格数据 + */ + public void setSupportCellData(boolean supportCellData) { + dataPane.justSupportOneSelect(supportCellData); + } + +}