From 76c2166ef58c5d6deff8d192feccaab47fc25dbb Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 27 Aug 2018 17:15:41 +0800 Subject: [PATCH] =?UTF-8?q?CHART-2802=20=E5=A4=A7=E5=B1=8F=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20=E6=8E=A5=E5=8F=A3=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 8 ++++ .../chart/gui/data/TableDataPane.java | 14 +++--- .../AbstractExtendedChartReportDataPane.java | 19 ++++---- .../AbstractExtendedChartTableDataPane.java | 28 +++++++----- .../chart/AbstractExtendedStylePane.java | 28 ++++++++++-- .../fr/extended/chart/ExtendedOtherPane.java | 44 ++++++++++++------- .../data/link/GanttLinkTableDataPane.java | 4 +- 7 files changed, 97 insertions(+), 48 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 06e74b39ca..5d54adff73 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -278,6 +278,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } return name; } + + public String getTitle4PopupWindow(String plotID) { + IndependentChartUIProvider provider = getChartTypeInterface(plotID); + if (provider != null) { + return provider.getPlotTypeTitle4PopupWindow(); + } + return StringUtils.EMPTY; + } /** * 获取指定图表的标题 diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index da79f2691b..5248fb08b1 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe.chart.gui.data; import com.fr.base.TableData; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.TableDataDefinition; import com.fr.chart.chartdata.TopDefinition; import com.fr.data.impl.NameTableData; @@ -14,9 +14,9 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import java.awt.BorderLayout; +import java.awt.Dimension; public class TableDataPane extends FurtherBasicBeanPane{ private static final long serialVersionUID = 4740461028440155147L; @@ -72,8 +72,8 @@ public class TableDataPane extends FurtherBasicBeanPane{ } } - protected AbstractTableDataContentPane getContentPane(Plot plot) { - return ChartTypeInterfaceManager.getInstance().getTableDataSourcePane(plot, parent); + protected AbstractTableDataContentPane getContentPane(Chart chart) { + return ChartTypeInterfaceManager.getInstance().getTableDataSourcePane(chart.getPlot(), parent); } /** @@ -106,7 +106,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ * @param collection 图表属性的集合 */ public void refreshContentPane(ChartCollection collection) { - refreshContentPane(getContentPane(collection.getSelectedChart().getPlot())); + refreshContentPane(getContentPane(collection.getSelectedChart())); } protected void refreshContentPane(AbstractTableDataContentPane contentPane) { diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java index c633fa755f..9e4a84f038 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java @@ -58,17 +58,20 @@ public abstract class AbstractExtendedChartReportDataPane extends this.listener = listener; } + protected void setChart(Chart chart) { + if (chart instanceof AbstractChart) { + this.chart = (T) chart; + } + } + + protected T getChart() { + return this.chart; + } + + protected AttributeChangeListener getListener() { + return this.listener; + } + @Override protected JPanel createContentPane() { @@ -95,8 +109,11 @@ public abstract class AbstractExtendedStylePane extends if (collection != null) { Chart chart = collection.getSelectedChart(); - if (chart != null && chart instanceof AbstractChart){ - this.chart = (T)chart; + if (chart != null) { + setChart(chart); + } + + if (this.chart != null) { paneList.get(tabPane.getSelectedIndex()).populateBean(this.chart); } @@ -109,8 +126,11 @@ public abstract class AbstractExtendedStylePane extends if (collection != null) { Chart chart = collection.getSelectedChart(); - if (chart != null && chart instanceof AbstractChart){ - this.chart = (T)chart; + if (chart != null) { + setChart(chart); + } + + if (this.chart != null) { paneList.get(tabPane.getSelectedIndex()).updateBean(this.chart); } diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java index e2e3e67c4b..a92e100e53 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java @@ -9,7 +9,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.PaneTitleConstants; - import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -28,29 +27,42 @@ public class ExtendedOtherPane extends AbstractChartAttrPane { private UISpinner autoRefreshTime; private JPanel contentPane; + protected AbstractChart getAbstractChart(Chart chart) { + if (chart != null && chart instanceof AbstractChart) { + return (AbstractChart) chart; + } + return null; + } + @Override public void populate(ChartCollection collection) { - if (collection != null) { - Chart chart = collection.getSelectedChart(); - if (chart != null && chart instanceof AbstractChart) { - hyperLinkPane.populateBean((AbstractChart) chart); - autoRefreshTime.setValue(((AbstractChart) chart).getAutoRefreshTime()); - refreshEnabled.setSelectedIndex(((AbstractChart) chart).isRefreshEnabled() ? 0 : 1); - checkRefreshEnable(); - } + if (collection == null || collection.getSelectedChart() == null) { + return; + } + + AbstractChart chart = getAbstractChart(collection.getSelectedChart()); + + if (chart != null) { + hyperLinkPane.populateBean(chart); + autoRefreshTime.setValue(chart.getAutoRefreshTime()); + refreshEnabled.setSelectedIndex(chart.isRefreshEnabled() ? 0 : 1); + checkRefreshEnable(); } } @Override public void update(ChartCollection collection) { - if (collection != null) { - Chart chart = collection.getSelectedChart(); - if (chart != null && chart instanceof AbstractChart) { - hyperLinkPane.updateBean((AbstractChart) chart); - ((AbstractChart) chart).setAutoRefreshTime(autoRefreshTime.getValue()); - ((AbstractChart) chart).setRefreshEnabled(refreshEnabled.getSelectedIndex() == 0); - } + if (collection == null || collection.getSelectedChart() == null) { + return; + } + + AbstractChart chart = getAbstractChart(collection.getSelectedChart()); + + if (chart != null) { + hyperLinkPane.updateBean(chart); + chart.setAutoRefreshTime(autoRefreshTime.getValue()); + chart.setRefreshEnabled(refreshEnabled.getSelectedIndex() == 0); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/link/GanttLinkTableDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/link/GanttLinkTableDataPane.java index 992d13d54e..56e2381312 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/link/GanttLinkTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/link/GanttLinkTableDataPane.java @@ -1,6 +1,6 @@ package com.fr.van.chart.gantt.designer.data.link; -import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.Chart; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.TableDataPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; @@ -14,7 +14,7 @@ public class GanttLinkTableDataPane extends TableDataPane { } @Override - protected AbstractTableDataContentPane getContentPane(Plot plot) { + protected AbstractTableDataContentPane getContentPane(Chart chart) { return new GanttLinkTableDataContentPane(); } }