From 7f8baa3369417478eb9430c8f1afb694649935dd Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 6 May 2020 15:20:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?CHART-13733=20=E6=8A=98=E7=BA=BF=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E7=82=B9=E6=96=B0=E5=A2=9E=E8=87=AA=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/xcombox/MarkerComboBox.java | 12 ++- .../chart/area/VanChartAreaSeriesPane.java | 8 ++ .../component/VanChartMarkerPane.java | 17 ++-- .../marker/VanChartCommonMarkerPane.java | 97 +++++++++++++------ .../series/VanChartGanttCommonMarkerPane.java | 19 ++-- .../chart/line/VanChartLineSeriesPane.java | 19 ++++ .../series/VanChartMapScatterMarkerPane.java | 13 ++- 7 files changed, 137 insertions(+), 48 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java b/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java index ef1976ce8..e5154ba5e 100644 --- a/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java @@ -9,8 +9,10 @@ import com.fr.base.ScreenResolution; import com.fr.base.background.ColorBackground; import com.fr.chart.chartglyph.Marker; import com.fr.chart.chartglyph.NullMarker; +import com.fr.plugin.chart.glyph.marker.VanChartAutoMarker; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.i18n.Toolkit; import com.fr.general.FRFont; @@ -65,15 +67,21 @@ public class MarkerComboBox extends UIComboBox { g2d.setFont(FRContext.getDefaultValues().getFRFont()); if (marker != null) { - if (marker instanceof NullMarker) { + boolean isAutoMarker = marker instanceof VanChartAutoMarker; + boolean isNullMarker = marker instanceof NullMarker; + + if (isAutoMarker || isNullMarker) { g2d.setColor(Color.black); FRFont font = FRContext.getDefaultValues().getFRFont(); int resolution = ScreenResolution.getScreenResolution(); Font rfont = font.applyResolutionNP(resolution); g2d.setFont(rfont); FontMetrics fm = GraphHelper.getFontMetrics(rfont); + String text = isNullMarker + ?Toolkit.i18nText("Fine-Design_Report_None") + :Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); - GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 12, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + GraphHelper.drawString(g2d, text, 12, (d.height - fm.getHeight()) / 2 + fm.getAscent()); } else { if (marker.getBackground() == null) { marker.setBackground(ColorBackground.getInstance(Color.black)); diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java index 97c1c89fe..a006ce54f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java @@ -2,13 +2,16 @@ package com.fr.van.chart.area; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +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.ChartStylePane; import com.fr.van.chart.column.VanChartCustomStackAndAxisConditionPane; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartLineTypePaneWithoutDashed; +import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.line.VanChartLineSeriesPane; import javax.swing.JPanel; @@ -55,4 +58,9 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { protected VanChartLineTypePane getLineTypePane() { return new VanChartLineTypePaneWithoutDashed(); } + + protected JPanel createMarkerPane() { + markerPane = new VanChartMarkerPane(); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartMarkerPane.java index e2aff03f5..58d717af1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartMarkerPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.plugin.chart.base.VanChartAttrMarker; @@ -25,13 +26,13 @@ public class VanChartMarkerPane extends BasicPane { private CardLayout cardLayout; private VanChartCommonMarkerPane commonMarkerPane; - + private BasicBeanPane imageMarkerPane; public VanChartMarkerPane() { this.setLayout(new BorderLayout(0, 4)); - String[] array = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rule"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}; + String[] array = new String[]{Toolkit.i18nText("Fine-Design_Chart_Rule"), Toolkit.i18nText("Fine-Design_Chart_Custom")}; commonORCustom = new UIButtonGroup(array, array); commonORCustom.addChangeListener(new ChangeListener() { @@ -56,8 +57,8 @@ public class VanChartMarkerPane extends BasicPane { } } }; - centerPane.add(commonMarkerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rule")); - centerPane.add(imageMarkerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); + centerPane.add(commonMarkerPane, Toolkit.i18nText("Fine-Design_Chart_Rule")); + centerPane.add(imageMarkerPane, Toolkit.i18nText("Fine-Design_Chart_Custom")); layoutComponents(); } @@ -75,8 +76,10 @@ public class VanChartMarkerPane extends BasicPane { } protected VanChartCommonMarkerPane createCommonMarkerPane() { + return new VanChartCommonMarkerPane(){ - protected double[] getcolumnSize () { + + protected double[] getColumnSize() { double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; return new double[] {d, s}; @@ -85,7 +88,7 @@ public class VanChartMarkerPane extends BasicPane { } protected void layoutComponents() { - this.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point_Style"), commonORCustom), BorderLayout.NORTH); + this.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Point_Style"), commonORCustom), BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } @@ -98,7 +101,7 @@ public class VanChartMarkerPane extends BasicPane { } protected String title4PopupWindow(){ - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"); + return Toolkit.i18nText("Fine-Design_Chart_Marker"); } public void populate(VanChartAttrMarker marker) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java index 7a03bd465..f62604501 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/marker/VanChartCommonMarkerPane.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.marker; import com.fr.chart.chartglyph.Marker; +import com.fr.design.i18n.Toolkit; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -12,17 +13,23 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartMarkerBackgroundPane; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** * Created by Mitisky on 16/5/19. * 通用标记点,标记点类型/颜色/半径 */ public class VanChartCommonMarkerPane extends BasicBeanPane { - private MarkerComboBox markerPane; + private MarkerComboBox markerTypeComboBox; private VanChartMarkerBackgroundPane markerFillColor; private UISpinner radius; + private JPanel markerTypePane; + private JPanel markerConfigPane; + private static final MarkerType[] NORMAL_TYPES = { MarkerType.MARKER_NULL, MarkerType.MARKER_CIRCLE, @@ -46,6 +53,20 @@ public class VanChartCommonMarkerPane extends BasicBeanPane return normalMarkers; } + protected static Marker[] getNormalMarkersWithAuto() { + if (normalMarkers == null) { + normalMarkers = new Marker[NORMAL_TYPES.length + 1]; + normalMarkers[0] = Marker.createMarker(MarkerType.MARKER_AUTO); + + int i = 1; + + for (MarkerType markerType : NORMAL_TYPES) { + normalMarkers[i++] = Marker.createMarker(markerType); + } + } + return normalMarkers; + } + //没有无这个选项 private static final MarkerType[] MAP_TYPES = { MarkerType.MARKER_CIRCLE, @@ -88,13 +109,16 @@ public class VanChartCommonMarkerPane extends BasicBeanPane return ganttMarkers; } + public MarkerComboBox getMarkerTypeComboBox() { + return markerTypeComboBox; + } - protected MarkerComboBox getMarkerPane(){ - return markerPane; + public UISpinner getRadius() { + return radius; } public VanChartCommonMarkerPane() { - markerPane = new MarkerComboBox(getMarkers()); + markerTypeComboBox = new MarkerComboBox(getMarkers()); markerFillColor = new VanChartMarkerBackgroundPane(){ protected Component[][] getPaneComponents() { return new Component[][]{ @@ -106,42 +130,55 @@ public class VanChartCommonMarkerPane extends BasicBeanPane radius = new UISpinner(0, 100, 0.5, 0); double p = TableLayout.PREFERRED; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double[] row = {p, p, p}; - Component[][] components = getUseComponent(); + markerTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(getMarkerTypeComponent(), new double[]{p}, getColumnSize()); + markerConfigPane = TableLayout4VanChartHelper.createGapTableLayoutPane(getMarkerConfigComponent(), new double[]{p, p}, getColumnSize()); - JPanel jPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, getcolumnSize()); + markerTypeComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkMarkType(); + } + }); - this.add(jPanel); - } + JPanel contentPane = new JPanel(new BorderLayout(0, 6)); - protected double[] getcolumnSize () { - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - return new double[] {d, e}; - } + contentPane.add(markerTypePane, BorderLayout.CENTER); + contentPane.add(markerConfigPane, BorderLayout.SOUTH); - protected Marker[] getMarkers() { - return getNormalMarkers(); + this.add(contentPane); } - protected Component[][] getUseComponent() { - return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), markerPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill_Color")), markerFillColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius")), radius}, + protected Component[][] getMarkerTypeComponent() { + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), markerTypeComboBox} }; } - protected Component[][] getUseComponentWithOutFillColor() { - return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), markerPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius")), radius}, + protected Component[][] getMarkerConfigComponent() { + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Fill_Color")), markerFillColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Radius")), radius} }; } + private void checkMarkType() { + if (markerConfigPane != null && markerTypeComboBox != null) { + MarkerType type = MarkerType.parse(markerTypeComboBox.getSelectedMarkder().getMarkerType()); + + markerConfigPane.setVisible(!(type == MarkerType.MARKER_AUTO || type == MarkerType.MARKER_NULL)); + } + } + + protected double[] getColumnSize() { + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + return new double[] {d, e}; + } + + protected Marker[] getMarkers() { + return getNormalMarkers(); + } /** * title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 @@ -162,9 +199,11 @@ public class VanChartCommonMarkerPane extends BasicBeanPane marker = new VanChartAttrMarker(); marker.setCommon(true); } - markerPane.setSelectedMarker(Marker.createMarker(populateMarkType(marker))); + markerTypeComboBox.setSelectedMarker(Marker.createMarker(populateMarkType(marker))); populateColor(marker); radius.setValue(marker.getRadius()); + + checkMarkType(); } protected void populateColor(VanChartAttrMarker marker) { @@ -188,7 +227,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane marker.setCommon(true); updateColor(marker); marker.setRadius(radius.getValue()); - marker.setMarkerType(MarkerType.parse(markerPane.getSelectedMarkder().getMarkerType())); + marker.setMarkerType(MarkerType.parse(markerTypeComboBox.getSelectedMarkder().getMarkerType())); } protected void updateColor(VanChartAttrMarker marker){ diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttCommonMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttCommonMarkerPane.java index 04d4e46dc..ff7b04e6f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttCommonMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttCommonMarkerPane.java @@ -3,6 +3,7 @@ package com.fr.van.chart.gantt.designer.style.series; import com.fr.base.background.ColorBackground; import com.fr.chart.chartglyph.Marker; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.marker.type.MarkerType; @@ -15,6 +16,8 @@ import java.awt.Component; * Created by hufan on 2017/1/13. */ public class VanChartGanttCommonMarkerPane extends VanChartCommonMarkerPane { + private static final int PREFERRED_WIDTH = 100; + private ColorSelectBoxWithOutTransparent colorSelect; @Override @@ -22,13 +25,17 @@ public class VanChartGanttCommonMarkerPane extends VanChartCommonMarkerPane { return getGanttMarkers(); } - @Override - protected Component[][] getUseComponent() { - colorSelect = new ColorSelectBoxWithOutTransparent(100); + protected Component[][] getMarkerTypeComponent() { + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")), getMarkerTypeComboBox()}, + }; + } + + protected Component[][] getMarkerConfigComponent() { + colorSelect = new ColorSelectBoxWithOutTransparent(PREFERRED_WIDTH); return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Shape")), getMarkerPane()}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect} }; } @@ -52,7 +59,7 @@ public class VanChartGanttCommonMarkerPane extends VanChartCommonMarkerPane { @Override public void setDefaultValue() { - getMarkerPane().setSelectedMarker(Marker.createMarker(MarkerType.MARKER_STAR)); + getMarkerTypeComboBox().setSelectedMarker(Marker.createMarker(MarkerType.MARKER_STAR)); colorSelect.setSelectObject(new Color(248, 182, 44)); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java index 8300cac6b..974bc5e42 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java @@ -1,10 +1,15 @@ package com.fr.van.chart.line; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.Marker; +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.ChartStylePane; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartBeautyPane; +import com.fr.van.chart.designer.component.VanChartMarkerPane; +import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import javax.swing.JPanel; @@ -44,4 +49,18 @@ public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane { return null; } + protected JPanel createMarkerPane() { + markerPane = new VanChartMarkerPane() { + protected VanChartCommonMarkerPane createCommonMarkerPane() { + + return new VanChartCommonMarkerPane() { + protected Marker[] getMarkers() { + return getNormalMarkersWithAuto(); + } + }; + } + }; + + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapScatterMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapScatterMarkerPane.java index 7a0583ab9..4041152f4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapScatterMarkerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapScatterMarkerPane.java @@ -1,6 +1,8 @@ package com.fr.van.chart.map.designer.style.series; import com.fr.chart.chartglyph.Marker; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; @@ -11,9 +13,12 @@ import java.awt.Component; * 只有标记点类型和半径 */ public class VanChartMapScatterMarkerPane extends VanChartCommonMarkerPane { - @Override - protected Component[][] getUseComponent() { - return super.getUseComponentWithOutFillColor(); + + protected Component[][] getMarkerConfigComponent() { + + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Radius")), getRadius()} + }; } @Override @@ -22,7 +27,7 @@ public class VanChartMapScatterMarkerPane extends VanChartCommonMarkerPane { } @Override - protected double[] getcolumnSize () { + protected double[] getColumnSize() { double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; return new double[] {d, s}; From ed3540a09a8ee525cdce463941d16a5a721550ca Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 6 May 2020 16:27:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4instanceof=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/xcombox/MarkerComboBox.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java b/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java index e5154ba5e..5909437c7 100644 --- a/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java @@ -8,8 +8,8 @@ import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.base.background.ColorBackground; import com.fr.chart.chartglyph.Marker; -import com.fr.chart.chartglyph.NullMarker; -import com.fr.plugin.chart.glyph.marker.VanChartAutoMarker; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.ConfigHelper; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.i18n.Toolkit; @@ -23,6 +23,8 @@ import java.awt.*; * Combobox for selecting marker. */ public class MarkerComboBox extends UIComboBox { + private static final double TEXT_X_COORDINATES = 12d; + /** * Constructor. * @@ -67,21 +69,15 @@ public class MarkerComboBox extends UIComboBox { g2d.setFont(FRContext.getDefaultValues().getFRFont()); if (marker != null) { - boolean isAutoMarker = marker instanceof VanChartAutoMarker; - boolean isNullMarker = marker instanceof NullMarker; + boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M); + boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M); if (isAutoMarker || isNullMarker) { - g2d.setColor(Color.black); - FRFont font = FRContext.getDefaultValues().getFRFont(); - int resolution = ScreenResolution.getScreenResolution(); - Font rfont = font.applyResolutionNP(resolution); - g2d.setFont(rfont); - FontMetrics fm = GraphHelper.getFontMetrics(rfont); String text = isNullMarker ?Toolkit.i18nText("Fine-Design_Report_None") :Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); - GraphHelper.drawString(g2d, text, 12, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + paintTextMarker(g2d, d, text); } else { if (marker.getBackground() == null) { marker.setBackground(ColorBackground.getInstance(Color.black)); @@ -106,5 +102,16 @@ public class MarkerComboBox extends UIComboBox { private Marker marker = null; private boolean isSelected = false; + + private void paintTextMarker(Graphics2D g2d, Dimension d, String text) { + g2d.setColor(Color.black); + FRFont font = FRContext.getDefaultValues().getFRFont(); + int resolution = ScreenResolution.getScreenResolution(); + Font rfont = font.applyResolutionNP(resolution); + g2d.setFont(rfont); + FontMetrics fm = GraphHelper.getFontMetrics(rfont); + + GraphHelper.drawString(g2d, text, TEXT_X_COORDINATES, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + } } } \ No newline at end of file