From 3c9245c79cacfc11baaae5c40aa59a5666bbaf69 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 1 Apr 2020 20:01:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?CHART-12817=20=E4=BF=AE=E6=94=B9=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=AD=96=E7=95=A5=E6=96=87=E6=A1=88=E5=92=8C=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartPlotLegendPane.java | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 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 f4e1127f2..d67fdc374 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,6 +8,7 @@ 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.i18n.Toolkit; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -81,7 +82,7 @@ public class VanChartPlotLegendPane extends BasicPane { } protected void initComponents(){ - isLegendVisible = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); + isLegendVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); legendPane = createLegendPane(); double p = TableLayout.PREFERRED; @@ -121,9 +122,9 @@ public class VanChartPlotLegendPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),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(com.fr.design.i18n.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_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } @@ -146,16 +147,16 @@ public class VanChartPlotLegendPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),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(com.fr.design.i18n.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_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } protected 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"), - 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")}; + String[] textArray = {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}; Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"), @@ -167,13 +168,13 @@ public class VanChartPlotLegendPane extends BasicPane { location = new UIButtonGroup(iconArray, valueArray); 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); customFloatPositionButton.setEventBannded(true); Component[][] components = new Component[][]{ 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} }; @@ -182,7 +183,7 @@ public class VanChartPlotLegendPane extends BasicPane { initPositionListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } private void initPositionListener(){ @@ -230,18 +231,17 @@ public class VanChartPlotLegendPane extends BasicPane { protected JPanel createTitleStylePane(){ 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(){ //区域显示策略 恢复用注释。开始删除。 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")); + limitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); + limitSizeTitle = new UILabel(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); + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(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.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(limitSizePane, BorderLayout.NORTH); @@ -262,7 +262,7 @@ public class VanChartPlotLegendPane extends BasicPane { } private JPanel createHighlightPane(){ - highlightButton = new UIButtonGroup(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 f = TableLayout.FILL; @@ -271,7 +271,7 @@ public class VanChartPlotLegendPane extends BasicPane { double[] rowSize = {p,p}; Component[][] components = new Component[][]{ 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); } @@ -295,8 +295,7 @@ public class VanChartPlotLegendPane extends BasicPane { //区域显示策略 恢复用注释。删除下面方法。 //检查最大显示占比是否可用 private void checkMaxProPortionUse() { - maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); + maxProportionPane.setVisible(limitSize.getSelectedIndex() == 1 && limitSize.isEnabled()); } protected void checkBoxUse() { @@ -328,7 +327,7 @@ public class VanChartPlotLegendPane extends BasicPane { } legend.setFloating(customFloatPositionButton.isSelected()); //区域显示策略 恢复用注释。下面2行删除。 - legend.setLimitSize(limitSize.getSelectedIndex() == 0); + legend.setLimitSize(limitSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); //区域显示策略 恢复用注释。取消注释。 //legend.setLimitAttribute(limitPane.updateBean()); @@ -352,7 +351,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); //区域显示策略 恢复用注释。下面2行删除。 - limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); + limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); //区域显示策略 恢复用注释。取消注释。 //limitPane.populateBean(legend.getLimitAttribute()); From afa34b3338efec97e6d4afaf07539028b15c3cfc Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 2 Apr 2020 15:02:34 +0800 Subject: [PATCH 2/4] =?UTF-8?q?CHART-12817=20=E5=9B=BE=E4=BE=8B=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8E=92=E5=88=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/HeatMapRangeLegendPane.java | 9 +- .../style/VanChartPlotLegendPane.java | 112 ++++++++++++++---- .../style/VanChartRangeLegendPane.java | 42 ++++--- 3 files changed, 112 insertions(+), 51 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java index db0d5c864..60c535ceb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java +++ b/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.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.i18n.Toolkit; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; @@ -38,8 +39,8 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { @Override protected UIButtonGroup createLegendTypeButton(){ return new UIButtonGroup(new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") + Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), + Toolkit.i18nText("Fine-Design_Chart_Legend_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) { return new Component[][]{ 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} }; } @@ -64,7 +65,7 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { @Override protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.parent) { + return new SectionLegendPane(this.getLegendPaneParent()) { @Override protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { return new SectionIntervalConfigPaneWithOutNum(parent); 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 d67fdc374..51faecff1 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 @@ -16,6 +16,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; +import com.fr.plugin.chart.type.ArrangeType; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; @@ -45,32 +46,31 @@ public class VanChartPlotLegendPane extends BasicPane { private static final int HEIGHT = 100; private static final int GAP = 20; - protected UICheckBox isLegendVisible; + private UICheckBox isLegendVisible; + private JPanel legendPane; - protected JPanel legendPane; - - protected ChartTextAttrPane textAttrPane; - protected VanChartBorderWithRadiusPane borderPane; - protected VanChartBackgroundWithOutImagePane backgroundPane; - protected UIButtonGroup location; - protected UIToggleButton customFloatPositionButton; - protected VanChartFloatPositionPane customFloatPositionPane; + private ChartTextAttrPane textAttrPane; + private VanChartBorderWithRadiusPane borderPane; + private VanChartBackgroundWithOutImagePane backgroundPane; + private UIButtonGroup location; + private UIToggleButton customFloatPositionButton; + private UIButtonGroup arrangeButton; + private JPanel arrangePane; + private VanChartFloatPositionPane customFloatPositionPane; //区域显示策略 恢复用注释。下面4行删除。 - protected UIButtonGroup limitSize; - protected UISpinner maxProportion; + private UIButtonGroup limitSize; + private UISpinner maxProportion; private UILabel limitSizeTitle; private JPanel maxProportionPane; //区域显示策略 恢复用注释。取消注释。 //private LimitPane limitPane; //高亮显示的按钮 - protected UIButtonGroup highlightButton; - protected JPanel highlightPane; - - - protected VanChartStylePane parent; + private UIButtonGroup highlightButton; + private JPanel highlightPane; + private VanChartStylePane parent; public VanChartPlotLegendPane() { initComponents(); @@ -81,7 +81,27 @@ public class VanChartPlotLegendPane extends BasicPane { initComponents(); } - protected void initComponents(){ + public JPanel getHighlightPane() { + return highlightPane; + } + + public VanChartStylePane getLegendPaneParent() { + return parent; + } + + public JPanel getArrangePane() { + return arrangePane; + } + + public UIButtonGroup getLegendLocation() { + return location; + } + + public UIToggleButton getCustomFloatPositionButton() { + return customFloatPositionButton; + } + + private void initComponents() { isLegendVisible = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Legend_Visible")); legendPane = createLegendPane(); @@ -101,7 +121,7 @@ public class VanChartPlotLegendPane extends BasicPane { addLegendListener(); } - protected void addLegendListener(){ + private void addLegendListener() { isLegendVisible.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkBoxUse(); @@ -154,11 +174,19 @@ public class VanChartPlotLegendPane extends BasicPane { return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } - protected JPanel createTitlePositionPane(double[] row, double[] col){ - String[] textArray = {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")}; + private JPanel createTitlePositionPane(double[] row, double[] col) { + String[] textArray = { + 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}; - 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_left.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png"), @@ -179,19 +207,42 @@ public class VanChartPlotLegendPane extends BasicPane { }; customFloatPositionPane = new VanChartFloatPositionPane(); + arrangePane = createArrangePane(); initPositionListener(); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); + JPanel positionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(positionPane, BorderLayout.NORTH); + panel.add(arrangePane, BorderLayout.CENTER); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } + private JPanel createArrangePane() { + arrangeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Arrange_Flow"), Toolkit.i18nText("Fine-Design_Chart_Arrange_Aligned")}, + new ArrangeType[]{ArrangeType.FLOW, ArrangeType.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")), arrangeButton} + }; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); + } + private void initPositionListener(){ location.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { customFloatPositionButton.setSelected(false); + checkArrangePaneVisible(); checkDisplayStrategyUse(); } }); @@ -201,6 +252,7 @@ public class VanChartPlotLegendPane extends BasicPane { public void mouseClicked(MouseEvent e) { if(!customFloatPositionButton.isSelected()){ customFloatPositionButton.setSelected(true); + checkArrangePaneVisible(); checkDisplayStrategyUse(); } } @@ -229,12 +281,12 @@ public class VanChartPlotLegendPane extends BasicPane { }); } - protected JPanel createTitleStylePane(){ + private JPanel createTitleStylePane() { textAttrPane = new ChartTextAttrPane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); } - protected JPanel createDisplayStrategy(){ + private JPanel createDisplayStrategy() { //区域显示策略 恢复用注释。开始删除。 maxProportion = new UISpinner(0, 100, 1, 30); limitSize = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -278,10 +330,18 @@ public class VanChartPlotLegendPane extends BasicPane { protected void checkAllUse() { checkBoxUse(); + checkArrangePaneVisible(); checkDisplayStrategyUse(); this.repaint(); } + protected void checkArrangePaneVisible() { + boolean visible = !getCustomFloatPositionButton().isSelected() + && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + + arrangePane.setVisible(visible); + } + //检查显示策略界面是否可用 protected void checkDisplayStrategyUse() { //区域显示策略 恢复用注释。下面2行删除。 @@ -326,6 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); + legend.setArrange(arrangeButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 legend.setLimitSize(limitSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); @@ -350,6 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); + arrangeButton.setSelectedItem(legend.getArrange()); //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 2e7ae3278..cb708963b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/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.layout.TableLayout; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.range.VanChartRangeLegend; @@ -49,10 +50,10 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { ordinaryLegendPane = new JPanel(); //渐变色图例面板 gradualLegendPane = createGradualLegendPane(); - gradualLegendPane.setParentPane(parent); + gradualLegendPane.setParentPane(this.getLegendPaneParent()); //区域段图例面板 sectionLegendPane = createSectionLegendPane(); - sectionLegendPane.setParentPane(parent); + sectionLegendPane.setParentPane(this.getLegendPaneParent()); JPanel panel = new JPanel(new CardLayout()){ @Override @@ -79,7 +80,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { } protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.parent); + return new SectionLegendPane(this.getLegendPaneParent()); } private JPanel createTableLayoutPaneWithTitle(String title, Component component) { @@ -88,9 +89,9 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { protected UIButtonGroup createLegendTypeButton(){ return new UIButtonGroup(new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend_Section") + Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), + Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), + Toolkit.i18nText("Fine-Design_Chart_Legend_Section") }, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION}); } @@ -104,7 +105,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { 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)); rangeLegendPane = createRangeLegendPane(); @@ -129,6 +130,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override public void actionPerformed(ActionEvent e) { checkCardPane(); + checkArrangePaneVisible(); } }); } @@ -138,33 +140,29 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); } - @Override - protected void addLegendListener(){ - isLegendVisible.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkBoxUse(); - } - }); - } - @Override protected void checkAllUse() { checkBoxUse(); + checkArrangePaneVisible(); checkDisplayStrategyUse(); checkCardPane(); this.repaint(); } - @Override - protected void checkBoxUse() { - isLegendVisible.setEnabled(true); - legendPane.setVisible(isLegendVisible.isSelected()); + protected void checkArrangePaneVisible() { + boolean visible = legendTypeButton.getSelectedItem() != LegendType.GRADUAL + && !getCustomFloatPositionButton().isSelected() + && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + + getArrangePane().setVisible(visible); } private void checkHighlightVisible(){ - if(this.highlightPane != null){ + JPanel highlightPane = this.getHighlightPane(); + + if (highlightPane != null) { LegendType legendType = legendTypeButton.getSelectedItem(); - this.highlightPane.setVisible(legendType != LegendType.GRADUAL); + highlightPane.setVisible(legendType != LegendType.GRADUAL); } } From e108f4d28ba58ea8318b89bfe567bcaa0487792b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 2 Apr 2020 17:16:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/VanChartPlotLegendPane.java | 44 +++++++++---------- .../style/VanChartRangeLegendPane.java | 11 ++--- 2 files changed, 26 insertions(+), 29 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 51faecff1..acfc7811e 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 @@ -16,7 +16,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; -import com.fr.plugin.chart.type.ArrangeType; +import com.fr.plugin.chart.type.LayoutType; import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFloatPositionPane; @@ -54,8 +54,8 @@ public class VanChartPlotLegendPane extends BasicPane { private VanChartBackgroundWithOutImagePane backgroundPane; private UIButtonGroup location; private UIToggleButton customFloatPositionButton; - private UIButtonGroup arrangeButton; - private JPanel arrangePane; + private UIButtonGroup layoutButton; + private JPanel layoutPane; private VanChartFloatPositionPane customFloatPositionPane; //区域显示策略 恢复用注释。下面4行删除。 @@ -89,10 +89,6 @@ public class VanChartPlotLegendPane extends BasicPane { return parent; } - public JPanel getArrangePane() { - return arrangePane; - } - public UIButtonGroup getLegendLocation() { return location; } @@ -207,7 +203,7 @@ public class VanChartPlotLegendPane extends BasicPane { }; customFloatPositionPane = new VanChartFloatPositionPane(); - arrangePane = createArrangePane(); + layoutPane = createLayoutPane(); initPositionListener(); @@ -215,14 +211,15 @@ public class VanChartPlotLegendPane extends BasicPane { JPanel panel = new JPanel(new BorderLayout()); panel.add(positionPane, BorderLayout.NORTH); - panel.add(arrangePane, BorderLayout.CENTER); + panel.add(layoutPane, BorderLayout.CENTER); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } - private JPanel createArrangePane() { - arrangeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Arrange_Flow"), Toolkit.i18nText("Fine-Design_Chart_Arrange_Aligned")}, - new ArrangeType[]{ArrangeType.FLOW, ArrangeType.ALIGNED}); + 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; @@ -230,7 +227,7 @@ public class VanChartPlotLegendPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), arrangeButton} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrange")), layoutButton} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); @@ -242,7 +239,7 @@ public class VanChartPlotLegendPane extends BasicPane { @Override public void stateChanged(ChangeEvent e) { customFloatPositionButton.setSelected(false); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); } }); @@ -252,7 +249,7 @@ public class VanChartPlotLegendPane extends BasicPane { public void mouseClicked(MouseEvent e) { if(!customFloatPositionButton.isSelected()){ customFloatPositionButton.setSelected(true); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); } } @@ -330,16 +327,19 @@ public class VanChartPlotLegendPane extends BasicPane { protected void checkAllUse() { checkBoxUse(); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); this.repaint(); } - protected void checkArrangePaneVisible() { - boolean visible = !getCustomFloatPositionButton().isSelected() - && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + protected void checkLayoutPaneVisible() { + layoutPane.setVisible(isVisibleLayoutPane()); + } + + protected boolean isVisibleLayoutPane() { + int locationIndex = getLegendLocation().getSelectedIndex(); - arrangePane.setVisible(visible); + return !getCustomFloatPositionButton().isSelected() && (locationIndex == 0 || locationIndex == 1); } //检查显示策略界面是否可用 @@ -386,7 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); - legend.setArrange(arrangeButton.getSelectedItem()); + legend.setLayout(layoutButton.getSelectedItem()); //区域显示策略 恢复用注释。下面2行删除。 legend.setLimitSize(limitSize.getSelectedIndex() == 1); legend.setMaxHeight(maxProportion.getValue()); @@ -411,7 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); - arrangeButton.setSelectedItem(legend.getArrange()); + layoutButton.setSelectedItem(legend.getLayout()); //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(legend.isLimitSize() ? 1 : 0); maxProportion.setValue(legend.getMaxHeight()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index cb708963b..25ef2a15b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -130,7 +130,7 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override public void actionPerformed(ActionEvent e) { checkCardPane(); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); } }); } @@ -143,18 +143,15 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { @Override protected void checkAllUse() { checkBoxUse(); - checkArrangePaneVisible(); + checkLayoutPaneVisible(); checkDisplayStrategyUse(); checkCardPane(); this.repaint(); } - protected void checkArrangePaneVisible() { - boolean visible = legendTypeButton.getSelectedItem() != LegendType.GRADUAL - && !getCustomFloatPositionButton().isSelected() - && (getLegendLocation().getSelectedIndex() == 0 || getLegendLocation().getSelectedIndex() == 1); + protected boolean isVisibleLayoutPane() { - getArrangePane().setVisible(visible); + return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL; } private void checkHighlightVisible(){ From f2300031de0940d63f0af5315f1cf09e644c1d4b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 2 Apr 2020 17:39:04 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B6=88=E9=99=A4=E9=AD=94=E6=9C=AF?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/style/VanChartPlotLegendPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 acfc7811e..faa112952 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 @@ -337,9 +337,13 @@ public class VanChartPlotLegendPane extends BasicPane { } protected boolean isVisibleLayoutPane() { - int locationIndex = getLegendLocation().getSelectedIndex(); + if (customFloatPositionButton.isSelected()) { + return false; + } + + int locationIntValue = getLegendLocation().getSelectedItem(); - return !getCustomFloatPositionButton().isSelected() && (locationIndex == 0 || locationIndex == 1); + return locationIntValue == Constants.TOP || locationIntValue == Constants.BOTTOM; } //检查显示策略界面是否可用