From d325410286cbe8b3de5ae33fc7eb129105afbacc Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Tue, 3 Mar 2020 23:01:36 +0800 Subject: [PATCH 01/16] =?UTF-8?q?CHART-9435=20=E8=AF=95=E7=AE=A1=E5=9E=8B?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../series/VanChartAbstractPlotSeriesPane.java | 7 +++++++ .../chart/gauge/VanChartGaugeSeriesPane.java | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) 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 47b205f85f..cea370897f 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 @@ -166,6 +166,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; } + //沿用半径界面,使用不同的title和radius + protected JPanel createRadiusPane(String title) { + radiusPane = initRadiusPane(); + radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(title, radiusPane); + return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; + } + //大数据模式 恢复用注释。删除下面4个方法 createLargeDataModelPane checkLarge createLargeDataModelPane createLargeDataModelGroup。 protected JPanel createLargeDataModelPane() { largeDataModelGroup = createLargeDataModelGroup(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 79509aee25..6fc02b40e2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.design.gui.ibutton.UIButtonGroup; 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.gui.ChartStylePane; @@ -46,6 +47,8 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { private UIColorPickerPane colorPickerPane; + private UISpinner thermometerWidth; + public VanChartGaugeSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -133,7 +136,8 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null}, + getThermometerWidth() }; default: return new Component[][]{ @@ -172,6 +176,11 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; } + private Component[] getThermometerWidth() { + thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); + return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; + } + private void initRotate() { rotate = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); } @@ -218,6 +227,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(innerPaneBackgroundColor != null){ innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor()); } + if(thermometerWidth != null){ + thermometerWidth.setValue(detailStyle.getThermometerWidth()); + } colorPickerPane.populateBean(detailStyle.getHotAreaColor()); } @@ -256,6 +268,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(innerPaneBackgroundColor != null){ detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject()); } + if(thermometerWidth != null){ + detailStyle.setThermometerWidth(thermometerWidth.getValue()); + } colorPickerPane.updateBean(detailStyle.getHotAreaColor()); } From 0fbd73b454d0f86cc07493a7ad9cec66e9eb1229 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 4 Mar 2020 09:48:12 +0800 Subject: [PATCH 02/16] =?UTF-8?q?CHART-9435=20=E4=BF=AE=E6=94=B9=E5=8D=8A?= =?UTF-8?q?=E5=BE=84=E8=AE=BE=E7=BD=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/series/VanChartAbstractPlotSeriesPane.java | 7 ------- .../com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java | 6 +++--- .../java/com/fr/van/chart/pie/VanChartPieSeriesPane.java | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) 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 cea370897f..eec3cf9a12 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 @@ -160,13 +160,6 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } //半径界面 - protected JPanel createRadiusPane() { - radiusPane = initRadiusPane(); - radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set"), radiusPane); - return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; - } - - //沿用半径界面,使用不同的title和radius protected JPanel createRadiusPane(String title) { radiusPane = initRadiusPane(); radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(title, radiusPane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 6fc02b40e2..e553306a29 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -122,14 +122,14 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getPaneBackgroundColor(), getInnerPaneBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} }; case SLOT: return new Component[][]{ new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} }; case THERMOMETER: return new Component[][]{ @@ -146,7 +146,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { getHingeBackgroundColor(), getNeedleColor(), getPaneBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} }; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 0ec79c3b8a..752d7c3098 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -61,7 +61,7 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, - new Component[]{createRadiusPane(),null}, + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")),null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} }; From d8e3489f83ed24628646d2b10978107162fcd9c2 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 4 Mar 2020 17:50:09 +0800 Subject: [PATCH 03/16] =?UTF-8?q?CHART-9435=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gauge/VanChartGaugeSeriesPane.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index e553306a29..0dbb0289f4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -48,6 +49,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { private UIColorPickerPane colorPickerPane; private UISpinner thermometerWidth; + private UINumberDragPane chutePercent; public VanChartGaugeSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); @@ -122,14 +124,16 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getPaneBackgroundColor(), getInnerPaneBackgroundColor(), - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + getChutePercent() }; case SLOT: return new Component[][]{ new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} + new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + getChutePercent() }; case THERMOMETER: return new Component[][]{ @@ -181,6 +185,11 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; } + private Component[] getChutePercent() { + chutePercent = new UINumberDragPane(0, 100, 1); + return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; + } + private void initRotate() { rotate = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); } @@ -230,6 +239,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(thermometerWidth != null){ thermometerWidth.setValue(detailStyle.getThermometerWidth()); } + if(chutePercent != null){ + chutePercent.populateBean(detailStyle.getChutePercent()); + } colorPickerPane.populateBean(detailStyle.getHotAreaColor()); } @@ -271,6 +283,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(thermometerWidth != null){ detailStyle.setThermometerWidth(thermometerWidth.getValue()); } + if(chutePercent != null){ + detailStyle.setChutePercent(chutePercent.updateBean()); + } colorPickerPane.updateBean(detailStyle.getHotAreaColor()); } From 2da7596a921cacb43880c1495ed8a8b8836de90a Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 5 Mar 2020 00:25:00 +0800 Subject: [PATCH 04/16] =?UTF-8?q?CHART-9435=20=E8=AF=95=E7=AE=A1=E5=9E=8B?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E7=BA=B5=E5=90=91=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hartGaugeCateOrPercentLabelDetailPane.java | 10 -- .../label/VanChartGaugeLabelDetailPane.java | 134 +++++++++++++++++- .../VanChartGaugeValueLabelDetailPane.java | 10 -- .../label/VanChartPlotLabelDetailPane.java | 26 ++-- 4 files changed, 146 insertions(+), 34 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index 4199e8f7c3..3b88a031a1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -4,8 +4,6 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; @@ -24,8 +22,6 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe private static final long serialVersionUID = 5176535960949074945L; - private GaugeStyle gaugeStyle; - public VanChartGaugeCateOrPercentLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } @@ -34,12 +30,6 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe return hasLabelPosition(plot) ? new double[]{p,p,p} : new double[]{p,p}; } - private void initGaugeStyle(Plot plot) { - if(gaugeStyle == null){ - gaugeStyle = ((VanChartGaugePlot)plot).getGaugeStyle(); - } - } - protected void initToolTipContentPane(Plot plot) { initGaugeStyle(plot); switch (gaugeStyle){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 3cf057df59..e26b771beb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -1,14 +1,25 @@ package com.fr.van.chart.designer.style.label; +import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.TwoTuple; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.base.AttrLabelDetail; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.type.GaugeStyle; +import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; import java.awt.Component; /** @@ -16,10 +27,21 @@ import java.awt.Component; */ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { + protected GaugeStyle gaugeStyle; + protected UIButtonGroup align; + private JPanel alignPane; + protected Integer[] oldAlignValues; + public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } + protected void initGaugeStyle(Plot plot) { + if (gaugeStyle == null) { + gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + } + } + protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -30,16 +52,118 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); } - - protected ChartTextAttrPane initTextFontPane () { + protected ChartTextAttrPane initTextFontPane() { return new ChartTextAttrPane(); } - protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ - return TableLayoutHelper.createTableLayoutPane(comps,row,col); + protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { + return TableLayoutHelper.createTableLayoutPane(comps, row, col); } protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { return TableLayout4VanChartHelper.createGapTableLayoutPane(title, panel); } + + protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { + if (hasLabelAlign(plot)) { + + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null}, + new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null}, + new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, + }; + } else { + return super.getLabelPaneComponents(plot, p, columnSize); + } + } + + private JPanel createLabelAlignPane(String title) { + JPanel panel = new JPanel(new BorderLayout()); + + alignPane = new JPanel(); + checkAlignPane(title); + panel.add(alignPane, BorderLayout.CENTER); + + return panel; + } + + protected void checkAlignPane(String title) { + if (alignPane == null && !hasLabelAlign(getPlot())) { + return; + } + if (alignPane != null && !hasLabelAlign(getPlot())) { + oldAlignValues = null; + alignPane.removeAll(); + return; + } + if (alignPane == null && hasLabelAlign(getPlot())) { + alignPane = new JPanel(); + } + TwoTuple result = getAlignNamesAndValues(); + + String[] names = result.getFirst(); + Integer[] values = result.getSecond(); + if (ComparatorUtils.equals(values, oldAlignValues)) { + return; + } + + oldAlignValues = values; + + align = new UIButtonGroup(names, values); + + Component[][] comps = new Component[2][2]; + + comps[0] = new Component[]{null, null}; + comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), align}; + + double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + + alignPane.removeAll(); + alignPane.setLayout(new BorderLayout()); + alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); + + if (parent != null) { + parent.initListener(alignPane); + } + } + + private TwoTuple getAlignNamesAndValues() { + String[] names = new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow"), Toolkit.i18nText("Fine-Design_Chart_Align_Left"), Toolkit.i18nText("Fine-Design_Chart_Align_Right")}; + Integer[] values = new Integer[]{ChartConstants.AUTO_LABEL_POSITION, Constants.LEFT, Constants.RIGHT}; + + return new TwoTuple<>(names, values); + } + + protected void checkPane() { + String verticalTitle = hasLabelAlign(getPlot()) + ? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical") + : Toolkit.i18nText("Fine-Design_Chart_Layout_Position"); + + checkPositionPane(verticalTitle); + checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); + } + + private boolean hasLabelAlign(Plot plot) { + return ComparatorUtils.equals(gaugeStyle, GaugeStyle.THERMOMETER) && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); + } + + public void populate(AttrLabelDetail detail) { + super.populate(detail); + + if (hasLabelAlign(this.getPlot()) && align != null) { + align.setSelectedItem(detail.getAlign()); + } + } + + public void update(AttrLabelDetail detail) { + super.update(detail); + + if (align != null && align.getSelectedItem() != null) { + detail.setAlign(align.getSelectedItem()); + } else if (align != null) { + align.setSelectedItem(detail.getAlign()); + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index 1d66925554..3bb3a8a085 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java @@ -1,8 +1,6 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.gauge.VanChartGaugePlot; -import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; import com.fr.van.chart.designer.component.label.LabelContentPaneWithOutCate; @@ -17,18 +15,10 @@ import java.awt.Component; public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailPane { private static final long serialVersionUID = 2601073419430634281L; - private GaugeStyle gaugeStyle; - public VanChartGaugeValueLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } - private void initGaugeStyle(Plot plot) { - if(gaugeStyle == null){ - gaugeStyle = ((VanChartGaugePlot)plot).getGaugeStyle(); - } - } - protected void initToolTipContentPane(Plot plot) { initGaugeStyle(plot); switch (gaugeStyle){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index b774de89ea..fde3150947 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -11,6 +11,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; @@ -65,6 +66,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane { this.add(contentPane,BorderLayout.CENTER); } + public Plot getPlot() { + return plot; + } + //默认从factory中取 protected void initToolTipContentPane(Plot plot) { dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this); @@ -85,7 +90,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(hasLabelPosition(plot)){ return new Component[][]{ new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelPositionPane(new double[]{p,p,p}, columnSize, plot),null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, }; } else { @@ -112,7 +117,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); } - private TwoTuple getPositionNamesAndValues() { + protected TwoTuple getPositionNamesAndValues() { if (plot instanceof VanChartLabelPositionPlot) { String[] names = ((VanChartLabelPositionPlot) plot).getLabelLocationNameArray(); @@ -130,7 +135,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return null; } - private JPanel createLabelPositionPane(double[] row, double[] col, Plot plot) { + protected JPanel createLabelPositionPane(String title, Plot plot) { if (getPositionNamesAndValues() == null) { return new JPanel(); @@ -141,7 +146,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { JPanel panel = new JPanel(new BorderLayout()); positionPane = new JPanel(); - checkPositionPane(); + checkPositionPane(title); panel.add(positionPane, BorderLayout.CENTER); @@ -156,7 +161,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return panel; } - private void checkPositionPane() { + protected void checkPositionPane(String title) { if (positionPane == null) { return; } @@ -176,7 +181,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { Component[][] comps = new Component[2][2]; comps[0] = new Component[]{null, null}; - comps[1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), SwingConstants.LEFT), position}; + comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), position}; double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; @@ -277,9 +282,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane { tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); } - public void populate(AttrLabelDetail detail) { - checkPositionPane(); + protected void checkPane(){ + checkPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")); + } + public void populate(AttrLabelDetail detail) { + checkPane(); dataLabelContentPane.populateBean(detail.getContent()); if(position != null){ position.setSelectedItem(detail.getPosition()); @@ -306,7 +314,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(position != null && position.getSelectedItem() != null){ detail.setPosition(position.getSelectedItem()); - + } else if(position != null){ position.setSelectedItem(detail.getPosition()); } From 7f09adc46dd1b3f1a1542d9a968784ea1e2b57cb Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 5 Mar 2020 00:35:03 +0800 Subject: [PATCH 05/16] =?UTF-8?q?CHART-9435=20=E4=BF=AE=E6=94=B9=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E6=96=B9=E6=B3=95=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gauge/VanChartGaugeSeriesPane.java | 39 ++++++++++--------- .../van/chart/pie/VanChartPieSeriesPane.java | 15 +++---- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 0dbb0289f4..564f45f9a3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; import com.fr.design.style.color.ColorSelectBox; import com.fr.general.ComparatorUtils; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabel; @@ -71,15 +72,15 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { } private JPanel createGaugeLayoutPane() { - gaugeLayout = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"),gaugeLayout); + gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"),gaugeLayout); gaugeLayout.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { changeLabelPosition(); } }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); } private void changeLabelPosition() { @@ -109,10 +110,10 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col); panel.add(centerPanel, BorderLayout.CENTER); if(rotate != null){ - JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); + JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); panel.add(panel1, BorderLayout.NORTH); } - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } private Component[][] getDiffComponentsWithGaugeStyle() { @@ -124,7 +125,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getPaneBackgroundColor(), getInnerPaneBackgroundColor(), - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, getChutePercent() }; case SLOT: @@ -132,7 +133,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, getChutePercent() }; case THERMOMETER: @@ -140,7 +141,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null}, + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null}, getThermometerWidth() }; default: @@ -150,58 +151,58 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { getHingeBackgroundColor(), getNeedleColor(), getPaneBackgroundColor(), - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} }; } } private Component[] getHingeColor() { hingeColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; } private Component[] getHingeBackgroundColor() { hingeBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; } private Component[] getNeedleColor() { needleColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; } private Component[] getPaneBackgroundColor() { paneBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; } private Component[] getSlotBackgroundColor() { slotBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; } private Component[] getThermometerWidth() { thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; } private Component[] getChutePercent() { chutePercent = new UINumberDragPane(0, 100, 1); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; } private void initRotate() { - rotate = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); + rotate = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); } private Component[] getInnerPaneBackgroundColor() { innerPaneBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; } private JPanel createGaugeBandsPane() { colorPickerPane = new ColorPickerPaneWithFormula(parentPane, "meterString"); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 752d7c3098..2169c4a20c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -8,6 +8,7 @@ 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.gui.ChartStylePane; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -53,21 +54,21 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); innerRadius = new UISpinner(0, 100, 1, 0); - supportRotation = 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}); + supportRotation = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, - new Component[]{createRadiusPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set")),null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")),null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } public void populateBean(Plot plot) { From 625dcd8f58a00e9f8ee92f5bd0bf8a946a701310 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 5 Mar 2020 23:27:31 +0800 Subject: [PATCH 06/16] =?UTF-8?q?CHART-9435=20=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E5=A4=A7=E5=B0=8F=E8=87=AA=E5=8A=A8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/style/ChartTextAttrNoColorPane.java | 3 +- .../style/ChartTextAttrNoFontSizePane.java | 7 +- .../chart/gui/style/ChartTextAttrPane.java | 66 +++++++++++--- ...hartGaugeCateOrPercentLabelDetailPane.java | 88 ++++--------------- .../label/VanChartGaugeLabelDetailPane.java | 58 ++++++++++-- .../VanChartGaugeValueLabelDetailPane.java | 44 ++++------ .../label/VanChartPlotLabelDetailPane.java | 5 +- 7 files changed, 143 insertions(+), 128 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java index 820f0c3358..64d4526c8a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java @@ -32,9 +32,10 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ } protected void initComponents() { + initFontSizes(); fontColor = new UIColorButton(); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(Font_Sizes); + fontSizeComboBox = new UIComboBox(getFontSizes()); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java index e1b17eb156..110b9d786b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java @@ -23,17 +23,18 @@ import com.fr.design.utils.gui.GUICoreUtils; * @version 创建时间:2013-1-21 下午03:35:47 */ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { - + private static final long serialVersionUID = 4890526255627852602L; public ChartTextAttrNoFontSizePane() { super(); } - + protected void initComponents() { + initFontSizes(); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontColor = new UIColorButton(); - fontSizeComboBox = new UIComboBox(Font_Sizes); + fontSizeComboBox = new UIComboBox(getFontSizes()); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index dea30d0c97..5ffbfde87f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.style; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; +import com.fr.design.i18n.Toolkit; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserverListener; @@ -12,6 +13,7 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -27,23 +29,49 @@ public class ChartTextAttrPane extends BasicPane { private static final long serialVersionUID = 6731679928019436869L; private static final int FONT_START = 6; private static final int FONT_END = 72; + private static final String auto = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); + private static final int autoSizeInt = 0; + private String[] fontSizes; + private boolean isFontSizeAuto; protected UIComboBox fontNameComboBox; protected UIComboBox fontSizeComboBox; protected UIToggleButton bold; protected UIToggleButton italic; protected UIColorButton fontColor; - public static Integer[] Font_Sizes = new Integer[FONT_END-FONT_START+1]; - static{ - for(int i = FONT_START; i <= FONT_END; i++){ - Font_Sizes [i - FONT_START] = new Integer(i); - } - } + public ChartTextAttrPane() { + this.isFontSizeAuto = false; initComponents(); } - /** - * 标题 + public ChartTextAttrPane(boolean isFontSizeAuto) { + this.isFontSizeAuto = isFontSizeAuto; + initComponents(); + } + + public String[] getFontSizes() { + return fontSizes; + } + + protected void initFontSizes() { + if (isFontSizeAuto) { + fontSizes = new String[FONT_END - FONT_START + 2]; + + fontSizes[0] = auto; + + for (int i = 1; i < fontSizes.length; i++) { + fontSizes[i] = Utils.objectToString(i + FONT_START); + } + } else { + fontSizes = new String[FONT_END - FONT_START + 1]; + + for (int i = 0; i < fontSizes.length; i++) { + fontSizes[i] = Utils.objectToString(i + FONT_START); + } + } + } + + /* 标题 * @return 标题 */ public String title4PopupWindow() { @@ -84,8 +112,12 @@ public class ChartTextAttrPane extends BasicPane { fontNameComboBox.setSelectedItem(frFont.getFamily()); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); - if(fontSizeComboBox != null) { - fontSizeComboBox.setSelectedItem(frFont.getSize()); + if (fontSizeComboBox != null) { + if (frFont.getSize() == autoSizeInt) { + fontSizeComboBox.setSelectedItem(auto); + } else { + fontSizeComboBox.setSelectedItem(frFont.getSize() + ""); + } } if (fontColor != null) { fontColor.setColor(frFont.getForeground()); @@ -108,10 +140,12 @@ public class ChartTextAttrPane extends BasicPane { /** * 更新字 + * * @return 更新字 */ public FRFont updateFRFont() { int style = Font.PLAIN; + float size; if (bold.isSelected() && !italic.isSelected()) { style = Font.BOLD; } else if (!bold.isSelected() && italic.isSelected()) { @@ -119,8 +153,13 @@ public class ChartTextAttrPane extends BasicPane { } else if (bold.isSelected() && italic.isSelected()) { style = 3; } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, - Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem())), fontColor.getColor()); + if (ComparatorUtils.equals(fontSizeComboBox.getSelectedItem(), auto)) { + size = Float.parseFloat(Utils.objectToString(autoSizeInt)); + } else { + size = Float.parseFloat(Utils.objectToString(fontSizeComboBox.getSelectedItem())); + } + + return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, size, fontColor.getColor()); } public void setEnabled(boolean enabled) { @@ -132,8 +171,9 @@ public class ChartTextAttrPane extends BasicPane { } protected void initComponents() { + initFontSizes(); fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(Font_Sizes); + fontSizeComboBox = new UIComboBox(fontSizes); fontColor = new UIColorButton(); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index 3b88a031a1..d96140a8f3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -1,9 +1,7 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; @@ -11,14 +9,12 @@ import com.fr.van.chart.designer.component.label.LabelContentPaneWithPercent; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.Component; /** * 仪表盘的分类(多指针时)或者百分比标签 */ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabelDetailPane { - //todo 重新整理这个面板 private static final long serialVersionUID = 5176535960949074945L; @@ -27,15 +23,20 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected double[] getLabelPaneRowSize(Plot plot, double p) { - return hasLabelPosition(plot) ? new double[]{p,p,p} : new double[]{p,p}; + if (hasLabelAlign(plot)) { + return new double[]{p, p, p, p}; + } + + if (hasLabelPosition(plot)) { + return new double[]{p, p, p}; + } + + return new double[]{p, p}; } protected void initToolTipContentPane(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); - break; case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); break; @@ -45,13 +46,13 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } } - + protected boolean getFontSizeAuto() { + return ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.RING) || ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.SLOT); + } protected boolean hasLabelPosition(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case RING: - return false; case SLOT: return false; default: @@ -60,67 +61,10 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected double[] getLabelStyleRowSize(double p) { - switch (gaugeStyle){ - case RING: - return new double[] {p, p}; - case SLOT: - return new double[] {p, p}; - default: - return new double[] {p}; - } + return new double[]{p, p}; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); } - - - protected Component[][] getLabelStyleComponents(Plot plot) { - initGaugeStyle(plot); - if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{text,style}, - new Component[]{textFontPane,null}, - }; - } else { - return new Component[][]{ - new Component[]{textFontPane, null}, - }; - } - } - - protected ChartTextAttrPane initTextFontPane () { - //todo 需要再整理下 - if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT){ - return new ChartTextAttrPane(){ - protected double[] getRowSize () { - double p = TableLayout.PREFERRED; - return new double[]{p, p}; - } - - protected Component[][] getComponents(JPanel buttonPane) { - return new Component[][]{ - new Component[]{null, fontNameComboBox}, - new Component[]{null, buttonPane} - }; - } - }; - } else { - return new ChartTextAttrPane(){ - protected double[] getRowSize () { - double p = TableLayout.PREFERRED; - return new double[]{p, p}; - } - - protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{text, fontNameComboBox}, - new Component[]{null, buttonPane} - }; - } - }; - } - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index e26b771beb..b08a53e8d4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -21,25 +21,33 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dimension; /** * Created by mengao on 2017/8/13. */ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { - protected GaugeStyle gaugeStyle; - protected UIButtonGroup align; + private GaugeStyle gaugeStyle; + private UIButtonGroup align; private JPanel alignPane; - protected Integer[] oldAlignValues; + private Integer[] oldAlignValues; public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } - protected void initGaugeStyle(Plot plot) { - if (gaugeStyle == null) { - gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - } + protected void initLabelDetailPane(Plot plot) { + setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle()); + super.initLabelDetailPane(plot); + } + + public GaugeStyle getGaugeStyle() { + return gaugeStyle; + } + + public void setGaugeStyle(GaugeStyle gaugeStyle) { + this.gaugeStyle = gaugeStyle; } protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { @@ -52,8 +60,26 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); } + protected boolean getFontSizeAuto() { + return false; + } + protected ChartTextAttrPane initTextFontPane() { - return new ChartTextAttrPane(); + + return new ChartTextAttrPane(getFontSizeAuto()) { + protected double[] getRowSize() { + double p = TableLayout.PREFERRED; + return new double[]{p, p}; + } + + protected Component[][] getComponents(JPanel buttonPane) { + UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + return new Component[][]{ + new Component[]{text, fontNameComboBox}, + new Component[]{null, buttonPane} + }; + } + }; } protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { @@ -74,6 +100,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, }; } else { + return super.getLabelPaneComponents(plot, p, columnSize); } } @@ -136,6 +163,12 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return new TwoTuple<>(names, values); } + protected Component[][] getLabelStyleComponents(Plot plot) { + return new Component[][]{ + new Component[]{textFontPane, null}, + }; + } + protected void checkPane() { String verticalTitle = hasLabelAlign(getPlot()) ? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical") @@ -145,13 +178,19 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); } - private boolean hasLabelAlign(Plot plot) { + protected void checkStyleUse() { + textFontPane.setVisible(true); + textFontPane.setPreferredSize(new Dimension(0, 60)); + } + + protected boolean hasLabelAlign(Plot plot) { return ComparatorUtils.equals(gaugeStyle, GaugeStyle.THERMOMETER) && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); } public void populate(AttrLabelDetail detail) { super.populate(detail); + style.setSelectedIndex(1); if (hasLabelAlign(this.getPlot()) && align != null) { align.setSelectedItem(detail.getAlign()); } @@ -160,6 +199,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { public void update(AttrLabelDetail detail) { super.update(detail); + detail.setCustom(true); if (align != null && align.getSelectedItem() != null) { detail.setAlign(align.getSelectedItem()); } else if (align != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index 3bb3a8a085..241a5fd76e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java @@ -1,6 +1,8 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; import com.fr.van.chart.designer.component.label.LabelContentPaneWithOutCate; @@ -20,11 +22,8 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected void initToolTipContentPane(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); - break; case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); break; @@ -35,10 +34,8 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - return getLabelPaneComponentsWithBackground(plot, p, columnSize); case POINTER_SEMI: return getLabelPaneComponentsWithBackground(plot, p, columnSize); default: @@ -47,43 +44,32 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) { - return new Component[][]{ - new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot),null}, - new Component[]{createBackgroundColorPane(),null}, + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot), null}, + new Component[]{createBackgroundColorPane(), null}, }; } protected double[] getLabelPaneRowSize(Plot plot, double p) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - return new double[]{p,p,p,p,p}; case POINTER_SEMI: - return new double[]{p,p,p,p,p}; + return new double[]{p, p, p, p, p}; default: return super.getLabelPaneRowSize(plot, p); } } + protected boolean getFontSizeAuto() { + return !ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.THERMOMETER); + } + protected boolean hasLabelPosition(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ - case THERMOMETER: - return true; - default: - return false; - } + return getGaugeStyle() == GaugeStyle.THERMOMETER; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); } - - protected Component[][] getLabelStyleComponents(Plot plot) { - return new Component[][]{ - new Component[]{textFontPane,null}, - }; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index fde3150947..adb36e4dd4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -59,7 +59,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane { public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { this.parent = parent; this.plot = plot; + initLabelDetailPane(plot); + } + protected void initLabelDetailPane (Plot plot) { this.setLayout(new BorderLayout()); initToolTipContentPane(plot); JPanel contentPane = createLabelPane(plot); @@ -269,7 +272,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { checkPositionEnabled(); } - private void checkStyleUse() { + protected void checkStyleUse() { textFontPane.setVisible(style.getSelectedIndex() == 1); textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); } From 37424403d95d370637db27427608b98e2d11ec16 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Fri, 6 Mar 2020 16:39:44 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E5=AD=97=E7=AC=A6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=9C=A8=E5=AD=90=E7=B1=BB=E4=B8=AD=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 2 +- .../gui/style/ChartTextAttrNoColorPane.java | 49 +++----- .../style/ChartTextAttrNoFontSizePane.java | 38 +++---- .../chart/gui/style/ChartTextAttrPane.java | 105 ++++++++++-------- .../gui/style/ChartTextAttrPaneWithAuto.java | 68 ++++++++++++ ...hartGaugeCateOrPercentLabelDetailPane.java | 14 ++- .../label/VanChartGaugeLabelDetailPane.java | 25 ++--- .../VanChartGaugeValueLabelDetailPane.java | 18 ++- .../label/VanChartPlotLabelDetailPane.java | 2 +- .../tooltip/VanChartPlotTooltipPane.java | 2 +- .../VanChartDrillMapInteractivePane.java | 2 +- 11 files changed, 186 insertions(+), 139 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index cc8a7db137..32db1eab55 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -132,7 +132,7 @@ public class ChangeConfigPane extends BasicBeanPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ - new Component[]{text, fontNameComboBox}, + new Component[]{text, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java index 64d4526c8a..6cc12da41a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java @@ -4,19 +4,17 @@ package com.fr.design.mainframe.chart.gui.style; -import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; /** * Created by IntelliJ IDEA. @@ -25,35 +23,27 @@ import java.awt.*; * Date: 14-9-11 * Time: 上午11:27 */ -public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ +public class ChartTextAttrNoColorPane extends ChartTextAttrPane { - public ChartTextAttrNoColorPane() { - super(); + public ChartTextAttrNoColorPane() { + super(); } protected void initComponents() { - initFontSizes(); - fontColor = new UIColorButton(); - fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(getFontSizes()); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); - double p = TableLayout.PREFERRED; double f = TableLayout.FILL; Component[] components1 = new Component[]{ - italic, bold + getItalic(), getBold() }; JPanel buttonPane = new JPanel(new BorderLayout()); - buttonPane.add(fontSizeComboBox, BorderLayout.CENTER); + buttonPane.add(getFontSizeComboBox(), BorderLayout.CENTER); buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); - double[] columnSize = {f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; @@ -63,20 +53,9 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ populate(FRFont.getInstance()); } - /** - * 更新字体 - * @return 字体 - */ public FRFont updateFRFont() { - int style = Font.PLAIN; - if (bold.isSelected() && !italic.isSelected()) { - style = Font.BOLD; - } else if (!bold.isSelected() && italic.isSelected()) { - style = Font.ITALIC; - } else if (bold.isSelected() && italic.isSelected()) { - style = 3; - } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, - Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem()))); + String name = Utils.objectToString(getFontNameComboBox().getSelectedItem()); + + return FRFont.getInstance(name, getFontStyle(), getFontSize()); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java index 110b9d786b..d04df2f72a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java @@ -1,48 +1,36 @@ package com.fr.design.mainframe.chart.gui.style; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; - -import javax.swing.JPanel; - -import com.fr.base.BaseUtils; -import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; /** * 字体格式设置, 无字体大小设置. + * * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-1-21 下午03:35:47 */ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { - private static final long serialVersionUID = 4890526255627852602L; + private static final long serialVersionUID = 4890526255627852602L; - public ChartTextAttrNoFontSizePane() { - super(); - } + public ChartTextAttrNoFontSizePane() { + super(); + } protected void initComponents() { - initFontSizes(); - fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontColor = new UIColorButton(); - fontSizeComboBox = new UIComboBox(getFontSizes()); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); - double p = TableLayout.PREFERRED; double f = TableLayout.FILL; Component[] components1 = new Component[]{ - fontColor, italic, bold + getFontColor(), getItalic(), getBold() }; JPanel buttonPane = new JPanel(new BorderLayout()); buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.CENTER); @@ -50,7 +38,7 @@ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { double[] columnSize = {f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index 5ffbfde87f..f3998be974 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.chart.gui.style; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.chart.base.TextAttr; -import com.fr.design.i18n.Toolkit; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.event.UIObserverListener; @@ -13,7 +12,6 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -29,49 +27,51 @@ public class ChartTextAttrPane extends BasicPane { private static final long serialVersionUID = 6731679928019436869L; private static final int FONT_START = 6; private static final int FONT_END = 72; - private static final String auto = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); - private static final int autoSizeInt = 0; - private String[] fontSizes; - private boolean isFontSizeAuto; - protected UIComboBox fontNameComboBox; - protected UIComboBox fontSizeComboBox; - protected UIToggleButton bold; - protected UIToggleButton italic; - protected UIColorButton fontColor; + private UIComboBox fontNameComboBox; + private UIComboBox fontSizeComboBox; + private UIToggleButton bold; + private UIToggleButton italic; + private UIColorButton fontColor; + public static Integer[] Font_Sizes = new Integer[FONT_END - FONT_START + 1]; + + static { + for (int i = FONT_START; i <= FONT_END; i++) { + Font_Sizes[i - FONT_START] = new Integer(i); + } + } public ChartTextAttrPane() { - this.isFontSizeAuto = false; + initState(); initComponents(); } - public ChartTextAttrPane(boolean isFontSizeAuto) { - this.isFontSizeAuto = isFontSizeAuto; - initComponents(); + public UIComboBox getFontNameComboBox() { + return fontNameComboBox; } - public String[] getFontSizes() { - return fontSizes; + public UIComboBox getFontSizeComboBox() { + return fontSizeComboBox; } - protected void initFontSizes() { - if (isFontSizeAuto) { - fontSizes = new String[FONT_END - FONT_START + 2]; + public UIToggleButton getBold() { + return bold; + } - fontSizes[0] = auto; + public void setBold(UIToggleButton bold) { + this.bold = bold; + } - for (int i = 1; i < fontSizes.length; i++) { - fontSizes[i] = Utils.objectToString(i + FONT_START); - } - } else { - fontSizes = new String[FONT_END - FONT_START + 1]; + public UIToggleButton getItalic() { + return italic; + } - for (int i = 0; i < fontSizes.length; i++) { - fontSizes[i] = Utils.objectToString(i + FONT_START); - } - } + public UIColorButton getFontColor() { + return fontColor; } - /* 标题 + /** + * 标题 + * * @return 标题 */ public String title4PopupWindow() { @@ -112,13 +112,7 @@ public class ChartTextAttrPane extends BasicPane { fontNameComboBox.setSelectedItem(frFont.getFamily()); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); - if (fontSizeComboBox != null) { - if (frFont.getSize() == autoSizeInt) { - fontSizeComboBox.setSelectedItem(auto); - } else { - fontSizeComboBox.setSelectedItem(frFont.getSize() + ""); - } - } + setFontSize(frFont); if (fontColor != null) { fontColor.setColor(frFont.getForeground()); } @@ -128,6 +122,12 @@ public class ChartTextAttrPane extends BasicPane { registerAllComboBoxListener(listener); } + protected void setFontSize(FRFont frFont) { + if (fontSizeComboBox != null) { + fontSizeComboBox.setSelectedItem(frFont.getSize()); + } + } + private void removeAllComboBoxListener() { fontNameComboBox.removeChangeListener(); fontSizeComboBox.removeChangeListener(); @@ -144,8 +144,13 @@ public class ChartTextAttrPane extends BasicPane { * @return 更新字 */ public FRFont updateFRFont() { + String name = Utils.objectToString(fontNameComboBox.getSelectedItem()); + + return FRFont.getInstance(name, getFontStyle(), getFontSize(), fontColor.getColor()); + } + + protected int getFontStyle() { int style = Font.PLAIN; - float size; if (bold.isSelected() && !italic.isSelected()) { style = Font.BOLD; } else if (!bold.isSelected() && italic.isSelected()) { @@ -153,13 +158,12 @@ public class ChartTextAttrPane extends BasicPane { } else if (bold.isSelected() && italic.isSelected()) { style = 3; } - if (ComparatorUtils.equals(fontSizeComboBox.getSelectedItem(), auto)) { - size = Float.parseFloat(Utils.objectToString(autoSizeInt)); - } else { - size = Float.parseFloat(Utils.objectToString(fontSizeComboBox.getSelectedItem())); - } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, size, fontColor.getColor()); + return style; + } + + protected float getFontSize() { + return Float.parseFloat(Utils.objectToString(fontSizeComboBox.getSelectedItem())); } public void setEnabled(boolean enabled) { @@ -170,14 +174,19 @@ public class ChartTextAttrPane extends BasicPane { this.italic.setEnabled(enabled); } - protected void initComponents() { - initFontSizes(); + protected Object[] getFontSizeComboBoxModel() { + return Font_Sizes; + } + + protected void initState() { fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(fontSizes); + fontSizeComboBox = new UIComboBox(getFontSizeComboBoxModel()); fontColor = new UIColorButton(); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + } + protected void initComponents() { Component[] components1 = new Component[]{ fontColor, italic, bold }; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java new file mode 100644 index 0000000000..35681ab41a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -0,0 +1,68 @@ +package com.fr.design.mainframe.chart.gui.style; + +import com.fr.base.Utils; +import com.fr.design.i18n.Toolkit; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; + +public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { + + private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); + private static final int AUTO_SIZE_INT = 0; + private boolean isFontSizeAuto; + private boolean isColorAuto; + + public ChartTextAttrPaneWithAuto() { + this.isFontSizeAuto = false; + this.isColorAuto = false; + + initState(); + initComponents(); + } + + public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { + this.isFontSizeAuto = isFontSizeAuto; + this.isColorAuto = isColorAuto; + + initState(); + initComponents(); + } + + protected Object[] getFontSizeComboBoxModel() { + if (isFontSizeAuto) { + String[] fontSizes = new String[Font_Sizes.length + 1]; + + fontSizes[0] = AUTO; + + for (int i = 1; i <= Font_Sizes.length; i++) { + fontSizes[i] = i + ""; + } + + return fontSizes; + } else { + return super.getFontSizeComboBoxModel(); + } + } + + protected float getFontSize() { + if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { + return AUTO_SIZE_INT; + } + + return Float.parseFloat(Utils.objectToString(getFontSizeComboBox().getSelectedItem())); + } + + protected void setFontSize(FRFont frFont) { + if (getFontSizeComboBox() != null && isFontSizeAuto) { + if (frFont.getSize() == AUTO_SIZE_INT) { + getFontSizeComboBox().setSelectedItem(AUTO); + } else { + getFontSizeComboBox().setSelectedItem(frFont.getSize() + ""); + } + } + + if (getFontSizeComboBox() != null && !isFontSizeAuto) { + getFontSizeComboBox().setSelectedItem(frFont.getSize()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index d96140a8f3..876da9bc69 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -1,7 +1,7 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; @@ -35,7 +35,9 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected void initToolTipContentPane(Plot plot) { - switch (getGaugeStyle()) { + GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + + switch (gaugeStyle) { case POINTER: case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); @@ -47,11 +49,15 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected boolean getFontSizeAuto() { - return ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.RING) || ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.SLOT); + GaugeStyle gaugeStyle = ((VanChartGaugePlot) getPlot()).getGaugeStyle(); + + return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT; } protected boolean hasLabelPosition(Plot plot) { - switch (getGaugeStyle()) { + GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + + switch (gaugeStyle) { case RING: case SLOT: return false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index b08a53e8d4..9bfa8e82b4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -9,7 +9,9 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; @@ -28,7 +30,6 @@ import java.awt.Dimension; */ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { - private GaugeStyle gaugeStyle; private UIButtonGroup align; private JPanel alignPane; private Integer[] oldAlignValues; @@ -37,19 +38,6 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { super(plot, parent); } - protected void initLabelDetailPane(Plot plot) { - setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle()); - super.initLabelDetailPane(plot); - } - - public GaugeStyle getGaugeStyle() { - return gaugeStyle; - } - - public void setGaugeStyle(GaugeStyle gaugeStyle) { - this.gaugeStyle = gaugeStyle; - } - protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -66,7 +54,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { protected ChartTextAttrPane initTextFontPane() { - return new ChartTextAttrPane(getFontSizeAuto()) { + return new ChartTextAttrPaneWithAuto(getFontSizeAuto(), false) { protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p}; @@ -75,7 +63,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { protected Component[][] getComponents(JPanel buttonPane) { UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ - new Component[]{text, fontNameComboBox}, + new Component[]{text, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } @@ -184,7 +172,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { } protected boolean hasLabelAlign(Plot plot) { - return ComparatorUtils.equals(gaugeStyle, GaugeStyle.THERMOMETER) && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); + GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + GaugeDetailStyle gaugeDetailStyle = ((VanChartGaugePlot) plot).getGaugeDetailStyle(); + + return gaugeStyle == GaugeStyle.THERMOMETER && !gaugeDetailStyle.isHorizontalLayout(); } public void populate(AttrLabelDetail detail) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index 241a5fd76e..cfee6102be 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java @@ -1,7 +1,7 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; @@ -22,7 +22,9 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected void initToolTipContentPane(Plot plot) { - switch (getGaugeStyle()) { + GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + + switch (gaugeStyle) { case POINTER: case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); @@ -34,7 +36,9 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { - switch (getGaugeStyle()) { + GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + + switch (gaugeStyle) { case POINTER: case POINTER_SEMI: return getLabelPaneComponentsWithBackground(plot, p, columnSize); @@ -52,7 +56,9 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected double[] getLabelPaneRowSize(Plot plot, double p) { - switch (getGaugeStyle()) { + GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); + + switch (gaugeStyle) { case POINTER: case POINTER_SEMI: return new double[]{p, p, p, p, p}; @@ -62,11 +68,11 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected boolean getFontSizeAuto() { - return !ComparatorUtils.equals(getGaugeStyle(), GaugeStyle.THERMOMETER); + return ((VanChartGaugePlot) getPlot()).getGaugeStyle() != GaugeStyle.THERMOMETER; } protected boolean hasLabelPosition(Plot plot) { - return getGaugeStyle() == GaugeStyle.THERMOMETER; + return ((VanChartGaugePlot) plot).getGaugeStyle() == GaugeStyle.THERMOMETER; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index adb36e4dd4..a9fc5c008c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -230,7 +230,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{null, fontNameComboBox}, + new Component[]{null, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index e3f45a9c0a..5dfc50ec47 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -114,7 +114,7 @@ public class VanChartPlotTooltipPane extends BasicPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{null, fontNameComboBox}, + new Component[]{null, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index 1f705c9c94..c0195070aa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -68,7 +68,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith @Override protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; } From 06e6b172fa10ead88532f088a29de48730940d0c Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 7 Mar 2020 13:07:00 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E8=87=AA=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/constants/UIConstants.java | 4 +- .../fr/design/gui/ibutton/UIColorButton.java | 23 +++- .../gui/ibutton/UIColorButtonWithAuto.java | 35 ++++++ .../style/color/ColorControlWindow.java | 10 +- .../color/ColorControlWindowWithAuto.java | 115 ++++++++++++++++++ .../style/color/NewColorSelectPane.java | 36 +++--- .../images/gui/color/autoForeground.png | Bin 0 -> 415 bytes .../chart/gui/style/ChartTextAttrPane.java | 20 +-- .../gui/style/ChartTextAttrPaneWithAuto.java | 16 ++- ...hartGaugeCateOrPercentLabelDetailPane.java | 6 + .../label/VanChartGaugeLabelDetailPane.java | 6 +- 11 files changed, 237 insertions(+), 34 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java create mode 100644 designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java create mode 100755 designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 1e119d27ed..85c2c30922 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -143,7 +143,8 @@ public interface UIConstants { public static final Color TAB_BUTTON_PRESS_SELECTED = new Color(236, 236, 238); public static final Color POPUP_TITLE_BACKGROUND = new Color(0xd8f2fd); public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3); - + public static final Color AUTO_FONT_COLOR = new Color(0, 0, 0, 0); + public static final Color TRANSPARENT_FONT_COLOR = new Color(255, 255, 255, 0); public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png"); @@ -196,6 +197,7 @@ public interface UIConstants { public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png"); public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png"); public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"); + public static final Icon AUTO_FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/autoForeground.png"); public static final Icon HISTORY_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/history.png"); public static final Icon DELETE_ICON = IOUtils.readIcon("com/fr/design/images/m_file/close.png"); public static final Icon EDIT_ICON = IOUtils.readIcon("com/fr/design/images/m_file/edit.png"); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java index 86fc564384..f957e8c39f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java @@ -24,10 +24,10 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver { - private static final int SIZE = 16; - private static final int SIZE_2 = 2; - private static final int SIZE_4 = 4; - private static final int SIZE_6 = 6; + public static final int SIZE = 16; + public static final int SIZE_2 = 2; + public static final int SIZE_4 = 4; + public static final int SIZE_6 = 6; private static final int POPUP_MENU_SHIFT = -70; private Color color = Color.BLACK; private ColorControlWindow popupWin; @@ -53,6 +53,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G iniListener(); } + public ColorControlWindow getPopupWin() { + return popupWin; + } + + public void setPopupWin(ColorControlWindow popupWin) { + this.popupWin = popupWin; + } + private void iniListener() { if (shouldResponseChangeListener()) { this.addColorChangeListener(new ChangeListener() { @@ -103,12 +111,15 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G if (ComparatorUtils.equals(this.color, color)) { return; } - + checkIcon(this.color, color); this.color = color; hidePopupMenu(); fireColorStateChanged(); } + protected void checkIcon(Color oldColor, Color newColor) { + } + private void showPopupMenu() { if (isEventBanned) { return; @@ -139,7 +150,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G repaint(); } - private ColorControlWindow getColorControlWindow() { + protected ColorControlWindow getColorControlWindow() { //find parant. if (this.popupWin == null) { this.popupWin = new ColorControlWindow(UIColorButton.this) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java new file mode 100644 index 0000000000..0f5f0c58c9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -0,0 +1,35 @@ +package com.fr.design.gui.ibutton; + +import com.fr.design.constants.UIConstants; +import com.fr.design.style.color.ColorControlWindow; +import com.fr.design.style.color.ColorControlWindowWithAuto; +import com.fr.general.ComparatorUtils; + +import java.awt.Color; + +public class UIColorButtonWithAuto extends UIColorButton { + + protected void checkIcon(Color oldColor, Color newColor) { + if (ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { + setIcon(UIConstants.FONT_ICON); + } + + if (!ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { + setIcon(UIConstants.AUTO_FONT_ICON); + } + } + + protected ColorControlWindow getColorControlWindow() { + if (getPopupWin() == null) { + ColorControlWindowWithAuto colorControlWindowWithAuto = new ColorControlWindowWithAuto(UIColorButtonWithAuto.this) { + protected void colorChanged() { + UIColorButtonWithAuto.this.setColor(this.getColor()); + } + }; + + setPopupWin(colorControlWindowWithAuto); + } + + return getPopupWin(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java index b5a5e40752..4ee3a119ea 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java @@ -38,6 +38,10 @@ public abstract class ColorControlWindow extends JPopupMenu { return selectionPopupPane.getColor(); } + public PopupHider getPopupHider() { + return popupHider; + } + /** * Init components. */ @@ -49,9 +53,13 @@ public abstract class ColorControlWindow extends JPopupMenu { setOpaque(false); setDoubleBuffered(true); setFocusable(false); + initSelectionPopupPane(isSupportTransparent); + this.pack(); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { selectionPopupPane = new ColorSelectionPopupPane(isSupportTransparent); this.add(selectionPopupPane, BorderLayout.CENTER); - this.pack(); } class ColorSelectionPopupPane extends NewColorSelectPane { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java new file mode 100644 index 0000000000..46d32c7136 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java @@ -0,0 +1,115 @@ +package com.fr.design.style.color; + +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ipoppane.PopupHider; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public abstract class ColorControlWindowWithAuto extends ColorControlWindow { + + private ColorSelectionPopupPaneWithAuto selectionPopupPaneWithAuto; + + public ColorControlWindowWithAuto(PopupHider popupHider) { + this(false, popupHider); + } + + public ColorControlWindowWithAuto(boolean isSupportTransparent, PopupHider popupHider) { + super(isSupportTransparent, popupHider); + } + + public Color getColor() { + if (selectionPopupPaneWithAuto == null) { + return null; + } + return selectionPopupPaneWithAuto.getColor(); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { + selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent); + this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER); + } + + class ColorSelectionPopupPaneWithAuto extends NewColorSelectPane { + private static final long serialVersionUID = 7822856562329146354L; + + public ColorSelectionPopupPaneWithAuto(boolean isSupportTransparent) { + super(isSupportTransparent); + + this.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + colorChanged(); + } + }); + } + + protected void doTransparent() { + getPopupHider().hidePopupMenu(); + setColor(UIConstants.TRANSPARENT_FONT_COLOR); + } + + protected void doAuto() { + getPopupHider().hidePopupMenu(); + setColor(UIConstants.AUTO_FONT_COLOR); + } + + public void customButtonPressed() { + getPopupHider().hidePopupMenu(); + super.customButtonPressed(); + } + + protected void initSelectButton(boolean isSupportTransparent) { + setSupportTransparent(isSupportTransparent); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); + + UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + UIButton autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto")); + + transparentButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doTransparent(); + } + }); + + autoButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doAuto(); + } + }); + + if (isSupportTransparent) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, 0}; + double[] rowSize = {p, p}; + + Component[][] components = new Component[][]{ + new Component[]{autoButton, null}, + new Component[]{transparentButton, null} + }; + + JPanel buttonGroup = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.add(buttonGroup, BorderLayout.NORTH); + } else { + this.add(autoButton, BorderLayout.NORTH); + } + } + + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index d532324165..05c99e06cf 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -56,20 +56,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { * Constructor. */ NewColorSelectPane(boolean isSupportTransparent) { - this.isSupportTransparent = isSupportTransparent; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); - if (isSupportTransparent) { - UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); - this.add(transpanrentButton, BorderLayout.NORTH); - transpanrentButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - doTransparent(); - } - }); - } + initSelectButton(isSupportTransparent); // center JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); @@ -117,6 +104,27 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(centerPane1); } + public void setSupportTransparent(boolean supportTransparent) { + isSupportTransparent = supportTransparent; + } + + protected void initSelectButton(boolean isSupportTransparent){ + this.isSupportTransparent = isSupportTransparent; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); + if (isSupportTransparent) { + UIButton transparentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + this.add(transparentButton, BorderLayout.NORTH); + transparentButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + doTransparent(); + } + }); + } + } + /** * 添加监听 diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png b/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png new file mode 100755 index 0000000000000000000000000000000000000000..4186fea2cff2d4650e019dcfc745bdb5346f8a4f GIT binary patch literal 415 zcmV;Q0bu@#P)Px$SxH1eR5%f>l20pyQ5426LmJB8DN-nfHvFE~J#TN5cQ!oroAca1^WJmLz0UnnO~3rVhq(gGLMME} zBW%GXG*p(=Gnj)u7=sa*gmqYjSn1SV=!op7;twNZvn9-g4HSpr6k5TQ#_T}_hHR3k z%v9Eae1aco12*AK1FtorHa);Js5Ge`t^?=XzK_A_<`vuE)<^X~zP{lX%()gw!kY#W z!V>LFF_;W$Sb`H`D+wACBTpJ4-vT z7{BG`x$0f$`C5spUC;XpiV&*)Zf#)(GY_MnPFvdB_$T;3eFLHeK5P|RwoU*5002ov JPDHLkV1gWBvYY?_ literal 0 HcmV?d00001 diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index f3998be974..71ff1c9d0d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -25,8 +25,8 @@ import java.awt.Font; public class ChartTextAttrPane extends BasicPane { private static final long serialVersionUID = 6731679928019436869L; - private static final int FONT_START = 6; - private static final int FONT_END = 72; + public static final int FONT_START = 6; + public static final int FONT_END = 72; private UIComboBox fontNameComboBox; private UIComboBox fontSizeComboBox; private UIToggleButton bold; @@ -36,7 +36,7 @@ public class ChartTextAttrPane extends BasicPane { static { for (int i = FONT_START; i <= FONT_END; i++) { - Font_Sizes[i - FONT_START] = new Integer(i); + Font_Sizes[i - FONT_START] = i; } } @@ -57,10 +57,6 @@ public class ChartTextAttrPane extends BasicPane { return bold; } - public void setBold(UIToggleButton bold) { - this.bold = bold; - } - public UIToggleButton getItalic() { return italic; } @@ -69,6 +65,10 @@ public class ChartTextAttrPane extends BasicPane { return fontColor; } + public void setFontColor(UIColorButton fontColor) { + this.fontColor = fontColor; + } + /** * 标题 * @@ -181,9 +181,13 @@ public class ChartTextAttrPane extends BasicPane { protected void initState() { fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); fontSizeComboBox = new UIComboBox(getFontSizeComboBoxModel()); - fontColor = new UIColorButton(); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + initFontColorState(); + } + + protected void initFontColorState() { + setFontColor(new UIColorButton()); } protected void initComponents() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 35681ab41a..1301b243a2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe.chart.gui.style; import com.fr.base.Utils; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; @@ -28,14 +30,22 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { initComponents(); } + protected void initFontColorState() { + if (isColorAuto) { + setFontColor(new UIColorButtonWithAuto()); + } else { + setFontColor(new UIColorButton()); + } + } + protected Object[] getFontSizeComboBoxModel() { if (isFontSizeAuto) { - String[] fontSizes = new String[Font_Sizes.length + 1]; + String[] fontSizes = new String[FONT_END - FONT_START + 2]; fontSizes[0] = AUTO; - for (int i = 1; i <= Font_Sizes.length; i++) { - fontSizes[i] = i + ""; + for (int i = 1; i < fontSizes.length; i++) { + fontSizes[i] = FONT_START + i + ""; } return fontSizes; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index 876da9bc69..d367d40834 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -54,6 +54,12 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT; } + protected boolean getFontColorAuto() { + GaugeStyle gaugeStyle = ((VanChartGaugePlot) getPlot()).getGaugeStyle(); + + return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT; + } + protected boolean hasLabelPosition(Plot plot) { GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 9bfa8e82b4..765ac33c91 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -52,9 +52,13 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return false; } + protected boolean getFontColorAuto() { + return false; + } + protected ChartTextAttrPane initTextFontPane() { - return new ChartTextAttrPaneWithAuto(getFontSizeAuto(), false) { + return new ChartTextAttrPaneWithAuto(getFontSizeAuto(), getFontColorAuto()) { protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p}; From 4b0d138b37a1ff6bbf4400bb355a537d0f84cc61 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 7 Mar 2020 13:32:02 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E8=BF=87=E6=97=B6?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/ChartTextAttrPane.java | 10 ++++++---- .../chart/gui/style/ChartTextAttrPaneWithAuto.java | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index 71ff1c9d0d..3ac7f116e9 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -10,10 +10,12 @@ import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -144,7 +146,7 @@ public class ChartTextAttrPane extends BasicPane { * @return 更新字 */ public FRFont updateFRFont() { - String name = Utils.objectToString(fontNameComboBox.getSelectedItem()); + String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem()); return FRFont.getInstance(name, getFontStyle(), getFontSize(), fontColor.getColor()); } @@ -163,7 +165,7 @@ public class ChartTextAttrPane extends BasicPane { } protected float getFontSize() { - return Float.parseFloat(Utils.objectToString(fontSizeComboBox.getSelectedItem())); + return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem())); } public void setEnabled(boolean enabled) { @@ -207,7 +209,7 @@ public class ChartTextAttrPane extends BasicPane { protected JPanel getContentPane (JPanel buttonPane) { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f,e}; + double[] columnSize = {f, e}; return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); } @@ -218,7 +220,7 @@ public class ChartTextAttrPane extends BasicPane { } protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{null, null}, new Component[]{text, fontNameComboBox}, diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 1301b243a2..f959984c12 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -1,11 +1,11 @@ package com.fr.design.mainframe.chart.gui.style; -import com.fr.base.Utils; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { @@ -59,7 +59,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { return AUTO_SIZE_INT; } - return Float.parseFloat(Utils.objectToString(getFontSizeComboBox().getSelectedItem())); + return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem())); } protected void setFontSize(FRFont frFont) { From cc93839488d3828b3b59d3deffc537974500e040 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 7 Mar 2020 19:41:53 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E9=99=8D=E4=BD=8E=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=BC=BA=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ibutton/UIColorButton.java | 9 ++++--- .../gui/ibutton/UIColorButtonWithAuto.java | 4 ++- .../style/color/NewColorSelectPane.java | 3 ++- .../gui/style/ChartTextAttrNoColorPane.java | 4 +-- .../gui/style/ChartTextAttrPaneWithAuto.java | 10 +++----- .../gauge/VanChartGaugeDetailAxisPane.java | 25 +++++++++++++------ ...hartGaugeCateOrPercentLabelDetailPane.java | 16 +++--------- .../label/VanChartGaugeLabelDetailPane.java | 20 +++++++++++---- .../VanChartGaugeValueLabelDetailPane.java | 17 ++++--------- 9 files changed, 56 insertions(+), 52 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java index f957e8c39f..28f5830619 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java @@ -111,13 +111,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G if (ComparatorUtils.equals(this.color, color)) { return; } - checkIcon(this.color, color); + Color oldColor = this.color; this.color = color; - hidePopupMenu(); - fireColorStateChanged(); + checkColorChange(oldColor, this.color); } - protected void checkIcon(Color oldColor, Color newColor) { + protected void checkColorChange(Color oldColor, Color newColor) { + hidePopupMenu(); + fireColorStateChanged(); } private void showPopupMenu() { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java index 0f5f0c58c9..db64cba87f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -9,7 +9,7 @@ import java.awt.Color; public class UIColorButtonWithAuto extends UIColorButton { - protected void checkIcon(Color oldColor, Color newColor) { + protected void checkColorChange(Color oldColor, Color newColor) { if (ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { setIcon(UIConstants.FONT_ICON); } @@ -17,6 +17,8 @@ public class UIColorButtonWithAuto extends UIColorButton { if (!ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { setIcon(UIConstants.AUTO_FONT_ICON); } + + super.checkColorChange(oldColor, newColor); } protected ColorControlWindow getColorControlWindow() { diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 05c99e06cf..4b8cecad53 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -5,6 +5,7 @@ import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; @@ -113,7 +114,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); if (isSupportTransparent) { - UIButton transparentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); this.add(transparentButton, BorderLayout.NORTH); transparentButton.addActionListener(new ActionListener() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java index 6cc12da41a..249583768f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java @@ -4,12 +4,12 @@ package com.fr.design.mainframe.chart.gui.style; -import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -54,7 +54,7 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane { } public FRFont updateFRFont() { - String name = Utils.objectToString(getFontNameComboBox().getSelectedItem()); + String name = GeneralUtils.objectToString(getFontNameComboBox().getSelectedItem()); return FRFont.getInstance(name, getFontStyle(), getFontSize()); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index f959984c12..f486e50b1b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -11,15 +11,11 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); private static final int AUTO_SIZE_INT = 0; - private boolean isFontSizeAuto; - private boolean isColorAuto; + private boolean isFontSizeAuto = false; + private boolean isColorAuto = false; public ChartTextAttrPaneWithAuto() { - this.isFontSizeAuto = false; - this.isColorAuto = false; - - initState(); - initComponents(); + super(); } public ChartTextAttrPaneWithAuto(boolean isFontSizeAuto, boolean isColorAuto) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index e047830291..55622a85b5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -2,9 +2,12 @@ package com.fr.van.chart.designer.style.axis.gauge; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; 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.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.style.color.ColorSelectBox; import com.fr.plugin.chart.attr.axis.VanChartAxis; @@ -77,13 +80,13 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { } protected JPanel createLabelPane(double[] row, double[] col){ - showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); + showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); labelTextAttrPane = getChartTextAttrPane(); labelPanel = new JPanel(new BorderLayout()); labelPanel.add(labelTextAttrPane); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); JPanel panel = new JPanel(new BorderLayout(0, 6)); - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); + panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); panel.add(labelPanel, BorderLayout.CENTER); showLabel.addActionListener(new ActionListener() { @Override @@ -96,11 +99,17 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { return jPanel; } + protected ChartTextAttrPane getChartTextAttrPane() { + if (isMulti(gaugeStyle)) { + return new ChartTextAttrPaneWithAuto(false, true); + } else { + return new ChartTextAttrPane(); + } + } + private JPanel createValueDefinition(){ switch (gaugeStyle){ case RING: - minMaxValuePane = new MinMaxValuePaneWithOutTick(); - break; case SLOT: minMaxValuePane = new MinMaxValuePaneWithOutTick(); break; @@ -108,18 +117,18 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { minMaxValuePane = new VanChartMinMaxValuePane(); break; } - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane); } private JPanel createTickColorPane(double[] row, double[] col){ mainTickColor = new ColorSelectBox(100); secTickColor = new ColorSelectBox(100); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); - JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel); + JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel); panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); return jPanel; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index d367d40834..e67e19accf 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -35,9 +35,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected void initToolTipContentPane(Plot plot) { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - - switch (gaugeStyle) { + switch (getGaugeStyle()) { case POINTER: case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); @@ -49,21 +47,15 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected boolean getFontSizeAuto() { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) getPlot()).getGaugeStyle(); - - return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT; + return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; } protected boolean getFontColorAuto() { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) getPlot()).getGaugeStyle(); - - return gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT; + return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; } protected boolean hasLabelPosition(Plot plot) { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - - switch (gaugeStyle) { + switch (getGaugeStyle()) { case RING: case SLOT: return false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 765ac33c91..750b0119a6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -11,7 +11,6 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.general.ComparatorUtils; -import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; @@ -30,6 +29,7 @@ import java.awt.Dimension; */ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { + private GaugeStyle gaugeStyle; private UIButtonGroup align; private JPanel alignPane; private Integer[] oldAlignValues; @@ -38,6 +38,19 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { super(plot, parent); } + protected void initLabelDetailPane (Plot plot) { + setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle()); + super.initLabelDetailPane(plot); + } + + public GaugeStyle getGaugeStyle() { + return gaugeStyle; + } + + public void setGaugeStyle(GaugeStyle gaugeStyle) { + this.gaugeStyle = gaugeStyle; + } + protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); @@ -176,10 +189,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { } protected boolean hasLabelAlign(Plot plot) { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - GaugeDetailStyle gaugeDetailStyle = ((VanChartGaugePlot) plot).getGaugeDetailStyle(); - - return gaugeStyle == GaugeStyle.THERMOMETER && !gaugeDetailStyle.isHorizontalLayout(); + return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); } public void populate(AttrLabelDetail detail) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index cfee6102be..5872014ff1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; @@ -22,9 +21,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected void initToolTipContentPane(Plot plot) { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - - switch (gaugeStyle) { + switch (getGaugeStyle()) { case POINTER: case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); @@ -36,9 +33,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - - switch (gaugeStyle) { + switch (getGaugeStyle()) { case POINTER: case POINTER_SEMI: return getLabelPaneComponentsWithBackground(plot, p, columnSize); @@ -56,9 +51,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected double[] getLabelPaneRowSize(Plot plot, double p) { - GaugeStyle gaugeStyle = ((VanChartGaugePlot) plot).getGaugeStyle(); - - switch (gaugeStyle) { + switch (getGaugeStyle()) { case POINTER: case POINTER_SEMI: return new double[]{p, p, p, p, p}; @@ -68,11 +61,11 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected boolean getFontSizeAuto() { - return ((VanChartGaugePlot) getPlot()).getGaugeStyle() != GaugeStyle.THERMOMETER; + return getGaugeStyle() != GaugeStyle.THERMOMETER; } protected boolean hasLabelPosition(Plot plot) { - return ((VanChartGaugePlot) plot).getGaugeStyle() == GaugeStyle.THERMOMETER; + return getGaugeStyle() == GaugeStyle.THERMOMETER; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { From 6ab132425811b15aaf76cd60422a4bc63d9d2858 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 7 Mar 2020 22:31:37 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E7=BB=9F=E4=B8=80radius?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/style/ChartTextAttrPaneWithAuto.java | 10 +++------- ...ChartGaugeCateOrPercentLabelDetailPane.java | 5 ++--- .../label/VanChartGaugeLabelDetailPane.java | 18 ++++++++++-------- .../VanChartGaugeValueLabelDetailPane.java | 2 +- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index f486e50b1b..6760474e93 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -27,11 +27,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } protected void initFontColorState() { - if (isColorAuto) { - setFontColor(new UIColorButtonWithAuto()); - } else { - setFontColor(new UIColorButton()); - } + setFontColor(isColorAuto ? new UIColorButtonWithAuto() : new UIColorButton()); } protected Object[] getFontSizeComboBoxModel() { @@ -45,9 +41,9 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } return fontSizes; - } else { - return super.getFontSizeComboBoxModel(); } + + return super.getFontSizeComboBoxModel(); } protected float getFontSize() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index e67e19accf..64187f89b9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; @@ -46,11 +45,11 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } } - protected boolean getFontSizeAuto() { + protected boolean isFontSizeAuto() { return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; } - protected boolean getFontColorAuto() { + protected boolean isFontColorAuto() { return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 750b0119a6..31e329845f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -38,7 +38,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { super(plot, parent); } - protected void initLabelDetailPane (Plot plot) { + protected void initLabelDetailPane(Plot plot) { setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle()); super.initLabelDetailPane(plot); } @@ -61,17 +61,17 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); } - protected boolean getFontSizeAuto() { + protected boolean isFontSizeAuto() { return false; } - protected boolean getFontColorAuto() { + protected boolean isFontColorAuto() { return false; } protected ChartTextAttrPane initTextFontPane() { - return new ChartTextAttrPaneWithAuto(getFontSizeAuto(), getFontColorAuto()) { + return new ChartTextAttrPaneWithAuto(isFontSizeAuto(), isFontColorAuto()) { protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p}; @@ -205,10 +205,12 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { super.update(detail); detail.setCustom(true); - if (align != null && align.getSelectedItem() != null) { - detail.setAlign(align.getSelectedItem()); - } else if (align != null) { - align.setSelectedItem(detail.getAlign()); + if (align != null) { + if (align.getSelectedItem() != null) { + detail.setAlign(align.getSelectedItem()); + } else { + align.setSelectedItem(detail.getAlign()); + } } } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index 5872014ff1..01a21d3823 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java @@ -60,7 +60,7 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } } - protected boolean getFontSizeAuto() { + protected boolean isFontSizeAuto() { return getGaugeStyle() != GaugeStyle.THERMOMETER; } From d563465a2042c24f2ffccbb9e9d06f07bed74844 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 8 Mar 2020 12:29:17 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=85=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/style/label/VanChartGaugeLabelDetailPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 31e329845f..9ead773035 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -52,8 +52,8 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { } protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane = initTextFontPane(); initStyleListener(); @@ -78,7 +78,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { } protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{text, getFontNameComboBox()}, new Component[]{null, buttonPane} From f14998d21843baba0c19b73d27e8279deaa37802 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 8 Mar 2020 12:52:58 +0800 Subject: [PATCH 13/16] =?UTF-8?q?check=E6=89=80=E6=9C=89=E5=85=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=9B=BD=E9=99=85=E5=8C=96=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/color/NewColorSelectPane.java | 2 +- .../mainframe/chart/gui/ChangeConfigPane.java | 21 ++++++++-------- .../label/VanChartGaugePlotLabelPane.java | 9 ++++--- .../label/VanChartPlotLabelDetailPane.java | 18 +++++++------- .../VanChartAbstractPlotSeriesPane.java | 22 ++++++++--------- .../tooltip/VanChartPlotTooltipPane.java | 24 +++++++++---------- .../VanChartDrillMapInteractivePane.java | 13 +++++----- 7 files changed, 55 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 4b8cecad53..e823f3061c 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -85,7 +85,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color")); // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) customButton.addMouseListener(new MouseAdapter() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 32db1eab55..3de9aaa09a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -14,6 +14,7 @@ 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.gui.style.ChartTextAttrPane; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -70,7 +71,7 @@ public class ChangeConfigPane extends BasicBeanPane { double[] columnSize = {p, f}; double[] rowSize = {p,p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Style")),configStyleButton}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Change_Style")),configStyleButton}, new Component[]{configPane, null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -107,19 +108,19 @@ public class ChangeConfigPane extends BasicBeanPane { double[] rowSize = {p, p, p}; timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); - switchStyleGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hide")}); + switchStyleGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Show"), Toolkit.i18nText("Fine-Design_Report_Hide")}); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Second"))}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")),colorSelectBox4carousel, null} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Time_Second"))}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Background")),colorSelectBox4carousel, null} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } private JPanel createTitleStylePane() { - final UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + final UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); styleAttrPane = new ChartTextAttrPane() { protected JPanel getContentPane(JPanel buttonPane) { double p = TableLayout.PREFERRED; @@ -143,7 +144,7 @@ public class ChangeConfigPane extends BasicBeanPane { private JPanel createButtonBackgroundColorPane(){ colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); } private JPanel createButtonConfigPane() { @@ -160,8 +161,8 @@ public class ChangeConfigPane extends BasicBeanPane { } private void initButtonGroup() { - configStyleButton = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Button_Style"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Carousel_Style")}); + configStyleButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Button_Style"), + Toolkit.i18nText("Fine-Design_Chart_Carousel_Style")}); configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); configStyleButton.addActionListener(new ActionListener() { @Override @@ -227,6 +228,6 @@ public class ChangeConfigPane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"); + return Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java index 42e6909e9f..0f81deefca 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java @@ -7,6 +7,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.design.i18n.Toolkit; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -28,16 +29,14 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { labelDetailPane = new VanChartGaugeCateOrPercentLabelDetailPane(this.plot, this.parent); gaugeValueLabelPane = new VanChartGaugeValueLabelDetailPane(this.plot, this.parent); GaugeStyle gaugeStyle = ((VanChartGaugePlot)this.plot).getGaugeStyle(); - String cateTitle, valueTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Label"); + String cateTitle, valueTitle = Toolkit.i18nText("Fine-Design_Chart_Value_Label"); switch (gaugeStyle){ case POINTER: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Label"); - break; case POINTER_SEMI: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Label"); + cateTitle = Toolkit.i18nText("Fine-Design_Chart_Category_Label"); break; default: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); + cateTitle = Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); break; } JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, labelDetailPane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index a9fc5c008c..c506d89ea1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -144,7 +144,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return new JPanel(); } - autoAdjust = 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}); + autoAdjust = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); JPanel panel = new JPanel(new BorderLayout()); @@ -154,12 +154,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if (plot.isSupportLeadLine()) { - tractionLine = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); + tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("", tractionLine); panel.add(tractionLinePane, BorderLayout.SOUTH); initPositionListener(); } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); + panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); } return panel; } @@ -201,7 +201,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); } @@ -215,14 +215,14 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane =initTextFontPane(); initStyleListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot),row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } protected ChartTextAttrPane initTextFontPane () { @@ -238,7 +238,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected Component[][] getLabelStyleComponents(Plot plot) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{null,null}, new Component[]{text,style}, @@ -257,7 +257,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel createBackgroundColorPane() { backgroundColor = new ColorSelectBox(100); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); } protected String title4PopupWindow() { 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 eec3cf9a12..9b912ee9f7 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 @@ -23,7 +23,7 @@ import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.van.chart.custom.style.VanChartCustomStylePane; -import com.fr.van.chart.designer.PlotFactory; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartBeautyPane; @@ -112,7 +112,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); setColorPaneContent(panel); - JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel.getComponentCount() == 0 ? null : colorPane; } @@ -127,13 +127,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //趋势线 protected JPanel createTrendLinePane() { trendLinePane = new VanChartTrendLinePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine"), trendLinePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TrendLine"), trendLinePane); } //线 protected JPanel createLineTypePane() { lineTypePane = getLineTypePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line"), lineTypePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Line"), lineTypePane); } protected VanChartLineTypePane getLineTypePane() { @@ -143,19 +143,19 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //标记点类型 protected JPanel createMarkerPane() { markerPane = new VanChartMarkerPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); } //填充颜色 protected JPanel createAreaFillColorPane() { areaSeriesFillColorPane = new VanChartAreaSeriesFillColorPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area"), areaSeriesFillColorPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Area"), areaSeriesFillColorPane); } //边框(默认没有圆角) protected JPanel createBorderPane() { borderPane = createDiffBorderPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); } @@ -175,7 +175,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkLarge(); } }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); return createLargeDataModelPane(panel); } @@ -197,12 +197,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } protected JPanel createLargeDataModelPane(JPanel jPanel) { - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); return panel; } protected UIButtonGroup createLargeDataModelGroup() { - String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; + String[] strings = new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}; DataProcessor[] values = new DataProcessor[]{new LargeDataModel(), new NormalDataModel()}; return new UIButtonGroup(strings, values); } @@ -240,7 +240,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //不透明度 protected JPanel createAlphaPane() { transparent = new UINumberDragPane(0, 100); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); } //堆积和坐标轴设置(自定义柱形图等用到) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index 5dfc50ec47..1c3ed4aa53 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -4,7 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; @@ -52,7 +52,7 @@ public class VanChartPlotTooltipPane extends BasicPane { } protected void addComponents(Plot plot) { - isTooltipShow = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); + isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); tooltipPane = createTooltipPane(plot); double p = TableLayout.PREFERRED; @@ -96,8 +96,8 @@ public class VanChartPlotTooltipPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{tooltipContentPane,null}, new Component[]{createLabelStylePane(),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(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{createDisplayStrategy(plot),null}, }; return components; @@ -109,7 +109,7 @@ public class VanChartPlotTooltipPane extends BasicPane { } protected JPanel createLabelStylePane() { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane = new ChartTextAttrPane() { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ @@ -120,14 +120,14 @@ public class VanChartPlotTooltipPane extends BasicPane { } }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), style); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Character"), style); JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(panel, BorderLayout.CENTER); panel1.add(textFontPane, BorderLayout.SOUTH); initStyleListener(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); } @@ -142,8 +142,8 @@ public class VanChartPlotTooltipPane extends BasicPane { protected JPanel createDisplayStrategy(Plot plot) { showAllSeries = new UICheckBox(getShowAllSeriesLabelText()); - followMouse = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Follow_Mouse")}); + followMouse = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), + Toolkit.i18nText("Fine-Design_Chart_Not_Follow_Mouse")}); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -151,17 +151,17 @@ public class VanChartPlotTooltipPane extends BasicPane { double[] rowSize = { p,p,p}; Component[][] components = new Component[3][2]; components[0] = new Component[]{null,null}; - components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; + components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; if(plot.isSupportTooltipSeriesType() && hasTooltipSeriesType()){ components[2] = new Component[]{showAllSeries,null}; } JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); } protected String getShowAllSeriesLabelText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"); + return Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"); }; protected boolean hasTooltipSeriesType() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index c0195070aa..cc912cf3fa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -12,6 +12,7 @@ import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithOutImageAndShadow; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithMapZoom; +import com.fr.design.i18n.Toolkit; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -51,8 +52,8 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith } private JPanel createDrillToolsPane() { - openOrClose = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - JPanel openOrClosePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill_Dir"), openOrClose); + openOrClose = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); + JPanel openOrClosePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Drill_Dir"), openOrClose); textAttrPane = new ChartTextAttrPane() { @Override @@ -83,9 +84,9 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double[] rowSize = {p, p, p, p, p, p}; Component[][] components = new Component[][]{ new Component[]{null}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane)}, - new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Select_Color"), selectBackgroundPane)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Select_Color"), selectBackgroundPane)}, new Component[]{catalogSuperLink} }; drillPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -101,7 +102,7 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith } }); - JPanel panel1 = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Drill"), panel); + JPanel panel1 = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Drill"), panel); panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel1; } From 83872631ae7dcc9963ad416242620f25000fa923 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 8 Mar 2020 14:25:51 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E6=B2=BF=E7=94=A8=E4=BB=A5=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E9=80=8F=E6=98=8E=E9=A2=9C=E8=89=B2=E3=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9getGaugeStyle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/constants/UIConstants.java | 2 -- .../com/fr/design/gui/ibutton/UIColorButtonWithAuto.java | 5 +++-- .../fr/design/style/color/ColorControlWindowWithAuto.java | 5 +++-- .../chart/gui/style/ChartTextAttrPaneWithAuto.java | 6 +++--- .../designer/style/label/VanChartGaugeLabelDetailPane.java | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 85c2c30922..15a7c87c08 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -143,8 +143,6 @@ public interface UIConstants { public static final Color TAB_BUTTON_PRESS_SELECTED = new Color(236, 236, 238); public static final Color POPUP_TITLE_BACKGROUND = new Color(0xd8f2fd); public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3); - public static final Color AUTO_FONT_COLOR = new Color(0, 0, 0, 0); - public static final Color TRANSPARENT_FONT_COLOR = new Color(255, 255, 255, 0); public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png"); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java index db64cba87f..c883148ca3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -1,5 +1,6 @@ package com.fr.design.gui.ibutton; +import com.fr.chart.base.ChartConstants; import com.fr.design.constants.UIConstants; import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindowWithAuto; @@ -10,11 +11,11 @@ import java.awt.Color; public class UIColorButtonWithAuto extends UIColorButton { protected void checkColorChange(Color oldColor, Color newColor) { - if (ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { + if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { setIcon(UIConstants.FONT_ICON); } - if (!ComparatorUtils.equals(oldColor, UIConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, UIConstants.AUTO_FONT_COLOR)) { + if (!ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { setIcon(UIConstants.AUTO_FONT_ICON); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java index 46d32c7136..05da3d4b97 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java @@ -1,5 +1,6 @@ package com.fr.design.style.color; +import com.fr.chart.base.ChartConstants; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; @@ -59,12 +60,12 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow { protected void doTransparent() { getPopupHider().hidePopupMenu(); - setColor(UIConstants.TRANSPARENT_FONT_COLOR); + setColor(null); } protected void doAuto() { getPopupHider().hidePopupMenu(); - setColor(UIConstants.AUTO_FONT_COLOR); + setColor(ChartConstants.AUTO_FONT_COLOR); } public void customButtonPressed() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 6760474e93..79863a24ce 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.chart.gui.style; +import com.fr.chart.base.ChartConstants; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButtonWithAuto; import com.fr.design.i18n.Toolkit; @@ -10,7 +11,6 @@ import com.fr.general.GeneralUtils; public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); - private static final int AUTO_SIZE_INT = 0; private boolean isFontSizeAuto = false; private boolean isColorAuto = false; @@ -48,7 +48,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { protected float getFontSize() { if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { - return AUTO_SIZE_INT; + return ChartConstants.AUTO_FONT_SIZE; } return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem())); @@ -56,7 +56,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { protected void setFontSize(FRFont frFont) { if (getFontSizeComboBox() != null && isFontSizeAuto) { - if (frFont.getSize() == AUTO_SIZE_INT) { + if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { getFontSizeComboBox().setSelectedItem(AUTO); } else { getFontSizeComboBox().setSelectedItem(frFont.getSize() + ""); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 9ead773035..0303a5a20d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -44,7 +44,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { } public GaugeStyle getGaugeStyle() { - return gaugeStyle; + return ((VanChartGaugePlot)this.getPlot()).getGaugeStyle(); } public void setGaugeStyle(GaugeStyle gaugeStyle) { From 0b3fd78b106ab1c270899b1278eb5aba486f6d69 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 8 Mar 2020 14:59:56 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E6=96=B9=E6=B3=95=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/ChartTextAttrPane.java | 11 ++++----- .../gui/style/ChartTextAttrPaneWithAuto.java | 24 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index 3ac7f116e9..7d38d4d39d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -34,11 +34,10 @@ public class ChartTextAttrPane extends BasicPane { private UIToggleButton bold; private UIToggleButton italic; private UIColorButton fontColor; - public static Integer[] Font_Sizes = new Integer[FONT_END - FONT_START + 1]; - + public static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1]; static { for (int i = FONT_START; i <= FONT_END; i++) { - Font_Sizes[i - FONT_START] = i; + FONT_SIZES[i - FONT_START] = i; } } @@ -114,7 +113,7 @@ public class ChartTextAttrPane extends BasicPane { fontNameComboBox.setSelectedItem(frFont.getFamily()); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); - setFontSize(frFont); + populateFontSize(frFont); if (fontColor != null) { fontColor.setColor(frFont.getForeground()); } @@ -124,7 +123,7 @@ public class ChartTextAttrPane extends BasicPane { registerAllComboBoxListener(listener); } - protected void setFontSize(FRFont frFont) { + protected void populateFontSize(FRFont frFont) { if (fontSizeComboBox != null) { fontSizeComboBox.setSelectedItem(frFont.getSize()); } @@ -177,7 +176,7 @@ public class ChartTextAttrPane extends BasicPane { } protected Object[] getFontSizeComboBoxModel() { - return Font_Sizes; + return FONT_SIZES; } protected void initState() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 79863a24ce..6061ed18b0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -13,6 +13,14 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); private boolean isFontSizeAuto = false; private boolean isColorAuto = false; + public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; + static { + FONT_SIZES_WITH_AUTO[0] = AUTO; + + for (int i = 1; i < FONT_SIZES_WITH_AUTO.length; i++) { + FONT_SIZES_WITH_AUTO[i] = FONT_START + i - 1 + ""; + } + } public ChartTextAttrPaneWithAuto() { super(); @@ -31,19 +39,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { } protected Object[] getFontSizeComboBoxModel() { - if (isFontSizeAuto) { - String[] fontSizes = new String[FONT_END - FONT_START + 2]; - - fontSizes[0] = AUTO; - - for (int i = 1; i < fontSizes.length; i++) { - fontSizes[i] = FONT_START + i + ""; - } - - return fontSizes; - } - - return super.getFontSizeComboBoxModel(); + return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; } protected float getFontSize() { @@ -54,7 +50,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem())); } - protected void setFontSize(FRFont frFont) { + protected void populateFontSize(FRFont frFont) { if (getFontSizeComboBox() != null && isFontSizeAuto) { if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { getFontSizeComboBox().setSelectedItem(AUTO); From f4b02049b70c5dfa2e82481922f3b41c076df17d Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 8 Mar 2020 15:22:49 +0800 Subject: [PATCH 16/16] =?UTF-8?q?get=E6=94=B9=E4=B8=BAupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/ChartTextAttrNoColorPane.java | 2 +- .../mainframe/chart/gui/style/ChartTextAttrPane.java | 10 +++++----- .../chart/gui/style/ChartTextAttrPaneWithAuto.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java index 249583768f..177168cd77 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java @@ -56,6 +56,6 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane { public FRFont updateFRFont() { String name = GeneralUtils.objectToString(getFontNameComboBox().getSelectedItem()); - return FRFont.getInstance(name, getFontStyle(), getFontSize()); + return FRFont.getInstance(name, updateFontStyle(), updateFontSize()); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index 7d38d4d39d..a6be91a248 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -147,10 +147,10 @@ public class ChartTextAttrPane extends BasicPane { public FRFont updateFRFont() { String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem()); - return FRFont.getInstance(name, getFontStyle(), getFontSize(), fontColor.getColor()); + return FRFont.getInstance(name, updateFontStyle(), updateFontSize(), fontColor.getColor()); } - protected int getFontStyle() { + protected int updateFontStyle() { int style = Font.PLAIN; if (bold.isSelected() && !italic.isSelected()) { style = Font.BOLD; @@ -163,7 +163,7 @@ public class ChartTextAttrPane extends BasicPane { return style; } - protected float getFontSize() { + protected float updateFontSize() { return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem())); } @@ -205,7 +205,7 @@ public class ChartTextAttrPane extends BasicPane { populate(FRFont.getInstance()); } - protected JPanel getContentPane (JPanel buttonPane) { + protected JPanel getContentPane(JPanel buttonPane) { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; @@ -213,7 +213,7 @@ public class ChartTextAttrPane extends BasicPane { return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); } - protected double[] getRowSize () { + protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p, p}; } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java index 6061ed18b0..70fdf903eb 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -42,7 +42,7 @@ public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { return isFontSizeAuto ? FONT_SIZES_WITH_AUTO : FONT_SIZES; } - protected float getFontSize() { + protected float updateFontSize() { if (isFontSizeAuto && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { return ChartConstants.AUTO_FONT_SIZE; }