Browse Source

Merge pull request #1552 in DESIGN/design from ~QINGHUI.LIU/design:release/10.0 to release/10.0

* commit 'f2300031de0940d63f0af5315f1cf09e644c1d4b':
  消除魔术数
  删除重复代码
  CHART-12817 图例新增排列方式
  CHART-12817 修改显示策略文案和默认值
feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
d3394ae581
  1. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java
  2. 159
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  3. 39
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

9
designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent;
import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
@ -38,8 +39,8 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
@Override @Override
protected UIButtonGroup<LegendType> createLegendTypeButton(){ protected UIButtonGroup<LegendType> createLegendTypeButton(){
return new UIButtonGroup<LegendType>(new String[]{ return new UIButtonGroup<LegendType>(new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") Toolkit.i18nText("Fine-Design_Chart_Legend_Section")
}, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION});
} }
@ -53,7 +54,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) {
return new Component[][]{ return new Component[][]{
new Component[]{minMaxValuePane, null}, new Component[]{minMaxValuePane, null},
new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane},
new Component[]{null, legendGradientBar} new Component[]{null, legendGradientBar}
}; };
} }
@ -64,7 +65,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
@Override @Override
protected SectionLegendPane createSectionLegendPane() { protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(this.parent) { return new SectionLegendPane(this.getLegendPaneParent()) {
@Override @Override
protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) {
return new SectionIntervalConfigPaneWithOutNum(parent); return new SectionIntervalConfigPaneWithOutNum(parent);

159
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -8,6 +8,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -15,6 +16,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.type.LayoutType;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
@ -44,32 +46,31 @@ public class VanChartPlotLegendPane extends BasicPane {
private static final int HEIGHT = 100; private static final int HEIGHT = 100;
private static final int GAP = 20; private static final int GAP = 20;
protected UICheckBox isLegendVisible; private UICheckBox isLegendVisible;
private JPanel legendPane;
protected JPanel legendPane; private ChartTextAttrPane textAttrPane;
private VanChartBorderWithRadiusPane borderPane;
protected ChartTextAttrPane textAttrPane; private VanChartBackgroundWithOutImagePane backgroundPane;
protected VanChartBorderWithRadiusPane borderPane; private UIButtonGroup<Integer> location;
protected VanChartBackgroundWithOutImagePane backgroundPane; private UIToggleButton customFloatPositionButton;
protected UIButtonGroup<Integer> location; private UIButtonGroup<LayoutType> layoutButton;
protected UIToggleButton customFloatPositionButton; private JPanel layoutPane;
protected VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
//区域显示策略 恢复用注释。下面4行删除。 //区域显示策略 恢复用注释。下面4行删除。
protected UIButtonGroup<Integer> limitSize; private UIButtonGroup<Integer> limitSize;
protected UISpinner maxProportion; private UISpinner maxProportion;
private UILabel limitSizeTitle; private UILabel limitSizeTitle;
private JPanel maxProportionPane; private JPanel maxProportionPane;
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//private LimitPane limitPane; //private LimitPane limitPane;
//高亮显示的按钮 //高亮显示的按钮
protected UIButtonGroup<Boolean> highlightButton; private UIButtonGroup<Boolean> highlightButton;
protected JPanel highlightPane; private JPanel highlightPane;
protected VanChartStylePane parent;
private VanChartStylePane parent;
public VanChartPlotLegendPane() { public VanChartPlotLegendPane() {
initComponents(); initComponents();
@ -80,8 +81,24 @@ public class VanChartPlotLegendPane extends BasicPane {
initComponents(); initComponents();
} }
protected void initComponents(){ public JPanel getHighlightPane() {
isLegendVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); return highlightPane;
}
public VanChartStylePane getLegendPaneParent() {
return parent;
}
public UIButtonGroup<Integer> getLegendLocation() {
return location;
}
public UIToggleButton getCustomFloatPositionButton() {
return customFloatPositionButton;
}
private void initComponents() {
isLegendVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Legend_Visible"));
legendPane = createLegendPane(); legendPane = createLegendPane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -100,7 +117,7 @@ public class VanChartPlotLegendPane extends BasicPane {
addLegendListener(); addLegendListener();
} }
protected void addLegendListener(){ private void addLegendListener() {
isLegendVisible.addActionListener(new ActionListener() { isLegendVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkBoxUse(); checkBoxUse();
@ -121,9 +138,9 @@ public class VanChartPlotLegendPane extends BasicPane {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(),null} ,
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@ -146,18 +163,26 @@ public class VanChartPlotLegendPane extends BasicPane {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(),null} ,
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createTitlePositionPane(double[] row, double[] col){ private JPanel createTitlePositionPane(double[] row, double[] col) {
String[] textArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), String[] textArray = {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Right_Top")}; Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"),
Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"),
Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"),
Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right"),
Toolkit.i18nText("Fine-Design_Chart_Right_Top")
};
Integer[] valueArray = {Constants.TOP, Constants.BOTTOM, Constants.LEFT, Constants.RIGHT, Constants.RIGHT_TOP}; Integer[] valueArray = {Constants.TOP, Constants.BOTTOM, Constants.LEFT, Constants.RIGHT, Constants.RIGHT_TOP};
Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"),
Icon[] iconArray = {
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"),
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"),
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_left.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_left.png"),
BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png"),
@ -167,22 +192,45 @@ public class VanChartPlotLegendPane extends BasicPane {
location = new UIButtonGroup<Integer>(iconArray, valueArray); location = new UIButtonGroup<Integer>(iconArray, valueArray);
location.setAllToolTips(textArray); location.setAllToolTips(textArray);
customFloatPositionButton = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position")); customFloatPositionButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Custom_Float_Position"));
UIComponentUtils.setLineWrap(customFloatPositionButton); UIComponentUtils.setLineWrap(customFloatPositionButton);
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location},
new Component[]{null,customFloatPositionButton} new Component[]{null,customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
layoutPane = createLayoutPane();
initPositionListener(); initPositionListener();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel positionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
JPanel panel = new JPanel(new BorderLayout());
panel.add(positionPane, BorderLayout.NORTH);
panel.add(layoutPane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
}
private JPanel createLayoutPane() {
layoutButton = new UIButtonGroup<>(
new String[]{Toolkit.i18nText("Fine-Design_Chart_Layout_Flow"), Toolkit.i18nText("Fine-Design_Chart_Layout_Aligned")},
new LayoutType[]{LayoutType.FLOW, LayoutType.ALIGNED});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), layoutButton}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private void initPositionListener(){ private void initPositionListener(){
@ -191,6 +239,7 @@ public class VanChartPlotLegendPane extends BasicPane {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
customFloatPositionButton.setSelected(false); customFloatPositionButton.setSelected(false);
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
} }
}); });
@ -200,6 +249,7 @@ public class VanChartPlotLegendPane extends BasicPane {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(!customFloatPositionButton.isSelected()){ if(!customFloatPositionButton.isSelected()){
customFloatPositionButton.setSelected(true); customFloatPositionButton.setSelected(true);
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
} }
} }
@ -228,20 +278,19 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
} }
protected JPanel createTitleStylePane(){ private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }
protected JPanel createDisplayStrategy(){ private JPanel createDisplayStrategy() {
//区域显示策略 恢复用注释。开始删除。 //区域显示策略 恢复用注释。开始删除。
maxProportion = new UISpinner(0, 100, 1, 30); maxProportion = new UISpinner(0, 100, 1, 30);
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); limitSize = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")});
limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")); limitSizeTitle = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"));
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize);
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH); panel.add(limitSizePane, BorderLayout.NORTH);
@ -262,7 +311,7 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
private JPanel createHighlightPane(){ private JPanel createHighlightPane(){
highlightButton = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -271,17 +320,32 @@ public class VanChartPlotLegendPane extends BasicPane {
double[] rowSize = {p,p}; double[] rowSize = {p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Highlight")),highlightButton} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")),highlightButton}
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize);
} }
protected void checkAllUse() { protected void checkAllUse() {
checkBoxUse(); checkBoxUse();
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
this.repaint(); this.repaint();
} }
protected void checkLayoutPaneVisible() {
layoutPane.setVisible(isVisibleLayoutPane());
}
protected boolean isVisibleLayoutPane() {
if (customFloatPositionButton.isSelected()) {
return false;
}
int locationIntValue = getLegendLocation().getSelectedItem();
return locationIntValue == Constants.TOP || locationIntValue == Constants.BOTTOM;
}
//检查显示策略界面是否可用 //检查显示策略界面是否可用
protected void checkDisplayStrategyUse() { protected void checkDisplayStrategyUse() {
//区域显示策略 恢复用注释。下面2行删除。 //区域显示策略 恢复用注释。下面2行删除。
@ -295,8 +359,7 @@ public class VanChartPlotLegendPane extends BasicPane {
//区域显示策略 恢复用注释。删除下面方法。 //区域显示策略 恢复用注释。删除下面方法。
//检查最大显示占比是否可用 //检查最大显示占比是否可用
private void checkMaxProPortionUse() { private void checkMaxProPortionUse() {
maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); maxProportionPane.setVisible(limitSize.getSelectedIndex() == 1 && limitSize.isEnabled());
maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
} }
protected void checkBoxUse() { protected void checkBoxUse() {
@ -327,8 +390,9 @@ public class VanChartPlotLegendPane extends BasicPane {
legend.setPosition(-1); legend.setPosition(-1);
} }
legend.setFloating(customFloatPositionButton.isSelected()); legend.setFloating(customFloatPositionButton.isSelected());
legend.setLayout(layoutButton.getSelectedItem());
//区域显示策略 恢复用注释。下面2行删除。 //区域显示策略 恢复用注释。下面2行删除。
legend.setLimitSize(limitSize.getSelectedIndex() == 0); legend.setLimitSize(limitSize.getSelectedIndex() == 1);
legend.setMaxHeight(maxProportion.getValue()); legend.setMaxHeight(maxProportion.getValue());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//legend.setLimitAttribute(limitPane.updateBean()); //legend.setLimitAttribute(limitPane.updateBean());
@ -351,8 +415,9 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionButton.setSelected(legend.isFloating());
customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY());
layoutButton.setSelectedItem(legend.getLayout());
//区域显示策略 恢复用注释。下面2行删除。 //区域显示策略 恢复用注释。下面2行删除。
limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0);
maxProportion.setValue(legend.getMaxHeight()); maxProportion.setValue(legend.getMaxHeight());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//limitPane.populateBean(legend.getLimitAttribute()); //limitPane.populateBean(legend.getLimitAttribute());

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

@ -3,6 +3,7 @@ package com.fr.van.chart.designer.style;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.i18n.Toolkit;
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.VanChartRangeLegend; import com.fr.plugin.chart.range.VanChartRangeLegend;
@ -49,10 +50,10 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
ordinaryLegendPane = new JPanel(); ordinaryLegendPane = new JPanel();
//渐变色图例面板 //渐变色图例面板
gradualLegendPane = createGradualLegendPane(); gradualLegendPane = createGradualLegendPane();
gradualLegendPane.setParentPane(parent); gradualLegendPane.setParentPane(this.getLegendPaneParent());
//区域段图例面板 //区域段图例面板
sectionLegendPane = createSectionLegendPane(); sectionLegendPane = createSectionLegendPane();
sectionLegendPane.setParentPane(parent); sectionLegendPane.setParentPane(this.getLegendPaneParent());
JPanel panel = new JPanel(new CardLayout()){ JPanel panel = new JPanel(new CardLayout()){
@Override @Override
@ -79,7 +80,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
} }
protected SectionLegendPane createSectionLegendPane() { protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(this.parent); return new SectionLegendPane(this.getLegendPaneParent());
} }
private JPanel createTableLayoutPaneWithTitle(String title, Component component) { private JPanel createTableLayoutPaneWithTitle(String title, Component component) {
@ -88,9 +89,9 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
protected UIButtonGroup<LegendType> createLegendTypeButton(){ protected UIButtonGroup<LegendType> createLegendTypeButton(){
return new UIButtonGroup<LegendType>(new String[]{ return new UIButtonGroup<LegendType>(new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") Toolkit.i18nText("Fine-Design_Chart_Legend_Section")
}, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION}); }, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION});
} }
@ -104,7 +105,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
initLegendTypeButtonListener(); initLegendTypeButtonListener();
JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Form"),legendTypeButton); JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Legend_Form"), legendTypeButton);
legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
rangeLegendPane = createRangeLegendPane(); rangeLegendPane = createRangeLegendPane();
@ -129,6 +130,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkCardPane(); checkCardPane();
checkLayoutPaneVisible();
} }
}); });
} }
@ -138,33 +140,26 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType());
} }
@Override
protected void addLegendListener(){
isLegendVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkBoxUse();
}
});
}
@Override @Override
protected void checkAllUse() { protected void checkAllUse() {
checkBoxUse(); checkBoxUse();
checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
checkCardPane(); checkCardPane();
this.repaint(); this.repaint();
} }
@Override protected boolean isVisibleLayoutPane() {
protected void checkBoxUse() {
isLegendVisible.setEnabled(true); return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL;
legendPane.setVisible(isLegendVisible.isSelected());
} }
private void checkHighlightVisible(){ private void checkHighlightVisible(){
if(this.highlightPane != null){ JPanel highlightPane = this.getHighlightPane();
if (highlightPane != null) {
LegendType legendType = legendTypeButton.getSelectedItem(); LegendType legendType = legendTypeButton.getSelectedItem();
this.highlightPane.setVisible(legendType != LegendType.GRADUAL); highlightPane.setVisible(legendType != LegendType.GRADUAL);
} }
} }

Loading…
Cancel
Save