Browse Source

CHART-11093 反射获取相应数据面板对应的数据类型

research/11.0
Wim.Zhai 5 years ago
parent
commit
32008dbdec
  1. 14
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  2. 16
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  3. 19
      designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java
  4. 11
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java
  5. 20
      designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java
  6. 11
      designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java
  7. 11
      designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java
  8. 12
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java
  9. 11
      designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java
  10. 11
      designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java
  11. 12
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java

14
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<CellDataDefinition> {
@Override
public void populateBean(CellDataDefinition ob) {
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

16
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<DataSetDefinition> {
refreshBoxList();
checkBoxUse();
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);
}
}
@Override

19
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()) {

11
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());

20
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()) {

11
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());

11
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());

12
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());

11
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());

11
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());

12
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());

Loading…
Cancel
Save