Browse Source

CHART-10225 显示策略 属性兼容

research/11.0
zheng 5 years ago
parent
commit
d4cf35db8f
  1. 48
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  2. 19
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java
  3. 45
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  4. 48
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  5. 85
      designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java

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

@ -8,12 +8,11 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.stable.Constants;
@ -21,8 +20,8 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
import com.fr.van.chart.designer.style.component.LimitPane;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -55,11 +54,8 @@ public class VanChartPlotLegendPane extends BasicPane {
protected UIButtonGroup<Integer> location;
protected UIToggleButton customFloatPositionButton;
protected VanChartFloatPositionPane customFloatPositionPane;
protected UIButtonGroup<Integer> limitSize;
protected UISpinner maxProportion;
private UILabel limitSizeTitle;
private JPanel maxProportionPane;
private LimitPane limitPane;
//高亮显示的按钮
protected UIButtonGroup<Boolean> highlightButton;
@ -232,25 +228,8 @@ public class VanChartPlotLegendPane extends BasicPane {
}
protected JPanel createDisplayStrategy(){
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")});
limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"));
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize);
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));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
limitSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
return panel;
limitPane = new LimitPane(false);
return limitPane;
}
private JPanel createHighlightPane(){
@ -276,15 +255,8 @@ public class VanChartPlotLegendPane extends BasicPane {
//检查显示策略界面是否可用
protected void checkDisplayStrategyUse() {
limitSize.setEnabled(!customFloatPositionButton.isSelected());
checkMaxProPortionUse();
}
//检查最大显示占比是否可用
private void checkMaxProPortionUse() {
maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected());
limitPane.checkMaxProPortionUse();
}
protected void checkBoxUse() {
@ -315,8 +287,7 @@ public class VanChartPlotLegendPane extends BasicPane {
legend.setPosition(-1);
}
legend.setFloating(customFloatPositionButton.isSelected());
legend.setLimitSize(limitSize.getSelectedIndex() == 0);
legend.setMaxHeight(maxProportion.getValue());
legend.setLimitAttribute(limitPane.updateBean());
legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
if(highlightButton != null && highlightButton.getSelectedItem() != null){
@ -336,8 +307,7 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setSelected(legend.isFloating());
customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY());
limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1);
maxProportion.setValue(legend.getMaxHeight());
limitPane.populateBean(legend.getLimitAttribute());
if(highlightButton != null){
highlightButton.setSelectedItem(legend.isHighlight());
}

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

@ -192,26 +192,13 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
public void populateBean(VanChartLegend legend) {
VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend;
if (scatterLegend != null) {
isLegendVisible.setSelected(scatterLegend.isLegendVisible());
textAttrPane.populate(scatterLegend.getFRFont());
borderPane.populate(scatterLegend);
backgroundPane.populate(scatterLegend);
if(!scatterLegend.isFloating()){
location.setSelectedItem(scatterLegend.getPosition());
}
customFloatPositionButton.setSelected(scatterLegend.isFloating());
customFloatPositionPane.setFloatPosition_x(scatterLegend.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(scatterLegend.getFloatPercentY());
limitSize.setSelectedIndex(scatterLegend.isLimitSize() ? 0 : 1);
maxProportion.setValue(scatterLegend.getMaxHeight());
super.populateBean(scatterLegend);
//范围图例部分
legendTypeButton.setSelectedItem(scatterLegend.getLegendType());
gradualLegendPane.populate(scatterLegend.getGradualLegend());
sectionLegendPane.populate(scatterLegend.getSectionLegend());
if(highlightButton != null){
highlightButton.setSelectedItem(legend.isHighlight());
}
}
checkAllUse();
this.checkHighlightVisible();

45
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -11,12 +11,11 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartTitle;
import com.fr.plugin.chart.vanchart.VanChart;
@ -27,8 +26,8 @@ import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane;
import com.fr.van.chart.designer.style.component.LimitPane;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
@ -60,9 +59,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private UIToggleButton useHtml;
private UIToggleButton customFloatPositionButton;
private VanChartFloatPositionPane customFloatPositionPane;
private UIButtonGroup<Integer> limitSize;
private UISpinner maxProportion;
private JPanel maxProportionPane;
private LimitPane limitPane;
protected VanChartStylePane parent;
@ -171,24 +169,8 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
}
private JPanel createDisplayStrategy(){
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")});
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize);
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));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
limitSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel);
limitPane = new LimitPane();
return limitPane;
}
private void initPositionListener(){
@ -250,15 +232,10 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
//检查显示策略界面是否可用
private void checkDisplayStrategyUse() {
limitSize.setEnabled(!customFloatPositionButton.isSelected());
checkMaxProPortionUse();
GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected());
limitPane.checkMaxProPortionUse();
}
//检查最大显示占比是否可用
private void checkMaxProPortionUse() {
maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled());
}
/**
* 弹出框的界面标题
@ -301,8 +278,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
customFloatPositionButton.setSelected(title.isFloating());
customFloatPositionPane.setFloatPosition_x(title.getFloatPercentX());
customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY());
limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1);
maxProportion.setValue(title.getMaxHeight());
limitPane.populateBean(title.getLimitAttribute());
checkAllUse();
}
@ -335,8 +311,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
}
title.setUseHtml(useHtml.isSelected());
title.setFloating(customFloatPositionButton.isSelected());
title.setLimitSize(limitSize.getSelectedIndex() == 0);
title.setMaxHeight(maxProportion.getValue());
title.setLimitAttribute(limitPane.updateBean());
title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
title.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
textAttrPane.update(textAttr);

48
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -12,7 +12,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.style.FormatPane;
import com.fr.design.layout.TableLayout;
@ -31,6 +30,7 @@ import com.fr.stable.StableUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.component.LimitPane;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -71,9 +71,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected UIButtonGroup<Integer> position;
protected UIButtonGroup<Boolean> reversed;
protected UIButtonGroup<Integer> axisLimitSize;
protected UISpinner maxProportion;
protected JPanel maxProportionPane;
private LimitPane limitPane;
protected UIButtonGroup valueFormatStyle;
protected FormatPane valueFormat;
@ -286,24 +284,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}
protected JPanel createDisplayStrategy(double[] row, double[] col){
maxProportion = new UISpinner(0,100,1,30);
axisLimitSize = 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")});
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),axisLimitSize);
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));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
axisLimitSize.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel);
limitPane = new LimitPane();
return limitPane;
}
protected JPanel createValueStylePane(){
@ -360,7 +342,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkAllUse() {
checkCardPane();
checkLabelPane();
checkMaxProPortionUse();
}
protected void checkCardPane() {
@ -392,12 +373,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}
}
//检查最大显示占比是否可用
private void checkMaxProPortionUse() {
if(maxProportionPane != null && axisLimitSize != null){
maxProportionPane.setVisible(axisLimitSize.getSelectedIndex() == 0 && axisLimitSize.isEnabled());
}
}
/**
* 是否是指定类型
@ -516,13 +491,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
//显示策略
private void populateDisplayStrategy(VanChartAxis axis) {
if(axisLimitSize != null){
axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1);
if (limitPane != null) {
limitPane.populateBean(axis.getLimitAttribute());
}
if(maxProportion != null){
maxProportion.setValue(axis.getMaxHeight());
}
}
//格式
@ -637,11 +608,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
//显示策略
private void updateDisplayStrategy(VanChartAxis axis){
if(axisLimitSize != null){
axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0);
}
if(maxProportion != null){
axis.setMaxHeight(maxProportion.getValue());
if (limitPane != null) {
axis.setLimitAttribute(limitPane.updateBean());
}
}

85
designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java

@ -0,0 +1,85 @@
package com.fr.van.chart.designer.style.component;
import com.fr.chartx.attr.LimitAttribute;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by shine on 2019/08/28.
*/
public class LimitPane extends BasicBeanPane<LimitAttribute> {
private UIButtonGroup<Boolean> autoCustomTypeGroup;
private UISpinner maxProportion;
private JPanel maxProportionPane;
public LimitPane() {
this(true);
}
public LimitPane(boolean hasTitle) {
initComponent(hasTitle);
}
private void initComponent(boolean hasTitle) {
maxProportion = new UISpinner(0, 100, 1, 30);
autoCustomTypeGroup = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto")
, Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}, new Boolean[]{true, false});
JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), autoCustomTypeGroup);
maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH);
maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
JPanel panel = new JPanel(new BorderLayout());
panel.add(limitSizePane, BorderLayout.NORTH);
panel.add(maxProportionPane, BorderLayout.CENTER);
autoCustomTypeGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkMaxProPortionUse();
}
});
this.setLayout(new BorderLayout());
if (hasTitle) {
JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel);
this.add(contentPane);
} else {
this.add(panel);
}
}
//检查最大显示占比是否可用
public void checkMaxProPortionUse() {
maxProportion.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled());
maxProportionPane.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled());
}
@Override
public void populateBean(LimitAttribute ob) {
autoCustomTypeGroup.setSelectedItem(ob.isAuto());
maxProportion.setValue(ob.getMaxSize());
}
@Override
public LimitAttribute updateBean() {
LimitAttribute attribute = new LimitAttribute();
attribute.setAuto(autoCustomTypeGroup.getSelectedItem());
attribute.setMaxSize(maxProportion.getValue());
return attribute;
}
@Override
protected String title4PopupWindow() {
return null;
}
}
Loading…
Cancel
Save