Browse Source

Merge pull request #1327 in DESIGN/design from ~BJORN/design:feature/10.0 to feature/10.0

* commit '7a0154ca9612b5d1d5aefcea3282708d9881b290':
  CHART-11810
  CHART-11810 类型切换时对数据配置的处理
research/11.0
Bjorn 5 years ago
parent
commit
11fb8c8461
  1. 4
      designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java
  2. 6
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  3. 8
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  4. 21
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java
  5. 7
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  6. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  7. 8
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java
  8. 14
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/type/VanChartFunnelTypePane.java
  9. 8
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/type/VanChartGanttPlotPane.java
  10. 26
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java
  11. 7
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java
  12. 8
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java
  13. 15
      designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java
  14. 14
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java
  15. 13
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java
  16. 14
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/type/VanChartWordCloudTypePane.java

4
designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java

@ -7,9 +7,9 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.AssistUtils;
import java.awt.BorderLayout;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.awt.BorderLayout;
/**
* Created by shine on 2019/4/15.
@ -45,9 +45,7 @@ public abstract class AbstractChartDataPane<T extends ChartDataDefinitionProvide
ChartDataDefinitionProvider dataSetCollection = vanChart.getChartDataDefinition();
if (isMatchedDataType(dataSetCollection)) {
populate((T) dataSetCollection);
}
this.initAllListeners();
this.validate();

6
designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java

@ -4,11 +4,8 @@ import com.fr.chartx.data.CellDataDefinition;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.i18n.Toolkit;
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.
@ -51,11 +48,8 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
return;
}
Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) {
cellDataFieldsPane.populateBean(ob.getColumnFieldCollection());
}
}
@Override
public CellDataDefinition updateBean() {

8
designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

@ -11,10 +11,7 @@ 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.stable.AssistUtils;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Dimension;
@ -109,11 +106,8 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
checkBoxUse();
tableDataPane.populateBean(ob.getNameTableData());
Type dataType = ((ParameterizedType) dataSetFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) {
dataSetFieldsPane.populateBean(ob.getColumnFieldCollection());
}
dataSetFieldsPane.populateBean(ob.getColumnFieldCollection());
}
@Override

21
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java

@ -7,7 +7,13 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chartx.attr.ZoomAttribute;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.bubble.BubbleIndependentVanChart;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
@ -112,6 +118,7 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
/**
* 气泡图相同图表类型之间切换的时候chart的部分属性也需要重置
*
* @param chart
*/
@Override
@ -120,4 +127,18 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
//重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart) chart);
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if (definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
boolean isForce = ((VanChartBubblePlot) vanChartPlot).isForceBubble();
if (isForce) {
return columnFieldCollection instanceof MultiCategoryColumnFieldCollection;
}
return columnFieldCollection instanceof BubbleColumnFieldCollection;
}
return false;
}
}

7
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java

@ -7,11 +7,13 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.CustomChartDataDefinition;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.custom.CustomDefinition;
@ -295,4 +297,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
}
}
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
return definition instanceof CustomDefinition;
}
}

16
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -8,6 +8,10 @@ import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ZoomAttribute;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.MultilineLabel;
@ -107,6 +111,18 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
newPlot.setCategoryNum(oldPlot.getCategoryNum());
}
if(chart instanceof VanChart
&& !acceptDefinition(((VanChart) chart).getChartDataDefinition(), newPlot)) {
((VanChart) chart).setChartDataDefinition(null);
}
}
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
return columnFieldCollection instanceof MultiCategoryColumnFieldCollection;
}
return false;
}
protected void resetChartAttr4SamePlot(Chart chart){

8
designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java

@ -2,9 +2,12 @@ package com.fr.van.chart.drillmap.designer.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.drillmap.DrillMapIndependentVanChart;
import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot;
import com.fr.plugin.chart.drillmap.data.DrillMapDefinition;
import com.fr.plugin.chart.type.MapType;
import com.fr.plugin.chart.type.ZoomLevel;
import com.fr.van.chart.map.designer.type.VanChartMapPlotPane;
@ -66,4 +69,9 @@ public class VanChartDrillMapPlotPane extends VanChartMapPlotPane {
drillMapPlot.setLayerLevelList(new ArrayList<ZoomLevel>());
drillMapPlot.setLayerMapTypeList(new ArrayList<MapType>());
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
return definition instanceof DrillMapDefinition;
}
}

14
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/type/VanChartFunnelTypePane.java

