From 0f7eea4bc69f3a1c0afd680c4a0384736e11c2da Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 13:54:44 +0800 Subject: [PATCH 1/3] =?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); From 2609ac2aad49b91c79cc62dac47de9f1288d7429 Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 15:41:02 +0800 Subject: [PATCH 2/3] =?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?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 7 ------- 1 file changed, 7 deletions(-) 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 45fadd26c..2205a4f56 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,14 +104,7 @@ 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>() { From 54a51dcfd729221d59c6d23f288f2a77b297055e Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 16:14:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-59719=20fix=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 2205a4f56..d0738e57b 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 @@ -121,9 +121,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { while(itemIt.hasNext()) { model.addElement(itemIt.next()); } - // 重置下拉框高度 值一样时不会生效 所以先加再减下 - itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); - itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1); + // 如果加载成功 但是下拉框是可见的 下拉框高度是会固定为原始高度 不会因为填充了更多下拉项而变化 + // 需要重新设置下拉框高度 但值一样时相关事件不会生效 所以先加再减下 + if (itemComboBox.isPopupVisible()) { + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1); + } } catch (Exception e) { if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e);