Browse Source

CHART-15362 属性切换保留功能开发

feature/big-screen
白岳 4 years ago
parent
commit
d8b670866f
  1. 4
      designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java
  2. 4
      designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java
  3. 35
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java
  4. 4
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java
  5. 10
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  6. 88
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractRectanglePlotPane.java
  7. 44
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  8. 85
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java
  9. 3
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java
  10. 4
      designer-chart/src/main/java/com/fr/van/chart/line/VanChartLinePlotPane.java
  11. 23
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java
  12. 4
      designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java
  13. 36
      designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPiePlotPane.java
  14. 24
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java

4
designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaPlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.area.AreaIndependentVanChart; import com.fr.plugin.chart.area.AreaIndependentVanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/** /**
* Created by Mitisky on 15/11/18. * Created by Mitisky on 15/11/18.
*/ */
public class VanChartAreaPlotPane extends AbstractVanChartTypePane { public class VanChartAreaPlotPane extends AbstractRectanglePlotPane {
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {

4
designer-chart/src/main/java/com/fr/van/chart/bar/VanChartBarPlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.bar.BarIndependentVanChart; import com.fr.plugin.chart.bar.BarIndependentVanChart;
import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/** /**
* Created by Mitisky on 15/10/20. * Created by Mitisky on 15/10/20.
*/ */
public class VanChartBarPlotPane extends AbstractVanChartTypePane { public class VanChartBarPlotPane extends AbstractRectanglePlotPane {
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {

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

@ -12,15 +12,22 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.bubble.BubbleIndependentVanChart; import com.fr.plugin.chart.bubble.BubbleIndependentVanChart;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import java.util.HashSet;
import java.util.Set;
/** /**
* Created by Mitisky on 16/3/31. * Created by Mitisky on 16/3/31.
*/ */
@ -32,6 +39,20 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
private static final float ALPHA = 0.7f; private static final float ALPHA = 0.7f;
private static Set<String> forceExtendPlotIds = new HashSet<>();
private static Set<String> extendPlotIds = new HashSet<>();
static {
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID);
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID);
extendPlotIds.add(VanChartLinePlot.VAN_CHART_LINE_PLOT);
extendPlotIds.add(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID);
extendPlotIds.add(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID);
forceExtendPlotIds.add(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID);
}
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/bubble/images/bubble.png", return new String[]{"/com/fr/van/chart/bubble/images/bubble.png",
@ -122,16 +143,16 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
* @param chart * @param chart
*/ */
@Override @Override
protected void resetChartAttr4SamePlot(Chart chart) { protected void resetChartAttr4SamePlot(VanChart chart) {
//图表缩放新设计 恢复用注释。下面2行删除。 //图表缩放新设计 恢复用注释。下面2行删除。
VanChartZoom vanChartZoom = new VanChartZoom(); VanChartZoom vanChartZoom = new VanChartZoom();
((VanChart) chart).setVanChartZoom(vanChartZoom); chart.setVanChartZoom(vanChartZoom);
//图表缩放新设计 恢复用注释。下面一行取消注释。 //图表缩放新设计 恢复用注释。下面一行取消注释。
//((VanChart) chart).setZoomAttribute(new ZoomAttribute()); //((VanChart) chart).setZoomAttribute(new ZoomAttribute());
//重置监控刷新选项 //重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart) chart); resetRefreshMoreLabelAttr(chart);
} }
@Override @Override
@ -147,4 +168,12 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
} }
return false; return false;
} }
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
VanChartBubblePlot selectedClonedPlot = (VanChartBubblePlot) getSelectedClonedPlot();
return selectedClonedPlot.isForceBubble() ? forceExtendPlotIds.contains(chart.getID()) :
extendPlotIds.contains(chart.getID());
}
} }