@ -2,7 +2,12 @@ package com.fr.van.chart.funnel.designer.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.funnel.FunnelIndependentVanChart;
import com.fr.plugin.chart.funnel.VanChartFunnelPlot;
@ -43,4 +48,13 @@ public class VanChartFunnelTypePane extends AbstractVanChartTypePane {
public Chart getDefaultChart() {
return FunnelIndependentVanChart.FunnelVanChartTypes[0];
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if (definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
return columnFieldCollection.getClass().equals(ColumnFieldCollectionWithSeriesValue.class);
}
return false;
}
}

8
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/type/VanChartGanttPlotPane.java

@ -2,7 +2,10 @@ package com.fr.van.chart.gantt.designer.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.GanttChartDataDefinition;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.gantt.GanttIndependentVanChart;
import com.fr.plugin.chart.gantt.VanChartGanttPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
@ -33,4 +36,9 @@ public class VanChartGanttPlotPane extends AbstractVanChartTypePane {
}
return cloned;
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
return definition instanceof GanttChartDataDefinition;
}
}

26
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java

@ -2,9 +2,16 @@ package com.fr.van.chart.gauge;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.gauge.GaugeIndependentVanChart;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
/**
@ -73,4 +80,23 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
}
}
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
GaugeStyle gaugeStyle = ((VanChartGaugePlot) vanChartPlot).getGaugeStyle();
switch (gaugeStyle) {
case RING:
case SLOT:
case THERMOMETER:
return columnFieldCollection instanceof GaugeColumnFieldCollection;
case POINTER:
case POINTER_SEMI:
default:
return columnFieldCollection instanceof MultiCategoryColumnFieldCollection;
}
}
return false;
}
}

7
designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java

@ -2,8 +2,10 @@ package com.fr.van.chart.heatmap.designer.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.heatmap.HeatMapIndependentVanChart;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
@ -70,4 +72,9 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane {
public Chart getDefaultChart() {
return HeatMapIndependentVanChart.HeatMapVanCharts[0];
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
return false;
}
}

8
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java

@ -2,9 +2,12 @@ package com.fr.van.chart.map.designer.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.MapChartDataDefinition;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.map.MapIndependentVanChart;
import com.fr.plugin.chart.map.VanChartMapPlot;
@ -89,6 +92,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
/**
* 不同地图类型的超链不需要复制
*
* @param oldPlot
* @param newPlot
* @throws CloneNotSupportedException
@ -146,4 +150,8 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
return this.sourceChoosePane;
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
return definition instanceof MapChartDataDefinition;
}
}

15
designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java

@ -2,7 +2,12 @@ package com.fr.van.chart.multilayer;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.multilayer.MultiPieIndependentVanChart;
import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot;
@ -43,6 +48,7 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane {
/**
* 防止新建其他图表从而切换很卡
*
* @return
*/
public Chart getDefaultChart() {
@ -59,4 +65,13 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane {
tools.setExport(false);
}
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if (definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
return columnFieldCollection instanceof MultiPieColumnFieldCollection;
}
return false;
}
}

14
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java

@ -5,7 +5,12 @@ import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.scatter.ScatterIndependentVanChart;
@ -81,4 +86,13 @@ public class VanChartScatterPlotPane extends AbstractVanChartTypePane {
}
}
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
return columnFieldCollection instanceof BubbleColumnFieldCollection;
}
return false;
}
}

13
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java

@ -2,7 +2,12 @@ package com.fr.van.chart.structure.desinger.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.StructureColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.structure.StructureIndependentVanChart;
import com.fr.plugin.chart.structure.VanChartStructurePlot;
@ -54,4 +59,12 @@ public class VanChartStructureTypePane extends AbstractVanChartTypePane {
return WordCloudIndependentVanChart.WordCloudVanCharts[0];
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
return columnFieldCollection instanceof StructureColumnFieldCollection;
}
return false;
}
}

14
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/type/VanChartWordCloudTypePane.java

@ -2,7 +2,12 @@ package com.fr.van.chart.wordcloud.designer.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.WordCloudColumnFieldCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.plugin.chart.wordcloud.WordCloudIndependentVanChart;
@ -63,4 +68,13 @@ public class VanChartWordCloudTypePane extends AbstractVanChartTypePane {
public Chart getDefaultChart() {
return WordCloudIndependentVanChart.WordCloudVanCharts[0];
}
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
return columnFieldCollection instanceof WordCloudColumnFieldCollection;
}
return false;
}
}

Loading…
Cancel
Save