From 0f7eea4bc69f3a1c0afd680c4a0384736e11c2da Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 13:54:44 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-59719=20=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E8=BF=98=E6=9C=89=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 748e70d6e..45fadd26c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -104,7 +104,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { // 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题 // 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容 if (lastSelectedItem != null) { + ActionListener[] actionListeners = itemComboBox.getActionListeners(); + for (ActionListener actionListener : actionListeners) { + itemComboBox.removeActionListener(actionListener); + } model.setSelectedItem(lastSelectedItem); + for (ActionListener actionListener : actionListeners) { + itemComboBox.addActionListener(actionListener); + } } refreshWorker = new SwingWorker, Void>() { @@ -121,7 +128,9 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { while(itemIt.hasNext()) { model.addElement(itemIt.next()); } + // 重置下拉框高度 值一样时不会生效 所以先加再减下 itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1); } catch (Exception e) { if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e);