From b445b578533e160c3d9b0e6f3d5f55cf6177bd3f Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 17 Feb 2020 15:04:33 +0800 Subject: [PATCH] =?UTF-8?q?CHART-12733=20=E5=8C=BA=E5=9F=9F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=AD=96=E7=95=A5=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartPlotLegendPane.java | 66 ++++++++++++++--- .../designer/style/VanChartTitlePane.java | 64 +++++++++++++--- .../style/axis/VanChartBaseAxisPane.java | 74 ++++++++++++++++--- 3 files changed, 176 insertions(+), 28 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index b29e75265d..f4e1127f24 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -8,11 +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; @@ -20,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,7 +55,13 @@ public class VanChartPlotLegendPane extends BasicPane { protected UIToggleButton customFloatPositionButton; protected VanChartFloatPositionPane customFloatPositionPane; - private LimitPane limitPane; + //区域显示策略 恢复用注释。下面4行删除。 + protected UIButtonGroup limitSize; + protected UISpinner maxProportion; + private UILabel limitSizeTitle; + private JPanel maxProportionPane; + //区域显示策略 恢复用注释。取消注释。 + //private LimitPane limitPane; //高亮显示的按钮 protected UIButtonGroup highlightButton; @@ -228,8 +234,31 @@ public class VanChartPlotLegendPane extends BasicPane { } protected JPanel createDisplayStrategy(){ - limitPane = new LimitPane(false); - return limitPane; + //区域显示策略 恢复用注释。开始删除。 + maxProportion = new UISpinner(0, 100, 1, 30); + limitSize = new UIButtonGroup(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(){ @@ -255,8 +284,19 @@ public class VanChartPlotLegendPane extends BasicPane { //检查显示策略界面是否可用 protected void checkDisplayStrategyUse() { - GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); - limitPane.checkMaxProPortionUse(); + //区域显示策略 恢复用注释。下面2行删除。 + 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()); } protected void checkBoxUse() { @@ -287,7 +327,11 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); - legend.setLimitAttribute(limitPane.updateBean()); + //区域显示策略 恢复用注释。下面2行删除。 + 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){ @@ -307,7 +351,11 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); - limitPane.populateBean(legend.getLimitAttribute()); + //区域显示策略 恢复用注释。下面2行删除。 + limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); + maxProportion.setValue(legend.getMaxHeight()); + //区域显示策略 恢复用注释。取消注释。 + //limitPane.populateBean(legend.getLimitAttribute()); if(highlightButton != null){ highlightButton.setSelectedItem(legend.isHighlight()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 92df8bc6b2..6a7987bcdb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -11,11 +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; @@ -26,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,7 +60,12 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private UIToggleButton customFloatPositionButton; private VanChartFloatPositionPane customFloatPositionPane; - private LimitPane limitPane; + //区域显示策略 恢复用注释。下面3行删除。 + private UIButtonGroup limitSize; + private UISpinner maxProportion; + private JPanel maxProportionPane; + //区域显示策略 恢复用注释。取消注释。 + //private LimitPane limitPane; protected VanChartStylePane parent; @@ -169,8 +174,31 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } private JPanel createDisplayStrategy(){ - limitPane = new LimitPane(); - return limitPane; + //区域显示策略 恢复用注释。开始删除。 + maxProportion = new UISpinner(0, 100, 1, 30); + limitSize = new UIButtonGroup(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(){ @@ -232,10 +260,20 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { //检查显示策略界面是否可用 private void checkDisplayStrategyUse() { - GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); - limitPane.checkMaxProPortionUse(); + //区域显示策略 恢复用注释。下面2行删除。 + 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()); + } /** * 弹出框的界面标题 @@ -278,7 +316,11 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { customFloatPositionButton.setSelected(title.isFloating()); customFloatPositionPane.setFloatPosition_x(title.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY()); - limitPane.populateBean(title.getLimitAttribute()); + //区域显示策略 恢复用注释。下面2行删除。 + limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1); + maxProportion.setValue(title.getMaxHeight()); + //区域显示策略 恢复用注释。取消注释。 + //limitPane.populateBean(title.getLimitAttribute()); checkAllUse(); } @@ -311,7 +353,11 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } title.setUseHtml(useHtml.isSelected()); title.setFloating(customFloatPositionButton.isSelected()); - title.setLimitAttribute(limitPane.updateBean()); + //区域显示策略 恢复用注释。下面2行删除。 + 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); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 8b309840e7..cb60e95cea 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -33,7 +33,6 @@ import com.fr.stable.StringUtils; 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; @@ -80,7 +79,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected UIButtonGroup position; protected UIButtonGroup reversed; - private LimitPane limitPane; + //区域显示策略 恢复用注释。下面3行删除。 + protected UIButtonGroup axisLimitSize; + protected UISpinner maxProportion; + protected JPanel maxProportionPane; + //区域显示策略 恢复用注释。取消注释。 + //private LimitPane limitPane; protected UIButtonGroup valueFormatStyle; protected FormatPane valueFormat; @@ -327,8 +331,29 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } protected JPanel createDisplayStrategy(){ - limitPane = new LimitPane(); - return limitPane; + //区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。 + maxProportion = new UISpinner(0, 100, 1, 30); + axisLimitSize = new UIButtonGroup(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(){ @@ -385,8 +410,20 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkAllUse() { checkCardPane(); checkLabelPane(); - if (limitPane != null){ - limitPane.checkMaxProPortionUse(); + //区域显示策略 恢复用注释。删除下面一行。 + checkMaxProPortionUse(); + + //区域显示策略 恢复用注释。取消注释。 +// if (limitPane != null){ +// limitPane.checkMaxProPortionUse(); +// } + } + + //区域显示策略 恢复用注释。删除此方法。 + //检查最大显示占比是否可用 + private void checkMaxProPortionUse() { + if (maxProportionPane != null && axisLimitSize != null) { + maxProportionPane.setVisible(axisLimitSize.getSelectedIndex() == 0 && axisLimitSize.isEnabled()); } } @@ -553,9 +590,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //显示策略 private void populateDisplayStrategy(VanChartAxis axis) { - if (limitPane != null) { - limitPane.populateBean(axis.getLimitAttribute()); + //区域显示策略 恢复用注释。下面6行删除。 + if (axisLimitSize != null) { + axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1); } + if (maxProportion != null) { + maxProportion.setValue(axis.getMaxHeight()); + } + + //区域显示策略 恢复用注释。取消注释。 +// if (limitPane != null) { +// limitPane.populateBean(axis.getLimitAttribute()); +// } } //格式 @@ -669,9 +715,17 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //显示策略 private void updateDisplayStrategy(VanChartAxis axis){ - if (limitPane != null) { - axis.setLimitAttribute(limitPane.updateBean()); + //区域显示策略 恢复用注释。下面6行删除。 + if (axisLimitSize != null) { + axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); + } + if (maxProportion != null) { + axis.setMaxHeight(maxProportion.getValue()); } + //区域显示策略 恢复用注释。取消注释。 +// if (limitPane != null) { +// axis.setLimitAttribute(limitPane.updateBean()); +// } } protected void updateFormat(VanChartAxis axis) {