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.plugin.chart.area.AreaIndependentVanChart;
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.
*/
public class VanChartAreaPlotPane extends AbstractVanChartTypePane {
public class VanChartAreaPlotPane extends AbstractRectanglePlotPane {
@Override
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.plugin.chart.bar.BarIndependentVanChart;
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.
*/
public class VanChartBarPlotPane extends AbstractVanChartTypePane {
public class VanChartBarPlotPane extends AbstractRectanglePlotPane {
@Override
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.MultiCategoryColumnFieldCollection;
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.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.bubble.BubbleIndependentVanChart;
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.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import java.util.HashSet;
import java.util.Set;
/**
* 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 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
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/bubble/images/bubble.png",
@ -122,16 +143,16 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
* @param chart
*/
@Override
protected void resetChartAttr4SamePlot(Chart chart) {
protected void resetChartAttr4SamePlot(VanChart chart) {
//图表缩放新设计 恢复用注释。下面2行删除。
VanChartZoom vanChartZoom = new VanChartZoom();
((VanChart) chart).setVanChartZoom(vanChartZoom);
chart.setVanChartZoom(vanChartZoom);
//图表缩放新设计 恢复用注释。下面一行取消注释。
//((VanChart) chart).setZoomAttribute(new ZoomAttribute());
//重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart) chart);
resetRefreshMoreLabelAttr(chart);
}
@Override
@ -147,4 +168,12 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
}
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.plugin.chart.column.ColumnIndependentVanChart;
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.
*/
public class VanChartColumnPlotPane extends AbstractVanChartTypePane {
public class VanChartColumnPlotPane extends AbstractRectanglePlotPane {
@Override
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
public void updateBean(Chart chart) {
public void updateBean(VanChart chart) {
//保存上次选中的值,其会在super中更新
int lastState = chart.getPlot().getDetailType();
@ -129,7 +129,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
if (lastState != chart.getPlot().getDetailType()) {
chart.setFilterDefinition(null);
((VanChart) chart).setChartDataDefinition(null);
chart.setChartDataDefinition(null);
}
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes;
@ -214,12 +214,12 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
* @param newPlot
*/
@Override
protected void resetChartAttr(Chart chart, Plot newPlot) {
protected void resetChartAttr(VanChart chart, VanChartPlot newPlot) {
super.resetChartAttr(chart, newPlot);
//切换图表清空数据配置
chart.setFilterDefinition(null);
//设置默认不排序
VanChartTools tools = ((VanChart) chart).getVanChartTools();
VanChartTools tools = chart.getVanChartTools();
if (tools != null) {
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) {
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.event.ActionListener;
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> {
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<VanChart> {
private static final long serialVersionUID = 7743244512351499265L;
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) {
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 newPlot = getSelectedClonedPlot();
checkTypeChange(oldPlot);
samePlot = accept(chart);
if (typeChanged && samePlot) {
//同一中图表切换不同类型
cloneOldPlot2New(oldPlot, newPlot);
chart.setPlot(newPlot);
chart.setPlot(cloneOldPlot2New(oldPlot, newPlot));
resetChartAttr4SamePlot(chart);
ChartInfoCollector.getInstance().updateChartMiniType(chart);
} else if (!samePlot) {
@ -150,9 +149,8 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
//切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
}
if (chart instanceof VanChart
&& !acceptDefinition(((VanChart) chart).getChartDataDefinition(), newPlot)) {
((VanChart) chart).setChartDataDefinition(null);
if (!acceptDefinition(chart.getChartDataDefinition(), newPlot)) {
chart.setChartDataDefinition(null);
}
}
@ -164,31 +162,42 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
return false;
}
protected void resetChartAttr4SamePlot(Chart chart) {
resetRefreshMoreLabelAttr((VanChart) chart);
protected void resetChartAttr4SamePlot(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);
if (newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()) {
//图表缩放新设计 恢复用注释。下面一行删除。
((VanChart) chart).setVanChartZoom(new VanChartZoom());
chart.setVanChartZoom(new VanChartZoom());
//图表缩放新设计 恢复用注释。下面一行取消注释。
// ((VanChart) chart).setZoomAttribute(new ZoomAttribute());
}
//重置工具栏选项
((VanChart) chart).setVanChartTools(createVanChartTools());
chart.setVanChartTools(createVanChartTools());
//重置标题选项
resetTitleAttr(chart);
//重置监控刷新选项
resetRefreshMoreLabelAttr((VanChart) chart);
resetRefreshMoreLabelAttr(chart);
resetFilterDefinition(chart);
}
//是否支持属性的继承
protected boolean supportExtendAttr(VanChart chart) {
return false;
}
//默认有标题
protected void resetTitleAttr(Chart chart) {
VanChartPlot vanChartPlot = (VanChartPlot) chart.getPlot();
VanChartPlot vanChartPlot = chart.getPlot();
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 {
if (oldPlot.getLegend() != null) {
newPlot.setLegend((Legend) oldPlot.getLegend().clone());
@ -247,11 +256,12 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
newPlot.setAlpha(oldPlot.getAlpha());
newPlot.setShadow(oldPlot.isShadow());
((VanChartPlot) newPlot).setCategoryNum(((VanChartPlot) oldPlot).getCategoryNum());
newPlot.setCategoryNum(oldPlot.getCategoryNum());
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error in change plot");
}
return newPlot;
}
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.MultiCategoryColumnFieldCollection;
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.base.AttrLabel;
import com.fr.plugin.chart.gauge.GaugeIndependentVanChart;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.vanchart.VanChart;
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;
Chart[] GaugeChart = GaugeIndependentVanChart.GaugeVanChartTypes;
for(int i = 0, len = GaugeChart.length; i < len; i++){
if(typeDemo.get(i).isPressing){
newPlot = (VanChartGaugePlot)GaugeChart[i].getPlot();
for (int i = 0, len = GaugeChart.length; i < len; i++) {
if (typeDemo.get(i).isPressing) {
newPlot = (VanChartGaugePlot) GaugeChart[i].getPlot();
}
}
@ -44,8 +47,8 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
try {
if (newPlot == null) {
throw new IllegalArgumentException("newPlot con not be null");
}else {
cloned = (Plot)newPlot.clone();
} else {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In GaugeChart");
@ -56,16 +59,70 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
/**
* 保存界面属性
*/
public void updateBean(Chart chart) {
boolean oldISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot)chart.getPlot()).isMultiPointer();
public void updateBean(VanChart chart) {
boolean oldISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot) chart.getPlot()).isMultiPointer();
super.updateBean(chart);
boolean newISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot)chart.getPlot()).isMultiPointer();
if(oldISMulti != newISMulti){
boolean newISMulti = chart.getPlot() instanceof VanChartGaugePlot && ((VanChartGaugePlot) chart.getPlot()).isMultiPointer();
if (oldISMulti != newISMulti) {
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() {
@ -74,8 +131,8 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
@Override
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException {
if(oldPlot instanceof VanChartGaugePlot && newPlot instanceof VanChartGaugePlot){
if(((VanChartGaugePlot) oldPlot).isMultiPointer() == ((VanChartGaugePlot) newPlot).isMultiPointer()){
if (oldPlot instanceof VanChartGaugePlot && newPlot instanceof VanChartGaugePlot) {
if (((VanChartGaugePlot) oldPlot).isMultiPointer() == ((VanChartGaugePlot) newPlot).isMultiPointer()) {
super.cloneHotHyperLink(oldPlot, newPlot);
}
}
@ -83,7 +140,7 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
@Override
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
if(definition instanceof AbstractDataDefinition) {
if (definition instanceof AbstractDataDefinition) {
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection();
GaugeStyle gaugeStyle = ((VanChartGaugePlot) vanChartPlot).getGaugeStyle();
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.VanChartHeatMapPlot;
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.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;
VanChartHeatMapPlot plot = (VanChartHeatMapPlot)chart.getPlot();
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.plugin.chart.line.LineIndependentVanChart;
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.
*/
public class VanChartLinePlotPane extends AbstractVanChartTypePane {
public class VanChartLinePlotPane extends AbstractRectanglePlotPane {
@Override
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.plugin.chart.attr.plot.VanChartPlot;
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.VanChartMapPlot;
import com.fr.plugin.chart.map.data.VanMapDefinition;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import javax.swing.JPanel;
import java.util.HashSet;
import java.util.Set;
import java.awt.Component;
/**
@ -25,6 +30,14 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
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
protected String[] getTypeIconPath() {
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) {
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);
Plot plot = chart.getPlot();
if (plot instanceof VanChartMapPlot) {
@ -154,4 +167,10 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) {
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];
}
protected void resetChartAttr(Chart chart, Plot newPlot) {
protected void resetChartAttr(VanChart chart, VanChartPlot newPlot) {
super.resetChartAttr(chart, newPlot);
//重置工具栏选项
VanChartTools tools = ((VanChart) chart).getVanChartTools();
VanChartTools tools = chart.getVanChartTools();
if (tools != null) {
tools.setSort(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.log.FineLoggerFactory;
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.vanchart.VanChart;
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 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
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/pie/images/pie.png",
@ -44,6 +61,25 @@ public class VanChartPiePlotPane extends AbstractVanChartTypePane {
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() {
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.diff.BubbleColumnFieldCollection;
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.base.VanChartAttrLine;
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.VanChartScatterPlot;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
import java.util.HashSet;
import java.util.Set;
/**
* 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(){
VanChartScatterPlot newPlot = null;
Chart[] scatterChart = ScatterIndependentVanChart.ScatterVanChartTypes;
@ -95,4 +113,10 @@ public class VanChartScatterPlotPane extends AbstractVanChartTypePane {
}
return false;
}
//是否支持属性的继承
@Override
protected boolean supportExtendAttr(VanChart chart) {
return extendPlotIds.contains(chart.getID());
}
}
Loading…
Cancel
Save