From e93938a18cfe2b2f231038124ee9d08c578be2fe Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Wed, 13 Nov 2019 10:41:56 +0800 Subject: [PATCH] =?UTF-8?q?CHART-11093=20refactor=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/chartx/CustomChartDataPane.java | 5 +++-- .../BubbleIndependentVanChartInterface.java | 19 ++++++++++++++++++ .../FunnelIndependentVanChartInterface.java | 11 ++++++++++ .../GaugeIndependentVanChartInterface.java | 20 +++++++++++++++++++ .../MultiPieIndependentVanChartInterface.java | 2 +- .../ScatterIndependentVanChartInterface.java | 11 ++++++++++ .../desinger/VanStructureChartTypeUI.java | 12 +++++++++++ .../AbstractIndependentVanChartUI.java | 11 ++++++++++ .../AbstractMultiCategoryVanChartUI.java | 11 ++++++++++ ...WordCloudIndependentVanChartInterface.java | 12 +++++++++++ 10 files changed, 111 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java index bb63ac805..9ff8fd28c 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java @@ -3,6 +3,8 @@ package com.fr.design.chartx; import com.fr.chart.chartattr.ChartCollection; import com.fr.chartx.data.AbstractDataDefinition; import com.fr.chartx.data.CustomChartDataDefinition; +import com.fr.design.chartx.fields.diff.GaugeCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.GaugeDataSetFieldsPane; import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane; import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane; import com.fr.design.chartx.fields.diff.ScatterCellDataFieldsPane; @@ -86,8 +88,7 @@ public class CustomChartDataPane extends ChartDataPane { case RING: case SLOT: case CUVETTE: - //todo 仪表板没写好 - return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + return new SingleDataPane(new GaugeDataSetFieldsPane(), new GaugeCellDataFieldsPane()); case SCATTER: case BUBBLE: return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java index a00423ad7..1dd5a9d39 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java @@ -3,6 +3,9 @@ package com.fr.van.chart.bubble; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.ScatterCellDataFieldsPane; @@ -143,6 +146,22 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh super.populate(collection); } + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null) { + if (plot != null && plot.isForceBubble()) { + if (!(dataDefinition.getColumnFieldCollection() instanceof MultiCategoryColumnFieldCollection)) { + dataDefinition.setColumnFieldCollection(new MultiCategoryColumnFieldCollection()); + } + } else { + if (!(dataDefinition.getColumnFieldCollection() instanceof BubbleColumnFieldCollection)) { + dataDefinition.setColumnFieldCollection(new BubbleColumnFieldCollection()); + } + } + } + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { if (plot != null && plot.isForceBubble()) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java index c45aa17c3..b5bfe7c70 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java @@ -2,6 +2,8 @@ package com.fr.van.chart.funnel.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.FunnelCellDataFieldsPane; @@ -97,6 +99,15 @@ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanCh @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { + + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof ColumnFieldCollectionWithSeriesValue)){ + dataDefinition.setColumnFieldCollection(new ColumnFieldCollectionWithSeriesValue()); + } + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new FunnelDataSetFieldsPane(), new FunnelCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java index d19ea6a46..6641ba3b3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java @@ -2,6 +2,9 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.GaugeCellDataFieldsPane; @@ -136,6 +139,23 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha super.populate(collection); } + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null) { + if (gaugePlot != null && !gaugePlot.isMultiPointer()) { + if (!(dataDefinition.getColumnFieldCollection() instanceof GaugeColumnFieldCollection)){ + dataDefinition.setColumnFieldCollection(new GaugeColumnFieldCollection()); + } + } else{ + if (!(dataDefinition.getColumnFieldCollection() instanceof MultiCategoryColumnFieldCollection)){ + dataDefinition.setColumnFieldCollection(new MultiCategoryColumnFieldCollection()); + } + } + } + + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { if (gaugePlot != null && !gaugePlot.isMultiPointer()) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index 2652c3074..865af7e81 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -50,7 +50,7 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan @Override protected void populate(AbstractDataDefinition dataDefinition) { - if (!(dataDefinition.getColumnFieldCollection() instanceof MultiPieColumnFieldCollection)) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof MultiPieColumnFieldCollection)) { dataDefinition.setColumnFieldCollection(new MultiPieColumnFieldCollection()); } super.populate(dataDefinition); diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java index 7d3a7df48..9182800b0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java @@ -3,6 +3,8 @@ package com.fr.van.chart.scatter; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.ScatterCellDataFieldsPane; @@ -111,6 +113,15 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { + + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof BubbleColumnFieldCollection)) { + dataDefinition.setColumnFieldCollection(new BubbleColumnFieldCollection()); + } + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java index 19f5abd5a..e213f5914 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java @@ -2,6 +2,8 @@ package com.fr.van.chart.structure.desinger; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.StructureColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.StructureCellDataFieldsPane; @@ -106,6 +108,16 @@ public class VanStructureChartTypeUI extends AbstractIndependentVanChartUI { @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { + + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof StructureColumnFieldCollection)) { + dataDefinition.setColumnFieldCollection(new StructureColumnFieldCollection()); + } + + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new StructureDataSetFieldsPane(), new StructureCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java index 39e22492f..2ebd1aafa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java @@ -1,6 +1,8 @@ package com.fr.van.chart.vanchart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.design.chart.fun.impl.AbstractIndependentChartUIWithAPILevel; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.SingleCategoryCellDataFieldsPane; @@ -54,6 +56,15 @@ public abstract class AbstractIndependentVanChartUI extends AbstractIndependentC @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { + + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof MultiCategoryColumnFieldCollection)) { + dataDefinition.setColumnFieldCollection(new MultiCategoryColumnFieldCollection()); + } + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java index 6cd2743fe..a06b8ee7d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java @@ -2,6 +2,8 @@ package com.fr.van.chart.vanchart; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane; @@ -68,6 +70,15 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependen @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { + + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof MultiCategoryColumnFieldCollection)) { + dataDefinition.setColumnFieldCollection(new MultiCategoryColumnFieldCollection()); + } + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java index 2e1056ae8..8e7ca2070 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java @@ -2,6 +2,8 @@ package com.fr.van.chart.wordcloud.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.field.diff.WordCloudColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.WordCloudCellDataFieldsPane; @@ -115,6 +117,16 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { + + @Override + protected void populate(AbstractDataDefinition dataDefinition) { + if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof WordCloudColumnFieldCollection)){ + dataDefinition.setColumnFieldCollection(new WordCloudColumnFieldCollection()); + } + + super.populate(dataDefinition); + } + @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane());