From f03d6b65fd86e48af75eedfd8a029dfc72ac1476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 18 May 2020 14:16:31 +0800 Subject: [PATCH] =?UTF-8?q?CHART-13958=20=E5=9C=B0=E5=9B=BE=E7=82=B9?= =?UTF-8?q?=E5=87=BBgis=E9=80=89=E6=8B=A9=E4=BC=9A=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../type/VanChartMapSourceChoosePane.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index f609debe9..e58797dca 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -42,7 +42,7 @@ import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; -import javax.swing.JOptionPane; +import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.SwingWorker; @@ -51,6 +51,8 @@ import javax.swing.event.PopupMenuListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; @@ -61,8 +63,6 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.ArrayList; -import java.util.List; /** * Created by Mitisky on 16/5/11. @@ -280,14 +280,12 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { public void popupMenuWillBecomeVisible(PopupMenuEvent e) { String selected = Utils.objectToString(gisLayer.getSelectedItem()); + ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem(); - gisLayer.removeAllItems(); - - for (String item : MapLayerConfigManager.getLayerItems()) { - gisLayer.addItem(item); - } + gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems())); gisLayer.setSelectedItem(selected); + zoomLevel.setSelectedItem(zoomSelected); } }); @@ -346,10 +344,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { } else { levels = ZOOM_LEVELS; } - zoomLevel.removeAllItems(); - for (int i = 0; i < levels.length; i++) { - zoomLevel.addItem(levels[i]); - } + zoomLevel.setModel(new DefaultComboBoxModel(levels)); }