diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 62b5bb489..db257de3d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -178,10 +178,10 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { GUICoreUtils.setEnabled(pointEffectPane, !largeModel); } - checkMarkerComboboxModel((VanChartMapPlot) plot); - + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + refreshMarkerComboboxModel(mapPlot); if (largeModel) { - checkLargeModelPlotSelectedItem(); + checkLargeModelPlotSelectedItem(mapPlot); } } @@ -194,33 +194,21 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } } - private void checkMarkerComboboxModel(VanChartMapPlot plot) { - if (markerTypeCom == null) { - return; - } - - if (shouldRefreshComboboxModel(plot)) { - - refreshMarkerTypeComboboxModel(plot); - - markerTypeCom.setSelectedItem(plot.getMapMarkerType().toLocalString()); - if (markerTypeLayout != null && markerContentPane != null) { - markerTypeLayout.show(markerContentPane, plot.getMapMarkerType().toLocalString()); - } - } - } - - private void checkLargeModelPlotSelectedItem() { - MapMarkerType selectedType = (MapMarkerType) markerTypeCom.getSelectedItem(); + private void checkLargeModelPlotSelectedItem(VanChartMapPlot plot) { + String selected = plot.getMapMarkerType().toLocalString(); - if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedType)) { + if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selected)) { markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); } else { - markerTypeCom.setSelectedItem(selectedType); + markerTypeCom.setSelectedItem(selected); } } private boolean shouldRefreshComboboxModel(VanChartMapPlot plot) { + if (markerTypeCom == null) { + return false; + } + MapMarkerType selectedType = plot.getMapMarkerType(); DefaultComboBoxModel model = (DefaultComboBoxModel) markerTypeCom.getModel(); @@ -231,7 +219,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) > -1; } - private void refreshMarkerTypeComboboxModel(VanChartMapPlot plot) { + private void refreshMarkerComboboxModel(VanChartMapPlot plot) { if (largeModel(plot)) { if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) { @@ -247,6 +235,13 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { markerTypeCom.setModel(new DefaultComboBoxModel<>(MARKER_TYPES)); } } + + String selected = plot.getMapMarkerType().toLocalString(); + + markerTypeCom.setSelectedItem(selected); + if (markerTypeLayout != null && markerContentPane != null) { + markerTypeLayout.show(markerContentPane, selected); + } } @Override @@ -572,9 +567,15 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { public void populateBean(Plot plot) { if (plot instanceof VanChartMapPlot) { + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + if (markerTypeCom != null) { - checkMarkerComboboxModel(((VanChartMapPlot) plot)); - markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString()); + + if (shouldRefreshComboboxModel(mapPlot)) { + refreshMarkerComboboxModel(mapPlot); + } + + markerTypeCom.setSelectedItem(mapPlot.getMapMarkerType().toLocalString()); } if (nullValueColorBox != null) { //TODO Bjorn 地图空值背景自动 @@ -585,11 +586,11 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); checkNullValueButton();*/ - nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); + nullValueColorBox.setSelectObject(mapPlot.getNullValueColor()); } //大数据模式 恢复用注释。下面3行删除。 if (lineMapLargeDataModelGroup != null) { - lineMapLargeDataModelGroup.setSelectedItem(((VanChartMapPlot) plot).getLineMapDataProcessor()); + lineMapLargeDataModelGroup.setSelectedItem(mapPlot.getLineMapDataProcessor()); } } super.populateBean(plot); @@ -597,18 +598,23 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { public void updateBean(Plot plot) { if (plot instanceof VanChartMapPlot) { + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + if (markerTypeCom != null) { - ((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parse((String) markerTypeCom.getSelectedItem())); - checkMarkerComboboxModel((VanChartMapPlot) plot); + mapPlot.setMapMarkerType(MapMarkerType.parse((String) markerTypeCom.getSelectedItem())); + + if (shouldRefreshComboboxModel(mapPlot)) { + refreshMarkerComboboxModel(mapPlot); + } } if (nullValueColorBox != null) { //TODO Bjorn 地图空值背景自动 //((VanChartMapPlot) plot).setAutoNullValue(nullValueAuto.getSelectedIndex() == 0); - ((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject()); + mapPlot.setNullValueColor(nullValueColorBox.getSelectObject()); } //大数据模式 恢复用注释。下面3行删除。 if (lineMapLargeDataModelGroup != null) { - ((VanChartMapPlot) plot).setLineMapDataProcessor(lineMapLargeDataModelGroup.getSelectedItem()); + mapPlot.setLineMapDataProcessor(lineMapLargeDataModelGroup.getSelectedItem()); } } super.updateBean(plot);