From 32008dbdec4a8659fe45cff053bceb02c5215e0d Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Wed, 13 Nov 2019 20:58:50 +0800 Subject: [PATCH] =?UTF-8?q?CHART-11093=20=E5=8F=8D=E5=B0=84=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9B=B8=E5=BA=94=E6=95=B0=E6=8D=AE=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/chartx/single/CellDataPane.java | 16 ++++++++++++++- .../fr/design/chartx/single/DataSetPane.java | 18 +++++++++++++++-- .../BubbleIndependentVanChartInterface.java | 19 ------------------ .../FunnelIndependentVanChartInterface.java | 11 ---------- .../GaugeIndependentVanChartInterface.java | 20 ------------------- .../MultiPieIndependentVanChartInterface.java | 11 ---------- .../ScatterIndependentVanChartInterface.java | 11 ---------- .../desinger/VanStructureChartTypeUI.java | 12 ----------- .../AbstractIndependentVanChartUI.java | 11 ---------- .../AbstractMultiCategoryVanChartUI.java | 11 ---------- ...WordCloudIndependentVanChartInterface.java | 12 ----------- 11 files changed, 31 insertions(+), 121 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java index f0a4ef0af..075bb54bf 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java @@ -1,11 +1,16 @@ package com.fr.design.chartx.single; import com.fr.chartx.data.CellDataDefinition; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.i18n.Toolkit; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import java.awt.BorderLayout; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; /** * Created by shine on 2019/5/21. @@ -43,7 +48,16 @@ public class CellDataPane extends FurtherBasicBeanPane { @Override public void populateBean(CellDataDefinition ob) { - cellDataFieldsPane.populateBean(ob.getColumnFieldCollection()); + try { + Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + if (ob.getColumnFieldCollection() != null && !AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) { + Object fieldCollection = Class.forName(((Class) dataType).getName()).newInstance(); + ob.setColumnFieldCollection((AbstractColumnFieldCollection) fieldCollection); + } + cellDataFieldsPane.populateBean(ob.getColumnFieldCollection()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java b/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java index 98394c31a..ceae5302a 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java @@ -1,6 +1,7 @@ package com.fr.design.chartx.single; import com.fr.chartx.data.DataSetDefinition; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; import com.fr.data.impl.NameTableData; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; @@ -11,9 +12,13 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import java.awt.BorderLayout; import java.awt.Dimension; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; import java.util.List; /** @@ -100,9 +105,18 @@ public class DataSetPane extends FurtherBasicBeanPane { refreshBoxList(); checkBoxUse(); - tableDataPane.populateBean(ob.getNameTableData()); + try { + Type dataType = ((ParameterizedType) dataSetFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + if (ob.getColumnFieldCollection() != null && !AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) { + Object fieldCollection = Class.forName(((Class) dataType).getName()).newInstance(); + ob.setColumnFieldCollection((AbstractColumnFieldCollection) fieldCollection); + } + tableDataPane.populateBean(ob.getNameTableData()); + dataSetFieldsPane.populateBean(ob.getColumnFieldCollection()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } - dataSetFieldsPane.populateBean(ob.getColumnFieldCollection()); } @Override 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 1dd5a9d39..a00423ad7 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,9 +3,6 @@ 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; @@ -146,22 +143,6 @@ 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 b5bfe7c70..c45aa17c3 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,8 +2,6 @@ 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; @@ -99,15 +97,6 @@ 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 6641ba3b3..d19ea6a46 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,9 +2,6 @@ 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; @@ -139,23 +136,6 @@ 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 865af7e81..9b1aa395f 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 @@ -1,8 +1,6 @@ package com.fr.van.chart.multilayer; import com.fr.chart.chartattr.Plot; -import com.fr.chartx.data.AbstractDataDefinition; -import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.fields.diff.MultiPieCellDataFieldsPane; @@ -47,15 +45,6 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { return new AbstractVanSingleDataPane(listener) { - - @Override - protected void populate(AbstractDataDefinition dataDefinition) { - if (dataDefinition != null && !(dataDefinition.getColumnFieldCollection() instanceof MultiPieColumnFieldCollection)) { - dataDefinition.setColumnFieldCollection(new MultiPieColumnFieldCollection()); - } - super.populate(dataDefinition); - } - @Override protected SingleDataPane createSingleDataPane() { return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane()); 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 9182800b0..7d3a7df48 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,8 +3,6 @@ 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; @@ -113,15 +111,6 @@ 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 e213f5914..19f5abd5a 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,8 +2,6 @@ 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; @@ -108,16 +106,6 @@ 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 2ebd1aafa..39e22492f 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,8 +1,6 @@ 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; @@ -56,15 +54,6 @@ 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 a06b8ee7d..6cd2743fe 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,8 +2,6 @@ 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; @@ -70,15 +68,6 @@ 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 8e7ca2070..2e1056ae8 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,8 +2,6 @@ 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; @@ -117,16 +115,6 @@ 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());