Browse Source

CHART-12124 代码质量

feature/big-screen
白岳 4 years ago
parent
commit
d3058022af
  1. 30
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

30
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

@ -1,16 +1,13 @@
package com.fr.van.chart.designer.style; package com.fr.van.chart.designer.style;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.range.SectionLegend; import com.fr.plugin.chart.range.SectionLegend;
import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.range.VanChartRangeLegend;
import com.fr.plugin.chart.type.LegendType; import com.fr.plugin.chart.type.LegendType;
import com.fr.van.chart.range.component.GradualLegendPane;
import com.fr.van.chart.range.component.LegendLabelFormatPane; import com.fr.van.chart.range.component.LegendLabelFormatPane;
import com.fr.van.chart.range.component.SectionLegendPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.CardLayout; import java.awt.CardLayout;
@ -25,16 +22,9 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
private static final long serialVersionUID = 1614283200308877353L; private static final long serialVersionUID = 1614283200308877353L;
//散点图不同类型面板容器,容器布局管理 //散点图不同类型面板容器,容器布局管理
private JPanel rangeLegendPane; private JPanel rangeLabelPane;
//图例切换按钮
private UIButtonGroup<LegendType> legendTypeButton;
//普通图例面板(因为普通图例没有新内容,故而为空) //普通图例面板(因为普通图例没有新内容,故而为空)
private JPanel ordinaryLegendPane; private JPanel ordinaryLabelPane;
//渐变色图例面板
private GradualLegendPane gradualLegendPane;
//区域段图例面板
private SectionLegendPane sectionLegendPane;
private LegendLabelFormatPane gradualLabelFormPane; private LegendLabelFormatPane gradualLabelFormPane;
@ -50,8 +40,8 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
super(parent); super(parent);
} }
private JPanel createRangeLegendPane() { private JPanel createRangeLabelPane() {
ordinaryLegendPane = new JPanel(); ordinaryLabelPane = new JPanel();
gradualLabelFormPane = new LegendLabelFormatPane(); gradualLabelFormPane = new LegendLabelFormatPane();
gradualLabelFormPane.setParentPane(this.getLegendPaneParent()); gradualLabelFormPane.setParentPane(this.getLegendPaneParent());
sectionLabelFormPane = new LegendLabelFormatPane() { sectionLabelFormPane = new LegendLabelFormatPane() {
@ -66,7 +56,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if (legendType == LegendType.ORDINARY) { if (legendType == LegendType.ORDINARY) {
return new Dimension(ordinaryLegendPane.getWidth(), 0); return new Dimension(ordinaryLabelPane.getWidth(), 0);
} else if (legendType == LegendType.GRADUAL) { } else if (legendType == LegendType.GRADUAL) {
return gradualLabelFormPane.getPreferredSize(); return gradualLabelFormPane.getPreferredSize();
} else { } else {
@ -75,7 +65,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
} }
}; };
panel.add(ordinaryLegendPane, LegendType.ORDINARY.getStringType()); panel.add(ordinaryLabelPane, LegendType.ORDINARY.getStringType());
panel.add(gradualLabelFormPane, LegendType.GRADUAL.getStringType()); panel.add(gradualLabelFormPane, LegendType.GRADUAL.getStringType());
panel.add(sectionLabelFormPane, LegendType.SECTION.getStringType()); panel.add(sectionLabelFormPane, LegendType.SECTION.getStringType());
@ -88,7 +78,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
@Override @Override
protected JPanel createLegendPane() { protected JPanel createLegendPane() {
rangeLegendPane = createRangeLegendPane(); rangeLabelPane = createRangeLabelPane();
//不包含新内容的普通面板内容 //不包含新内容的普通面板内容
JPanel commonLegendPane = this.createCommonLegendPane(); JPanel commonLegendPane = this.createCommonLegendPane();
@ -98,15 +88,15 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
double[] col = {f}; double[] col = {f};
double[] row = {p, p}; double[] row = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{rangeLegendPane}, new Component[]{rangeLabelPane},
new Component[]{commonLegendPane} new Component[]{commonLegendPane}
}; };
return TableLayoutHelper.createTableLayoutPane(components, row, col); return TableLayoutHelper.createTableLayoutPane(components, row, col);
} }
private void checkCardPane() { private void checkCardPane() {
CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); CardLayout cardLayout = (CardLayout) rangeLabelPane.getLayout();
cardLayout.show(rangeLegendPane, legendType.getStringType()); cardLayout.show(rangeLabelPane, legendType.getStringType());
} }
@Override @Override

Loading…
Cancel
Save