4
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.column.ColumnIndependentVanChart; import com.fr.plugin.chart.column.ColumnIndependentVanChart;
import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/** /**
* Created by Mitisky on 15/9/24. * Created by Mitisky on 15/9/24.
*/ */
public class VanChartColumnPlotPane extends AbstractVanChartTypePane { public class VanChartColumnPlotPane extends AbstractRectanglePlotPane {
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {

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

@ -119,7 +119,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
} }
@Override @Override
public void updateBean(Chart chart) { public void updateBean(VanChart chart) {
//保存上次选中的值,其会在super中更新 //保存上次选中的值,其会在super中更新
int lastState = chart.getPlot().getDetailType(); int lastState = chart.getPlot().getDetailType();
@ -129,7 +129,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置 //如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
if (lastState != chart.getPlot().getDetailType()) { if (lastState != chart.getPlot().getDetailType()) {
chart.setFilterDefinition(null); chart.setFilterDefinition(null);
((VanChart) chart).setChartDataDefinition(null); chart.setChartDataDefinition(null);
} }
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
@ -214,12 +214,12 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
* @param newPlot * @param newPlot
*/ */
@Override @Override
protected void resetChartAttr(Chart chart, Plot newPlot) { protected void resetChartAttr(VanChart chart, VanChartPlot newPlot) {
super.resetChartAttr(chart, newPlot); super.resetChartAttr(chart, newPlot);
//切换图表清空数据配置 //切换图表清空数据配置
chart.setFilterDefinition(null); chart.setFilterDefinition(null);
//设置默认不排序 //设置默认不排序
VanChartTools tools = ((VanChart) chart).getVanChartTools(); VanChartTools tools = chart.getVanChartTools();
if (tools != null) { if (tools != null) {
tools.setSort(false); tools.setSort(false);
} }
@ -228,7 +228,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
/** /**
* 更新界面内容 * 更新界面内容
*/ */
public void populateBean(Chart chart) { public void populateBean(VanChart chart) {
for (ChartImagePane imagePane : typeDemo) { for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false; imagePane.isPressing = false;
} }

88
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractRectanglePlotPane.java

@ -0,0 +1,88 @@
package com.fr.van.chart.designer.type;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.type.VanChartPlotType;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-08-24
*/
public abstract class AbstractRectanglePlotPane extends AbstractVanChartTypePane {
private static Set<String> extendPlotIds = new HashSet<>();
static {
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID);
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID);
extendPlotIds.add(VanChartLinePlot.VAN_CHART_LINE_PLOT);
extendPlotIds.add(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID);
extendPlotIds.add(VanChartScatterPlot.VAN_CHART_SCATTER_PLOT_ID);
extendPlotIds.add(PiePlot4VanChart.VAN_CHART_PIE_PLOT);
}
@Override
protected VanChartPlot cloneOldPlot2New(VanChartPlot oldPlot, VanChartPlot newPlot) {
try {
VanChartRectanglePlot vanChartRectanglePlot = (VanChartRectanglePlot) newPlot;
VanChartRectanglePlot clonePlot = (VanChartRectanglePlot) oldPlot.clone();
clonePlot.setVanChartPlotType(vanChartRectanglePlot.getVanChartPlotType());
//自定义类型的图形要增加一个y2轴,并且增加系列中的堆积条件,反之则要去掉y2轴和条件
if (clonePlot.isCustomChart()) {
List<VanChartAxis> valueAxisList = clonePlot.getValueAxisList();
valueAxisList.add(vanChartRectanglePlot.getValueAxisList().get(1));
clonePlot.setStackAndAxisCondition(vanChartRectanglePlot.getStackAndAxisCondition());
} else {
List<VanChartAxis> xAxisList = clonePlot.getXAxisList();
List<VanChartAxis> yAxisList = clonePlot.getYAxisList();
List<VanChartAxis> newXAxisList = new ArrayList<>();
List<VanChartAxis> newYAxisList = new ArrayList<>();
newXAxisList.add(xAxisList.get(0));
newYAxisList.add(yAxisList.get(0));
clonePlot.setXAxisList(newXAxisList);
clonePlot.setYAxisList(newYAxisList);
clonePlot.setStackAndAxisCondition(new ConditionCollection());
}
//百分比堆积图值轴的格式不保留
if (clonePlot.getVanChartPlotType() == VanChartPlotType.STACK_BY_PERCENT ||
((VanChartRectanglePlot) oldPlot).getVanChartPlotType() == VanChartPlotType.STACK_BY_PERCENT) {
VanChartAxis cloneAxis = clonePlot.getValueAxisList().get(0);
VanChartAxis vanChartAxis = vanChartRectanglePlot.getValueAxisList().get(0);
cloneAxis.setFormat(vanChartAxis.getFormat());
cloneAxis.setPercentage(vanChartAxis.isPercentage());
}
return clonePlot;
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error("Error in change plot");
return newPlot;
}
}
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
if (StringUtils.equals(VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, chart.getID())) {
VanChartBubblePlot vanChartBubblePlot = chart.getPlot();
return !vanChartBubblePlot.isForceBubble();
}
return extendPlotIds.contains(chart.getID());
}
}

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

@ -37,7 +37,7 @@ import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> { public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<VanChart> {
private static final long serialVersionUID = 7743244512351499265L; private static final long serialVersionUID = 7743244512351499265L;
private UICheckBox largeModelCheckBox; private UICheckBox largeModelCheckBox;
@ -119,7 +119,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
/** /**
* 更新界面内容 * 更新界面内容
*/ */
public void populateBean(Chart chart) { public void populateBean(VanChart chart) {
for (ChartImagePane imagePane : typeDemo) { for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false; imagePane.isPressing = false;
} }
@ -131,15 +131,14 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
/** /**
* 保存界面属性 * 保存界面属性
*/ */
public void updateBean(Chart chart) { public void updateBean(VanChart chart) {
VanChartPlot oldPlot = chart.getPlot(); VanChartPlot oldPlot = chart.getPlot();
VanChartPlot newPlot = getSelectedClonedPlot(); VanChartPlot newPlot = getSelectedClonedPlot();
checkTypeChange(oldPlot); checkTypeChange(oldPlot);
samePlot = accept(chart); samePlot = accept(chart);
if (typeChanged && samePlot) { if (typeChanged && samePlot) {
//同一中图表切换不同类型 //同一中图表切换不同类型
cloneOldPlot2New(oldPlot, newPlot); chart.setPlot(cloneOldPlot2New(oldPlot, newPlot));
chart.setPlot(newPlot);
resetChartAttr4SamePlot(chart); resetChartAttr4SamePlot(chart);
ChartInfoCollector.getInstance().updateChartMiniType(chart); ChartInfoCollector.getInstance().updateChartMiniType(chart);
} else if (!samePlot) { } else if (!samePlot) {
@ -150,9 +149,8 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
//切换类型埋点 //切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID()); ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
} }
if (chart instanceof VanChart if (!acceptDefinition(chart.getChartDataDefinition(), newPlot)) {
&& !acceptDefinition(((VanChart) chart).getChartDataDefinition(), newPlot)) { chart.setChartDataDefinition(null);
((VanChart) chart).setChartDataDefinition(null);
} }
} }
@ -164,31 +162,42 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
return false; return false;
} }
protected void resetChartAttr4SamePlot(Chart chart) { protected void resetChartAttr4SamePlot(VanChart chart) {
resetRefreshMoreLabelAttr((VanChart) chart); resetRefreshMoreLabelAttr(chart);
} }
protected void resetChartAttr(Chart chart, Plot newPlot) { protected void resetChartAttr(VanChart chart, VanChartPlot newPlot) {
//上个图表支持继承部分属性到新图表
if (supportExtendAttr(chart)) {
newPlot.extendAttribute(chart);
chart.setPlot(newPlot);
return;
}
chart.setPlot(newPlot); chart.setPlot(newPlot);
if (newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()) { if (newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()) {
//图表缩放新设计 恢复用注释。下面一行删除。 //图表缩放新设计 恢复用注释。下面一行删除。
((VanChart) chart).setVanChartZoom(new VanChartZoom()); chart.setVanChartZoom(new VanChartZoom());
//图表缩放新设计 恢复用注释。下面一行取消注释。 //图表缩放新设计 恢复用注释。下面一行取消注释。
// ((VanChart) chart).setZoomAttribute(new ZoomAttribute()); // ((VanChart) chart).setZoomAttribute(new ZoomAttribute());
} }
//重置工具栏选项 //重置工具栏选项
((VanChart) chart).setVanChartTools(createVanChartTools()); chart.setVanChartTools(createVanChartTools());
//重置标题选项 //重置标题选项
resetTitleAttr(chart); resetTitleAttr(chart);
//重置监控刷新选项 //重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart) chart); resetRefreshMoreLabelAttr(chart);
resetFilterDefinition(chart); resetFilterDefinition(chart);
} }
//是否支持属性的继承
protected boolean supportExtendAttr(VanChart chart) {
return false;
}
//默认有标题 //默认有标题
protected void resetTitleAttr(Chart chart) { protected void resetTitleAttr(Chart chart) {
VanChartPlot vanChartPlot = (VanChartPlot) chart.getPlot(); VanChartPlot vanChartPlot = chart.getPlot();
chart.setTitle(vanChartPlot.getDefaultTitle()); chart.setTitle(vanChartPlot.getDefaultTitle());
} }
@ -219,7 +228,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
/** /**
* 同一个图表 类型之间切换 * 同一个图表 类型之间切换
*/ */
protected void cloneOldPlot2New(Plot oldPlot, Plot newPlot) { protected VanChartPlot cloneOldPlot2New(VanChartPlot oldPlot, VanChartPlot newPlot) {
try { try {
if (oldPlot.getLegend() != null) { if (oldPlot.getLegend() != null) {
newPlot.setLegend((Legend) oldPlot.getLegend().clone()); newPlot.setLegend((Legend) oldPlot.getLegend().clone());
@ -247,11 +256,12 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
newPlot.setAlpha(oldPlot.getAlpha()); newPlot.setAlpha(oldPlot.getAlpha());
newPlot.setShadow(oldPlot.isShadow()); newPlot.setShadow(oldPlot.isShadow());
((VanChartPlot) newPlot).setCategoryNum(((VanChartPlot) oldPlot).getCategoryNum()); newPlot.setCategoryNum(oldPlot.getCategoryNum());
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot"); FineLoggerFactory.getLogger().error("Error in change plot");
} }
return newPlot;
} }
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {

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

@ -8,10 +8,13 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.gauge.GaugeIndependentVanChart; import com.fr.plugin.chart.gauge.GaugeIndependentVanChart;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
/** /**
@ -31,12 +34,12 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
}; };
} }
protected Plot getSelectedClonedPlot(){ protected Plot getSelectedClonedPlot() {
VanChartGaugePlot newPlot = null; VanChartGaugePlot newPlot = null;
Chart[] GaugeChart = GaugeIndependentVanChart.GaugeVanChartTypes; Chart[] GaugeChart = GaugeIndependentVanChart.GaugeVanChartTypes;
for(int i = 0, len = GaugeChart.length; i < len; i++){ for (int i = 0, len = GaugeChart.length; i < len; i++) {
if(typeDemo.get(i).isPressing){ if (typeDemo.get(i).isPressing) {
newPlot = (VanChartGaugePlot)GaugeChart[i].getPlot(); newPlot = (VanChartGaugePlot) GaugeChart[i].getPlot();
} }
} }
@ -44,8 +47,8 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
try { try {
if (newPlot == null) { if (newPlot == null) {
throw new IllegalArgumentException("newPlot con not be null"); throw new IllegalArgumentException("newPlot con not be null");
}else { } else {
cloned = (Plot)newPlot.clone(); cloned = (Plot) newPlot.clone();
} }
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In GaugeChart"); FineLoggerFactory.getLogger().error("Error In GaugeChart");
@ -56,16 +59,70 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
/** /**
* 保存界面属性 * 保存界面属性
*/ */
public void updateBean(Chart chart) { public void updateBean(VanChart chart) {
boolean oldISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot)chart.getPlot()).isMultiPointer(); boolean oldISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot) chart.getPlot()).isMultiPointer();
super.updateBean(chart); super.updateBean(chart);
boolean newISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot)chart.getPlot()).isMultiPointer(); boolean newISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot) chart.getPlot()).isMultiPointer();
if(oldISMulti != newISMulti){ if (oldISMulti != newISMulti) {
chart.setFilterDefinition(null); chart.setFilterDefinition(null);
} }
} }
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ @Override
protected VanChartPlot cloneOldPlot2New(VanChartPlot oldPlot, VanChartPlot newPlot) {
try {
VanChartGaugePlot vanChartNewPlot = (VanChartGaugePlot) newPlot;
VanChartGaugePlot vanChartOldPlot = (VanChartGaugePlot) oldPlot;
if (vanChartNewPlot.isMultiPointer() != vanChartOldPlot.isMultiPointer()) {
return super.cloneOldPlot2New(oldPlot, newPlot);
}
VanChartGaugePlot clonePlot = (VanChartGaugePlot) vanChartOldPlot.clone();
clonePlot.setGaugeStyle(vanChartNewPlot.getGaugeStyle());
//都是多指针仪表盘,所有属性都一样
if (clonePlot.isMultiPointer()) {
return clonePlot;
}
//超链和系列中的样式、布局不保留
clonePlot.setHotHyperLink(vanChartNewPlot.getHotHyperLink());
clonePlot.setRadius(vanChartNewPlot.getRadius());
reductionDetail(clonePlot.getGaugeDetailStyle(), vanChartNewPlot.getGaugeDetailStyle());
//如果切换试管型仪表盘,部分属性不保留
if (clonePlot.getGaugeStyle() == GaugeStyle.THERMOMETER ||
vanChartOldPlot.getGaugeStyle() == GaugeStyle.THERMOMETER) {
clonePlot.setGaugeAxis(vanChartNewPlot.getGaugeAxis());
clonePlot.getGaugeDetailStyle().setHorizontalLayout(vanChartNewPlot.getGaugeDetailStyle().isHorizontalLayout());
clonePlot.getGaugeDetailStyle().setHotAreaColor(vanChartNewPlot.getGaugeDetailStyle().getHotAreaColor());
AttrLabel cloneLabel = clonePlot.getAttrLabelFromConditionCollection();
AttrLabel newLabel = vanChartNewPlot.getAttrLabelFromConditionCollection();
cloneLabel.getAttrLabelDetail().setPosition(newLabel.getAttrLabelDetail().getPosition());
cloneLabel.getAttrLabelDetail().setAlign(newLabel.getAttrLabelDetail().getAlign());
cloneLabel.getAttrLabelDetail().setTextAttr(newLabel.getAttrLabelDetail().getTextAttr());
cloneLabel.getGaugeValueLabelDetail().setPosition(newLabel.getGaugeValueLabelDetail().getPosition());
cloneLabel.getGaugeValueLabelDetail().setAlign(newLabel.getGaugeValueLabelDetail().getAlign());
cloneLabel.getGaugeValueLabelDetail().setTextAttr(newLabel.getGaugeValueLabelDetail().getTextAttr());
}
return clonePlot;
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot");
return newPlot;
}
}
private void reductionDetail(GaugeDetailStyle cloneDetail, GaugeDetailStyle newDetail) {
cloneDetail.setNeedleColor(newDetail.getNeedleColor());
cloneDetail.setPaneBackgroundColor(newDetail.getPaneBackgroundColor());
cloneDetail.setSlotBackgroundColor(newDetail.getSlotBackgroundColor());
cloneDetail.setAntiClockWise(newDetail.isAntiClockWise());
cloneDetail.setInnerPaneBackgroundColor(newDetail.getInnerPaneBackgroundColor());
cloneDetail.setThermometerWidth(newDetail.getThermometerWidth());
cloneDetail.setChutePercent(newDetail.getChutePercent());
}
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {
} }
public Chart getDefaultChart() { public Chart getDefaultChart() {
@ -74,8 +131,8 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
@Override @Override
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {
if(oldPlot instanceof VanChartGaugePlot && newPlot instanceof VanChartGaugePlot){ if (oldPlot instanceof VanChartGaugePlot && newPlot instanceof VanChartGaugePlot) {
if(((VanChartGaugePlot) oldPlot).isMultiPointer() == ((VanChartGaugePlot) newPlot).isMultiPointer()){ if (((VanChartGaugePlot) oldPlot).isMultiPointer() == ((VanChartGaugePlot) newPlot).isMultiPointer()) {
super.cloneHotHyperLink(oldPlot, newPlot); super.cloneHotHyperLink(oldPlot, newPlot);
} }
} }
@ -83,7 +140,7 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
@Override @Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) { if (definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
GaugeStyle gaugeStyle = ((VanChartGaugePlot) vanChartPlot).getGaugeStyle(); GaugeStyle gaugeStyle = ((VanChartGaugePlot) vanChartPlot).getGaugeStyle();
switch (gaugeStyle) { switch (gaugeStyle) {

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

@ -10,6 +10,7 @@ import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.heatmap.HeatMapIndependentVanChart; import com.fr.plugin.chart.heatmap.HeatMapIndependentVanChart;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.map.designer.type.VanChartMapPlotPane; import com.fr.van.chart.map.designer.type.VanChartMapPlotPane;
import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane;
@ -30,7 +31,7 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane {
} }
//适用一种图表只有一种类型的 //适用一种图表只有一种类型的
public void populateBean(Chart chart) { public void populateBean(VanChart chart) {
typeDemo.get(0).isPressing = true; typeDemo.get(0).isPressing = true;
VanChartHeatMapPlot plot = (VanChartHeatMapPlot)chart.getPlot(); VanChartHeatMapPlot plot = (VanChartHeatMapPlot)chart.getPlot();
populateSourcePane(plot); populateSourcePane(plot);

4
designer-chart/src/main/java/com/fr/van/chart/line/VanChartLinePlotPane.java

@ -5,12 +5,12 @@ import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.line.LineIndependentVanChart; import com.fr.plugin.chart.line.LineIndependentVanChart;
import com.fr.plugin.chart.line.VanChartLinePlot; import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractRectanglePlotPane;
/** /**
* Created by Mitisky on 15/11/5. * Created by Mitisky on 15/11/5.
*/ */
public class VanChartLinePlotPane extends AbstractVanChartTypePane { public class VanChartLinePlotPane extends AbstractRectanglePlotPane {
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {

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

@ -9,13 +9,18 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.plugin.chart.map.MapIndependentVanChart; import com.fr.plugin.chart.map.MapIndependentVanChart;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.data.VanMapDefinition; import com.fr.plugin.chart.map.data.VanMapDefinition;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.HashSet;
import java.util.Set;
import java.awt.Component; import java.awt.Component;
/** /**
@ -25,6 +30,14 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
private VanChartMapSourceChoosePane sourceChoosePane; private VanChartMapSourceChoosePane sourceChoosePane;
private static Set<String> extendPlotIds = new HashSet<>();
static {
extendPlotIds.add(VanChartMapPlot.VAN_CHART_MAP_ID);
extendPlotIds.add(VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID);
extendPlotIds.add(VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID);
}
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/map/images/area-map.png", return new String[]{"/com/fr/van/chart/map/images/area-map.png",
@ -54,7 +67,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
/** /**
* 更新界面内容 * 更新界面内容
*/ */
public void populateBean(Chart chart) { public void populateBean(VanChart chart) {
for (ChartImagePane imagePane : typeDemo) { for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false; imagePane.isPressing = false;
} }
@ -80,7 +93,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
} }
} }
public void updateBean(Chart chart) { public void updateBean(VanChart chart) {
super.updateBean(chart); super.updateBean(chart);
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if (plot instanceof VanChartMapPlot) { if (plot instanceof VanChartMapPlot) {
@ -154,4 +167,10 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
return definition instanceof MapChartDataDefinition; return definition instanceof MapChartDataDefinition;
} }
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
return extendPlotIds.contains(chart.getID());
}
} }

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

@ -55,10 +55,10 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane {
return MultiPieIndependentVanChart.MultilayerVanChartTypes[0]; return MultiPieIndependentVanChart.MultilayerVanChartTypes[0];
} }
protected void resetChartAttr(Chart chart, Plot newPlot) { protected void resetChartAttr(VanChart chart, VanChartPlot newPlot) {
super.resetChartAttr(chart, newPlot); super.resetChartAttr(chart, newPlot);
//重置工具栏选项 //重置工具栏选项
VanChartTools tools = ((VanChart) chart).getVanChartTools(); VanChartTools tools = chart.getVanChartTools();
if (tools != null) { if (tools != null) {
tools.setSort(false); tools.setSort(false);
tools.setFullScreen(false); tools.setFullScreen(false);

36
designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPiePlotPane.java

@ -5,9 +5,17 @@ import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.pie.PieIndependentVanChart; import com.fr.plugin.chart.pie.PieIndependentVanChart;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import java.util.HashSet;
import java.util.Set;
/** /**
* 饼图(新特性) 属性表 选择类型 布局界面. * 饼图(新特性) 属性表 选择类型 布局界面.
*/ */
@ -15,6 +23,15 @@ public class VanChartPiePlotPane extends AbstractVanChartTypePane {
private static final long serialVersionUID = 6163246902689597259L; private static final long serialVersionUID = 6163246902689597259L;
private static Set<String> extendPlotIds = new HashSet<>();
static {
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID);
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID);
extendPlotIds.add(VanChartLinePlot.VAN_CHART_LINE_PLOT);
extendPlotIds.add(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID);
}
@Override @Override
protected String[] getTypeIconPath() { protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/pie/images/pie.png", return new String[]{"/com/fr/van/chart/pie/images/pie.png",
@ -44,6 +61,25 @@ public class VanChartPiePlotPane extends AbstractVanChartTypePane {
return cloned; return cloned;
} }
@Override
protected VanChartPlot cloneOldPlot2New(VanChartPlot oldPlot, VanChartPlot newPlot) {
try {
PiePlot4VanChart piePlot4VanChart = (PiePlot4VanChart) newPlot;
PiePlot4VanChart clonePlot = (PiePlot4VanChart) oldPlot.clone();
clonePlot.setRoseType(piePlot4VanChart.getRoseType());
return clonePlot;
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot");
return newPlot;
}
}
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
return extendPlotIds.contains(chart.getID());
}
public Chart getDefaultChart() { public Chart getDefaultChart() {
return PieIndependentVanChart.newPieChartTypes[0]; return PieIndependentVanChart.newPieChartTypes[0];
} }

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

@ -10,13 +10,21 @@ import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection; import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.line.VanChartLinePlot;
import com.fr.plugin.chart.scatter.ScatterIndependentVanChart; import com.fr.plugin.chart.scatter.ScatterIndependentVanChart;
import com.fr.plugin.chart.scatter.VanChartScatterPlot; import com.fr.plugin.chart.scatter.VanChartScatterPlot;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import java.util.HashSet;
import java.util.Set;
/** /**
* Created by Mitisky on 16/2/16. * Created by Mitisky on 16/2/16.
*/ */
@ -29,6 +37,16 @@ public class VanChartScatterPlotPane extends AbstractVanChartTypePane {
}; };
} }
private static Set<String> extendPlotIds = new HashSet<>();
static {
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID);
extendPlotIds.add(VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID);
extendPlotIds.add(VanChartLinePlot.VAN_CHART_LINE_PLOT);
extendPlotIds.add(VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID);
extendPlotIds.add(VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID);
}
protected Plot getSelectedClonedPlot(){ protected Plot getSelectedClonedPlot(){
VanChartScatterPlot newPlot = null; VanChartScatterPlot newPlot = null;
Chart[] scatterChart = ScatterIndependentVanChart.ScatterVanChartTypes; Chart[] scatterChart = ScatterIndependentVanChart.ScatterVanChartTypes;
@ -95,4 +113,10 @@ public class VanChartScatterPlotPane extends AbstractVanChartTypePane {
} }
return false; return false;
} }
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
return extendPlotIds.contains(chart.getID());
}
} }
Loading…
Cancel
Save