From 5d19d7095813bde008cd89990214331651ec194f Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 14 May 2021 14:45:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-52087=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=95=B0=E6=8D=AE=E5=88=97=E4=B8=AD=E9=A6=96?= =?UTF-8?q?=E6=AC=A1=E4=BF=AE=E6=94=B9=E5=AD=97=E7=AC=A6=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/icombobox/LazyComboBox.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 300790457a..e1e1600790 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -55,12 +55,14 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen @Override public void setSelectedItem(Object anObject) { - initialSelected = anObject; if (loaded) { super.setSelectedItem(anObject); } else { - this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); + if (initialSelected == null) { + this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); + } super.setSelectedItem(anObject); + initialSelected = anObject; } } From 7bceb1fb2cbcb90a05eab81a6f5df30cca732b06 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 14 May 2021 15:06:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-52087=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=95=B0=E6=8D=AE=E5=88=97=E4=B8=AD=E9=A6=96?= =?UTF-8?q?=E6=AC=A1=E4=BF=AE=E6=94=B9=E5=AD=97=E7=AC=A6=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index e1e1600790..36b8eb2c19 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -62,8 +62,8 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); } super.setSelectedItem(anObject); - initialSelected = anObject; } + initialSelected = anObject; } @Override From b9dea208341a3eadf8078a5e98c06956cd3779fe Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 18 May 2021 15:32:37 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-52087=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=95=B0=E6=8D=AE=E5=88=97=E4=B8=AD=E9=A6=96?= =?UTF-8?q?=E6=AC=A1=E4=BF=AE=E6=94=B9=E5=AD=97=E7=AC=A6=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombobox/LazyComboBox.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 36b8eb2c19..61df2c9c68 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -55,15 +55,19 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen @Override public void setSelectedItem(Object anObject) { + initialSelected = anObject; if (loaded) { super.setSelectedItem(anObject); } else { - if (initialSelected == null) { - this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); - } + this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); super.setSelectedItem(anObject); } + + } + + private void setSelectedItemWithDocumentChange(Object anObject) { initialSelected = anObject; + super.setSelectedItem(anObject); } @Override @@ -185,7 +189,7 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen } filtering = true; String xx = textField.getText(); - LazyComboBox.this.setSelectedItem(xx); + LazyComboBox.this.setSelectedItemWithDocumentChange(xx); this.item = textField.getText(); setPopupVisible(true);