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 746e0e4018..b46e0b7899 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 @@ -31,7 +31,6 @@ public class VanChartCommonMarkerPane extends BasicBeanPane private JPanel markerConfigPane; private static final MarkerType[] NORMAL_TYPES = { - MarkerType.MARKER_NULL, MarkerType.MARKER_CIRCLE, MarkerType.MARKER_SQUARE, MarkerType.MARKER_DIAMOND, @@ -42,53 +41,57 @@ public class VanChartCommonMarkerPane extends BasicBeanPane MarkerType.MARKER_TRIANGLE_HOLLOW }; private static Marker[] normalMarkers = null; + private static Marker[] normalMarkersWithNull = null; + private static Marker[] normalMarkersWithAuto = null; + private static Marker[] normalMarkersWithAutoAndNull = null; + + private static Marker[] getNormalMarkersWithCustom(MarkerType[] types) { + MarkerType[] customTypes = types == null ? new MarkerType[0] : types; + Marker[] result = new Marker[customTypes.length + NORMAL_TYPES.length]; + + int i = 0; + + for (MarkerType markerType : customTypes) { + result[i++] = Marker.createMarker(markerType); + } + + for (MarkerType markerType : NORMAL_TYPES) { + result[i++] = Marker.createMarker(markerType); + } + + return result; + } + protected static Marker[] getNormalMarkers() { - if(normalMarkers == null){ - normalMarkers = new Marker[NORMAL_TYPES.length]; - int i = 0; - for(MarkerType markerType : NORMAL_TYPES){ - normalMarkers[i++] = Marker.createMarker(markerType); - } + if (normalMarkers == null) { + normalMarkers = getNormalMarkersWithCustom(new MarkerType[0]); } + return normalMarkers; } - private static Marker[] normalMarkersWithAuto = null; - protected static Marker[] getNormalMarkersWithAuto() { - if (normalMarkersWithAuto == null) { - normalMarkersWithAuto = new Marker[NORMAL_TYPES.length + 1]; - normalMarkersWithAuto[0] = Marker.createMarker(MarkerType.MARKER_AUTO); + protected static Marker[] getNormalMarkersWithNull() { + if (normalMarkersWithNull == null) { + normalMarkersWithNull = getNormalMarkersWithCustom(new MarkerType[]{MarkerType.MARKER_NULL}); + } - int i = 1; + return normalMarkersWithNull; + } - for (MarkerType markerType : NORMAL_TYPES) { - normalMarkersWithAuto[i++] = Marker.createMarker(markerType); - } + protected static Marker[] getNormalMarkersWithAuto() { + if (normalMarkersWithAuto == null) { + normalMarkersWithAuto = getNormalMarkersWithCustom(new MarkerType[]{MarkerType.MARKER_AUTO}); } + return normalMarkersWithAuto; } - //没有无这个选项 - private static final MarkerType[] MAP_TYPES = { - MarkerType.MARKER_CIRCLE, - MarkerType.MARKER_SQUARE, - MarkerType.MARKER_DIAMOND, - MarkerType.MARKER_TRIANGLE, - MarkerType.MARKER_CIRCLE_HOLLOW, - MarkerType.MARKER_SQUARE_HOLLOW, - MarkerType.MARKER_DIAMOND_HOLLOW, - MarkerType.MARKER_TRIANGLE_HOLLOW - }; - private static Marker[] mapMarkers = null; - protected static Marker[] getMapScatterMarkers() { - if(mapMarkers == null){ - mapMarkers = new Marker[MAP_TYPES.length]; - int i = 0; - for(MarkerType markerType : MAP_TYPES){ - mapMarkers[i++] = Marker.createMarker(markerType); - } + protected static Marker[] getNormalMarkersWithAutoAndNull() { + if (normalMarkersWithAutoAndNull == null) { + normalMarkersWithAutoAndNull = getNormalMarkersWithCustom(new MarkerType[]{MarkerType.MARKER_AUTO, MarkerType.MARKER_NULL}); } - return mapMarkers; + + return normalMarkersWithAutoAndNull; } //甘特图的菱形是实心的,之前写的空心。 @@ -167,7 +170,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane if (markerConfigPane != null && markerTypeComboBox != null) { MarkerType type = MarkerType.parse(markerTypeComboBox.getSelectedMarkder().getMarkerType()); - markerConfigPane.setVisible(!(type == MarkerType.MARKER_AUTO || type == MarkerType.MARKER_NULL)); + markerConfigPane.setVisible(type != MarkerType.MARKER_NULL); } } @@ -178,7 +181,7 @@ public class VanChartCommonMarkerPane extends BasicBeanPane } protected Marker[] getMarkers() { - return getNormalMarkers(); + return getNormalMarkersWithNull(); } /** 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 974bc5e42d..49a4f44654 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 @@ -55,7 +55,7 @@ public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane { return new VanChartCommonMarkerPane() { protected Marker[] getMarkers() { - return getNormalMarkersWithAuto(); + return getNormalMarkersWithAutoAndNull(); } }; } 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 4041152f45..175cc8e253 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 @@ -23,7 +23,7 @@ public class VanChartMapScatterMarkerPane extends VanChartCommonMarkerPane { @Override protected Marker[] getMarkers() { - return getMapScatterMarkers(); + return getNormalMarkers(); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java index c6d7f8af6c..938f21da1e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java @@ -1,13 +1,17 @@ package com.fr.van.chart.scatter; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.Marker; 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.custom.component.VanChartCustomAxisConditionPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; +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 com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import com.fr.van.chart.scatter.component.VanChartScatterLineTypePane; @@ -63,7 +67,7 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { @Override public String getPaneTitle() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Axis"); + return Toolkit.i18nText("Fine-Design_Chart_Custom_Axis"); } }; stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); @@ -81,4 +85,19 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { checkLinePane(); } + + 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); + } }