Browse Source

去掉lastTypeIndex,整理相关代码

master
mengao 7 years ago
parent
commit
6a03674544
  1. 7
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java
  2. 11
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  3. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java
  4. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java
  5. 3
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java
  6. 2
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java
  7. 16
      designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java
  8. 15
      designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java
  9. 21
      designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java
  10. 15
      designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java
  11. 7
      designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java
  12. 23
      designer_chart/src/com/fr/plugin/chart/designer/type/AbstractVanChartTypePane.java
  13. 16
      designer_chart/src/com/fr/plugin/chart/gauge/VanChartGaugePlotPane.java
  14. 1
      designer_chart/src/com/fr/plugin/chart/heatmap/designer/type/VanChartHeatMapTypePane.java
  15. 25
      designer_chart/src/com/fr/plugin/chart/line/VanChartLinePlotPane.java
  16. 3
      designer_chart/src/com/fr/plugin/chart/map/designer/type/VanChartMapPlotPane.java
  17. 17
      designer_chart/src/com/fr/plugin/chart/pie/VanChartPiePlotPane.java
  18. 17
      designer_chart/src/com/fr/plugin/chart/radar/VanChartRadarPlotPane.java
  19. 17
      designer_chart/src/com/fr/plugin/chart/structure/desinger/type/VanChartStructureTypePane.java

7
designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java

@ -27,32 +27,25 @@ public abstract class AbstractBarPane extends AbstractChartTypePane {
if(barPlot.getyAxis().isPercentage()) {
if(barPlot instanceof Bar3DPlot){
typeDemo.get(THREE_D_PERCENT_STACK_COLOMN_CHART).isPressing = true;
lastTypeIndex = THREE_D_PERCENT_STACK_COLOMN_CHART;
} else {
typeDemo.get(PERCENT_STACK_COLOMN_CHART).isPressing = true;
lastTypeIndex = PERCENT_STACK_COLOMN_CHART;
}
} else {
if(barPlot instanceof Bar3DPlot){
typeDemo.get(THREE_D_STACK_COLOMN_CHART).isPressing = true;
lastTypeIndex = THREE_D_STACK_COLOMN_CHART;
} else {
typeDemo.get(STACK_COLOMN_CHART).isPressing = true;
lastTypeIndex = STACK_COLOMN_CHART;
}
}
} else {
if(barPlot instanceof Bar3DPlot) {
if(((Bar3DPlot) barPlot).isHorizontalDrawBar()) {
typeDemo.get(THREE_D_COLOMN_HORIZON_DRAW_CHART).isPressing = true;
lastTypeIndex = THREE_D_COLOMN_HORIZON_DRAW_CHART;
} else {
typeDemo.get(THREE_D_COLOMN_CHART).isPressing = true;
lastTypeIndex = THREE_D_COLOMN_CHART;
}
} else {
typeDemo.get(COLOMN_CHART).isPressing = true;
lastTypeIndex = COLOMN_CHART;
}
}

