From ebabd33dff1ce41ae81495c79f2ea1012075142c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 22 Sep 2020 16:36:51 +0800 Subject: [PATCH] =?UTF-8?q?=09CHART-15566=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/ColorFillStylePane.java | 24 ++++++++++++------- .../ui/detail/chart/ChartTitleStylePane.java | 2 +- .../style/ChartTextAttrPaneWithPreStyle.java | 13 ++++++---- .../gui/style/ColorSelectBoxWithPreStyle.java | 11 +++++---- .../component/VanChartFillStylePane.java | 12 +++++----- .../VanChartBackgroundPaneWithAutoColor.java | 6 +++-- .../VanChartBackgroundPaneWithPreStyle.java | 6 +++-- .../VanChartAbstractPlotSeriesPane.java | 10 +++++++- .../van/chart/map/VanChartMapSeriesPane.java | 4 ++-- 9 files changed, 57 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java index f22221958f..9e2a0d5efd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java @@ -37,17 +37,17 @@ import java.awt.event.ActionListener; */ public class ColorFillStylePane extends BasicBeanPane { - protected ColorSchemeComboBox styleSelectBox; - protected JPanel customPane; - protected JPanel changeColorSetPane; - protected FixedGradientBar colorGradient; + private ColorSchemeComboBox styleSelectBox; + private JPanel customPane; + private JPanel changeColorSetPane; + private FixedGradientBar colorGradient; - protected CardLayout cardLayout; + private CardLayout cardLayout; - protected ColorAdjustPane colorAdjustPane; + private ColorAdjustPane colorAdjustPane; - protected Color[] gradientColors; - protected Color[] accColors; + private Color[] gradientColors; + private Color[] accColors; private boolean gradientSelect = false; @@ -80,6 +80,14 @@ public class ColorFillStylePane extends BasicBeanPane { } + public ColorSchemeComboBox getStyleSelectBox() { + return styleSelectBox; + } + + public JPanel getCustomPane() { + return customPane; + } + protected ColorSchemeComboBox createColorSchemeComboBox() { return new ColorSchemeComboBox(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java index 38fa767d36..d5bc56cd9e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java @@ -35,7 +35,7 @@ public class ChartTitleStylePane extends AbstractChartStylePane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title"); + return Toolkit.i18nText("Fine-Design_Report_Title"); } public void populate(PredefinedChartStyle chartStyle) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java index e1119df318..e27ed43e1e 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java @@ -21,6 +21,9 @@ import java.awt.event.ActionListener; */ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane { + private static final int PREDEFINED_STYLE = 0; + private static final int CUSTOM = 1; + private UIButtonGroup preButton; private JPanel textFontPane; @@ -68,15 +71,15 @@ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane { } private void checkPreButton() { - textFontPane.setVisible(preButton.getSelectedIndex() == 1); - textFontPane.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); + textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM); + textFontPane.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 60) : new Dimension(0, 0)); } public void populate(TextAttr textAttr) { if (textAttr.isPredefinedStyle()) { - preButton.setSelectedIndex(0); + preButton.setSelectedIndex(PREDEFINED_STYLE); } else { - preButton.setSelectedIndex(1); + preButton.setSelectedIndex(CUSTOM); } super.populate(textAttr); checkPreButton(); @@ -84,7 +87,7 @@ public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane { public void update(TextAttr textAttr) { int selectedIndex = preButton.getSelectedIndex(); - if (selectedIndex == 0) { + if (selectedIndex == PREDEFINED_STYLE) { textAttr.setPredefinedStyle(true); } else { textAttr.setPredefinedStyle(false); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java index 5494f4d606..a4a0344fa4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java @@ -24,6 +24,9 @@ import java.awt.event.ActionListener; */ public class ColorSelectBoxWithPreStyle extends BasicPane { + private static final int PREDEFINED_STYLE = 0; + private static final int CUSTOM = 1; + private UIButtonGroup preButton; private ColorSelectBox colorSelectBox; @@ -62,8 +65,8 @@ public class ColorSelectBoxWithPreStyle extends BasicPane { } private void checkPreButton() { - colorSelectBox.setVisible(preButton.getSelectedIndex() == 1); - this.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 55) : new Dimension(0, 23)); + colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM); + this.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23)); } public String title4PopupWindow() { @@ -71,14 +74,14 @@ public class ColorSelectBoxWithPreStyle extends BasicPane { } public void populate(ColorWithPreStyle colorWithPreStyle) { - preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? 0 : 1); + preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? PREDEFINED_STYLE : CUSTOM); colorSelectBox.setSelectObject(colorWithPreStyle.getColor()); checkPreButton(); } public ColorWithPreStyle update() { ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle(); - colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == 0); + colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == PREDEFINED_STYLE); colorWithPreStyle.setColor(colorSelectBox.getSelectObject()); return colorWithPreStyle; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index 54d524d20c..2299c3585e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -27,7 +27,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe } protected void styleSelectBoxChange() { - customPane.setVisible(styleSelectBox.getSelectedIndex() != 0); + getCustomPane().setVisible(getStyleSelectBox().getSelectedIndex() != 0); super.styleSelectBoxChange(); } @@ -49,8 +49,8 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe protected Component[][] contentPaneComponents() { return new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox}, - new Component[]{null, customPane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), getStyleSelectBox()}, + new Component[]{null, getCustomPane()}, }; } @@ -61,14 +61,14 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe public void populateBean(AttrFillStyle condition) { if (condition.isPredefinedStyle()) { - styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT); + getStyleSelectBox().setSelectType(ColorSchemeComboBox.SelectType.DEFAULT); return; } populateBean(condition.getColorFillStyle()); } public void updateBean(AttrFillStyle attrFillStyle) { - if (styleSelectBox.getSelectedIndex() == 0) { + if (getStyleSelectBox().getSelectedIndex() == 0) { attrFillStyle.setPredefinedStyle(true); return; } @@ -83,7 +83,7 @@ public class VanChartFillStylePane extends ColorFillStylePane implements Designe AttrFillStyle attrFillStyle = new AttrFillStyle(); updateBean(attrFillStyle); - styleSelectBox.refresh(); + getStyleSelectBox().refresh(); populateBean(attrFillStyle); GUICoreUtils.repaint(this); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java index ba8c2352d6..cd5d26d4a5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java @@ -13,6 +13,8 @@ import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; */ public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane { + private static final int AUTO = 0; + public VanChartBackgroundPaneWithAutoColor() { super(); } @@ -30,14 +32,14 @@ public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane public void populateBackground(GeneralInfo attr, int begin) { if (attr.isAutoBackground()) { - typeComboBox.setSelectedIndex(0); + typeComboBox.setSelectedIndex(AUTO); return; } super.populateBackground(attr, begin + 1); } public void updateBackground(GeneralInfo attr) { - if (typeComboBox.getSelectedIndex() == 0) { + if (typeComboBox.getSelectedIndex() == AUTO) { attr.setAutoBackground(true); return; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java index bc0a8f7184..fbb66d2e3f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java @@ -15,6 +15,8 @@ import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; */ public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane { + private static final int PREDEFINED_STYLE = 0; + @Override protected void initList() { paneList.add(new NullBackgroundQuickPane() { @@ -31,14 +33,14 @@ public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane { public void populateBackground(GeneralInfo attr, int begin) { BackgroundWithPreStyle backgroundWithPreStyle = attr.getBackgroundWithPreStyle(); if (backgroundWithPreStyle.isPredefinedStyle()) { - typeComboBox.setSelectedIndex(0); + typeComboBox.setSelectedIndex(PREDEFINED_STYLE); return; } super.populateBackground(attr, begin + 1); } public void updateBackground(GeneralInfo attr) { - if (typeComboBox.getSelectedIndex() == 0) { + if (typeComboBox.getSelectedIndex() == PREDEFINED_STYLE) { attr.getBackgroundWithPreStyle().setPredefinedStyle(true); return; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index 855b2658b1..667c73d3ac 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -65,7 +65,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP protected VanChartFillStylePane vanChartFillStylePane;//配色 - protected UINumberDragPane transparent;//不透明度 + private UINumberDragPane transparent;//不透明度 protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸 protected JPanel stackAndAxisEditExpandablePane;//堆積和坐標軸展开面板 @@ -82,6 +82,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP super(parent, plot); } + public UINumberDragPane getTransparent() { + return transparent; + } + + public void setTransparent(UINumberDragPane transparent) { + this.transparent = transparent; + } + protected JPanel getContentPane(boolean custom) { if (custom) { JScrollPane scrollPane = new JScrollPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 1d008aebd6..714afadc2c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -246,7 +246,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { //不透明度 protected JPanel createAlphaPane() { - transparent = new UINumberDragPane(0, 100); + setTransparent(new UINumberDragPane(0, 100)); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; @@ -255,7 +255,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { label.setVerticalAlignment(SwingConstants.TOP); Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(transparent)}, + new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(getTransparent())}, }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE); }