From 35a6960a47af9d173be90422a59710c36f3f8659 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 2 Nov 2022 17:19:12 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-83302=20=E8=AE=BE=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=89=93=E5=BC=80=E5=90=8E=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=9A=84=E5=86=85=E5=AE=B9=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E5=9C=A8=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E9=87=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../replace/ui/ITReplaceNorthPanel.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index 977d819807..a11886c2c8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java @@ -20,6 +20,8 @@ import javax.swing.Icon; import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.ScrollPaneConstants; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import java.awt.CardLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; @@ -317,6 +319,45 @@ public class ITReplaceNorthPanel { refreshExtraComboBox(replaceSettingInputComboBox, replaceExtraSettingComboBox); } }); + + initInputComboBoxPopupListener(findSettingInputComboBox); + initInputComboBoxPopupListener(replaceSettingInputComboBox); + + } + + private void initInputComboBoxPopupListener(UIComboBox box) { + box.addPopupMenuListener(new PopupMenuListener() { + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + String str = GeneralUtils.objectToString(findSettingComboBox.getSelectedItem()); + int findExtraIndex = findExtraSettingComboBox.getSelectedIndex(); + int replaceExtraIndex = replaceExtraSettingComboBox.getSelectedIndex(); + box.refreshBoxItems(SettingController.getSettingRefreshItems(str)); + dealExtraItemSelect(findExtraSettingComboBox, findExtraIndex); + dealExtraItemSelect(replaceExtraSettingComboBox, replaceExtraIndex); + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); + } + + /** + * 重新设置额外下拉框的选中索引 + * @param comboBox 额外下拉框 + * @param index 索引 + */ + private void dealExtraItemSelect(UIComboBox comboBox, int index) { + if (comboBox.getItemCount() > index) { + comboBox.setSelectedIndex(index); + } } /**