11
designer_chart/src/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -59,7 +59,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
protected abstract String[] getTypeLayoutPath();
protected abstract String[] getTypeLayoutTipName();
protected int lastStyleIndex = -1;
protected int lastTypeIndex = -1;
protected boolean typeChanged = false;//图表类型是否发生变化
protected String[] getNormalLayoutTipName() {
@ -148,12 +147,11 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
return null;
}
protected void checkTypeChange(){
protected void checkTypeChange(Plot oldPlot){
if(styleList != null && !styleList.isEmpty()){
for(int i = 0; i < typeDemo.size(); i++){
if(typeDemo.get(i).isPressing && i != lastTypeIndex){
if(typeDemo.get(i).isPressing && i != oldPlot.getDetailType()){
typeChanged = true;
lastTypeIndex = i;
break;
}
typeChanged = false;
@ -250,8 +248,9 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane<Chart>{
* 保存风格,对选中的风格做设置
*/
public void updateBean(Chart chart) {
checkTypeChange();//判断图表的类型是否发生变化
Plot newPlot = this.setSelectedClonedPlotWithCondition(chart.getPlot());
Plot oldPlot = chart.getPlot();
Plot newPlot = this.setSelectedClonedPlotWithCondition(oldPlot);
checkTypeChange(oldPlot);//判断图表的类型是否发生变化
if(styleList != null && !styleList.isEmpty()){
if(styleList.get(STYLE_SHADE).isPressing && lastStyleIndex != STYLE_SHADE){
lastStyleIndex = STYLE_SHADE;

4
designer_chart/src/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java

@ -74,10 +74,8 @@ public class AreaPlotPane extends AbstractChartTypePane{
if(area.isStacked()) {
if(area.getyAxis().isPercentage()) {
typeDemo.get(PERCENT_AREA_LINE_CHART).isPressing = true;
lastTypeIndex = PERCENT_AREA_LINE_CHART;
} else {
typeDemo.get(STACK_AREA_CHART).isPressing = true;
lastTypeIndex = STACK_AREA_CHART;
}
}
} else if(plot instanceof Area3DPlot) {
@ -85,10 +83,8 @@ public class AreaPlotPane extends AbstractChartTypePane{
if(threeDPlot.isStacked()) {
if(threeDPlot.getyAxis().isPercentage()) {
typeDemo.get(PERCENT_3D_AREA_LINE_CHART).isPressing = true;
lastTypeIndex = PERCENT_3D_AREA_LINE_CHART;
} else {
typeDemo.get(STACK_3D_AREA_CHART).isPressing = true;
lastTypeIndex = STACK_3D_AREA_CHART;
}
}
}

2
designer_chart/src/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java

@ -67,10 +67,8 @@ public class DonutPlotPane extends AbstractChartTypePane{
Plot plot = chart.getPlot();
if(plot instanceof Donut3DPlot) {
typeDemo.get(THREE_D_DONUT_CHART).isPressing = true;
lastTypeIndex = THREE_D_DONUT_CHART;
} else {
typeDemo.get(DONUT_CHART).isPressing = true;
lastTypeIndex = DONUT_CHART;
}
checkDemosBackground();

3
designer_chart/src/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java

@ -137,8 +137,7 @@ public class MapPlotPane extends AbstractChartTypePane {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
typeDemo.get(mapPlot.getMapType().ordinal()).isPressing = true;
lastTypeIndex = mapPlot.getMapType().ordinal();//todo 这个属性是不是可以删了,eason
typeDemo.get(mapPlot.getDetailType()).isPressing = true;
}
checkDemosBackground();

2
designer_chart/src/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java

@ -93,10 +93,8 @@ public class PiePlotPane extends AbstractChartTypePane{
Plot plot = chart.getPlot();
if(plot instanceof Pie3DPlot) {
typeDemo.get(THREE_D_PIE_CHART).isPressing = true;
lastTypeIndex = THREE_D_PIE_CHART;
} else {
typeDemo.get(PIE_CHART).isPressing = true;
lastTypeIndex = PIE_CHART;
}
checkDemosBackground();

16
designer_chart/src/com/fr/plugin/chart/area/VanChartAreaPlotPane.java

@ -2,7 +2,6 @@ package com.fr.plugin.chart.area;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
@ -39,26 +38,13 @@ public class VanChartAreaPlotPane extends AbstractVanChartTypePane {
/**
* 返回界面标题
*
* @return 界面标题
*/
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewArea");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartAreaPlot) {
lastTypeIndex = ((VanChartAreaPlot) plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**

15
designer_chart/src/com/fr/plugin/chart/bar/VanChartBarPlotPane.java

@ -2,7 +2,6 @@ package com.fr.plugin.chart.bar;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.column.VanChartColumnPlot;
@ -46,20 +45,6 @@ public class VanChartBarPlotPane extends AbstractVanChartTypePane {
return Inter.getLocText("Plugin-ChartF_NewBar");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartColumnPlot) {
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID

21
designer_chart/src/com/fr/plugin/chart/bubble/VanChartBubblePlotPane.java

@ -6,7 +6,6 @@ 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.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.VanChartTools;
@ -50,26 +49,6 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane {
return Inter.getLocText("Plugin-ChartF_NewBubble");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot)plot).isForceBubble()){
lastTypeIndex = BubblePlotType.FORCE.ordinal();
} else {
lastTypeIndex = BubblePlotType.NORMAL.ordinal();
}
typeDemo.get(lastTypeIndex).isPressing = true;
checkDemosBackground();
}
private void removeDefaultAttr(ConditionAttr conditionAttr, Class <? extends DataSeriesCondition> targetClass) {
DataSeriesCondition attr = conditionAttr.getExisted(targetClass);

15
designer_chart/src/com/fr/plugin/chart/column/VanChartColumnPlotPane.java

@ -2,7 +2,6 @@ package com.fr.plugin.chart.column;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
@ -46,20 +45,6 @@ public class VanChartColumnPlotPane extends AbstractVanChartTypePane {
return Inter.getLocText("Plugin-ChartF_NewColumn");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartColumnPlot) {
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID

7
designer_chart/src/com/fr/plugin/chart/custom/VanChartCustomPlotPane.java

@ -131,12 +131,12 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
public void updateBean(Chart chart) {
//保存上次选中的值,其会在super中更新
int lastState = lastTypeIndex;
int lastState = chart.getPlot().getDetailType();
super.updateBean(chart);
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
if (lastState != lastTypeIndex) {
if (lastState != chart.getPlot().getDetailType()) {
chart.setFilterDefinition(null);
}
@ -219,8 +219,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
//获取上次选中的图标
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot();
lastTypeIndex = customPlot.getCustomStyle().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
typeDemo.get(customPlot.getDetailType()).isPressing = true;
isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM;

23
designer_chart/src/com/fr/plugin/chart/designer/type/AbstractVanChartTypePane.java

@ -10,6 +10,7 @@ import com.fr.chart.chartglyph.DataSheet;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.Background;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
@ -53,10 +54,15 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{
};
}
//适用一种图表只有一种类型的
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
typeDemo.get(0).isPressing = true;
lastTypeIndex = 0;
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
typeDemo.get(plot.getDetailType()).isPressing = true;
checkDemosBackground();
}
@ -64,9 +70,9 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{
* 保存界面属性
*/
public void updateBean(Chart chart) {
checkTypeChange();
VanChartPlot oldPlot = (VanChartPlot)chart.getPlot();
VanChartPlot newPlot = (VanChartPlot)getSelectedClonedPlot();
VanChartPlot oldPlot = chart.getPlot();
VanChartPlot newPlot = getSelectedClonedPlot();
checkTypeChange(oldPlot);
samePlot = accept(chart);
if(typeChanged && samePlot){
//同一中图表切换不同类型
@ -116,11 +122,10 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{
return new VanChartTools();
}
protected void checkTypeChange(){
protected void checkTypeChange(Plot oldPlot){
for(int i = 0; i < typeDemo.size(); i++){
if(typeDemo.get(i).isPressing && i != lastTypeIndex){
if(typeDemo.get(i).isPressing && i != oldPlot.getDetailType()){
typeChanged = true;
lastTypeIndex = i;
break;
}
typeChanged = false;

16
designer_chart/src/com/fr/plugin/chart/gauge/VanChartGaugePlotPane.java

@ -2,7 +2,6 @@ package com.fr.plugin.chart.gauge;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
@ -43,21 +42,6 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane {
return Inter.getLocText("Plugin-ChartF_NewGauge");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartGaugePlot) {
lastTypeIndex = ((VanChartGaugePlot)plot).getGaugeStyle().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
protected Plot getSelectedClonedPlot(){
VanChartGaugePlot newPlot = null;
Chart[] GaugeChart = GaugeIndependentVanChart.GaugeVanChartTypes;

1
designer_chart/src/com/fr/plugin/chart/heatmap/designer/type/VanChartHeatMapTypePane.java

@ -59,7 +59,6 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane {
//适用一种图表只有一种类型的
public void populateBean(Chart chart) {
typeDemo.get(0).isPressing = true;
lastTypeIndex = 0;
VanChartHeatMapPlot plot = (VanChartHeatMapPlot)chart.getPlot();
populateSourcePane(plot);

25
designer_chart/src/com/fr/plugin/chart/line/VanChartLinePlotPane.java

@ -2,10 +2,8 @@ package com.fr.plugin.chart.line;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.type.VanChartPlotType;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
/**
@ -39,29 +37,6 @@ public class VanChartLinePlotPane extends AbstractVanChartTypePane {
public String title4PopupWindow() {
return Inter.getLocText("Plugin-ChartF_NewLine");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartLinePlot) {
VanChartPlotType plotType = ((VanChartLinePlot)plot).getVanChartPlotType();
switch (plotType){
case CUSTOM:
lastTypeIndex = 2;
break;
default:
lastTypeIndex = plotType.ordinal();
break;
}
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID

3
designer_chart/src/com/fr/plugin/chart/map/designer/type/VanChartMapPlotPane.java

@ -88,8 +88,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
}
VanChartMapPlot plot = (VanChartMapPlot)chart.getPlot();
lastTypeIndex = plot.getMapTypeIndex();
typeDemo.get(lastTypeIndex).isPressing = true;
typeDemo.get(plot.getDetailType()).isPressing = true;
populateSourcePane(plot);
boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(plot.getGeoUrl());

17
designer_chart/src/com/fr/plugin/chart/pie/VanChartPiePlotPane.java

@ -3,7 +3,6 @@ package com.fr.plugin.chart.pie;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.PiePlot4VanChart;
@ -42,22 +41,6 @@ public class VanChartPiePlotPane extends AbstractVanChartTypePane {
return Inter.getLocText("Plugin-ChartF_NewPie");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof PiePlot4VanChart) {
lastTypeIndex = ((PiePlot4VanChart)plot).getRoseType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID
*

17
designer_chart/src/com/fr/plugin/chart/radar/VanChartRadarPlotPane.java

@ -2,7 +2,6 @@ package com.fr.plugin.chart.radar;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane;
@ -38,22 +37,6 @@ public class VanChartRadarPlotPane extends AbstractVanChartTypePane {
return Inter.getLocText("Plugin-ChartF_NewRadar");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartRadarPlot) {
lastTypeIndex = ((VanChartRadarPlot)plot).getVanChartPlotType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
/**
* 获取各图表类型界面ID, 本质是plotID
*

17
designer_chart/src/com/fr/plugin/chart/structure/desinger/type/VanChartStructureTypePane.java

@ -2,7 +2,6 @@ package com.fr.plugin.chart.structure.desinger.type;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.chart.base.VanChartTools;
@ -48,22 +47,6 @@ public class VanChartStructureTypePane extends AbstractVanChartTypePane{
return Inter.getLocText("Plugin-ChartF_NewStructure");
}
/**
* 更新界面内容
*/
public void populateBean(Chart chart) {
for(ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
Plot plot = chart.getPlot();
if(plot instanceof VanChartStructurePlot) {
lastTypeIndex = ((VanChartStructurePlot)plot).getStructureType().ordinal();
typeDemo.get(lastTypeIndex).isPressing = true;
}
checkDemosBackground();
}
protected Plot getSelectedClonedPlot(){
VanChartStructurePlot newPlot = null;
Chart[] charts = StructureIndependentVanChart.StructureVanCharts;

Loading…
Cancel
Save