Browse Source

修改兼容方式

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
5a33788f46
  1. 58
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

58
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

@ -20,7 +20,6 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -49,29 +48,10 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private JPanel horizontalColorPane;
private JPanel verticalColorPane;
private Color horizontalColor;
private Color verticalColor;
public VanChartAxisAreaPane() {
initComponents();
}
public Color getHorizontalColor() {
return horizontalColor;
}
public void setHorizontalColor(Color horizontalColor) {
this.horizontalColor = horizontalColor;
}
public Color getVerticalColor() {
return verticalColor;
}
public void setVerticalColor(Color verticalColor) {
this.verticalColor = verticalColor;
}
private void initComponents() {
horizontalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
verticalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
@ -272,44 +252,14 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultXAxis = rectanglePlot.getDefaultXAxis();
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
// CHART-14241 10.0.6向下兼容10.0.5的设计器,分三种情况:
// 1、选中线型为无时,设置颜色为null
// 2、选中线型不为空,但是上次选中的线型为空时,使用上次保存下的color
// 3、选中前后均不为空时,正常set即可
if (defaultXAxis != null) {
LineType selectVerticalType = (LineType) this.verticalLineType.getSelectedItem();
Color selectVerticalColor = verticalColorBox.getSelectObject();
setVerticalColor(selectVerticalColor);
if (selectVerticalType == LineType.NONE) {
defaultXAxis.setMainGridColor(null);
defaultXAxis.setGridLineType(LineType.NONE);
} else if (defaultXAxis.getGridLineType() == LineType.NONE) {
defaultXAxis.setMainGridColor(getVerticalColor());
defaultXAxis.setGridLineType(selectVerticalType);
} else {
defaultXAxis.setMainGridColor(selectVerticalColor);
defaultXAxis.setGridLineType(selectVerticalType);
}
defaultXAxis.setMainGridColor(verticalColorBox.getSelectObject());
defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem());
}
if (defaultYAxis != null) {
LineType selectHorizontalType = (LineType) this.horizonLineType.getSelectedItem();
Color selectHorizontalColor = horizontalColorBox.getSelectObject();
setHorizontalColor(selectHorizontalColor);
if (selectHorizontalType == LineType.NONE) {
defaultYAxis.setMainGridColor(null);
defaultYAxis.setGridLineType(LineType.NONE);
} else if (defaultYAxis.getGridLineType() == LineType.NONE) {
defaultYAxis.setMainGridColor(getHorizontalColor());
defaultYAxis.setGridLineType(selectHorizontalType);
} else {
defaultYAxis.setMainGridColor(selectHorizontalColor);
defaultYAxis.setGridLineType(selectHorizontalType);
}
defaultYAxis.setMainGridColor(horizontalColorBox.getSelectObject());
defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem());
}
}

Loading…
Cancel
Save