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); + } } /**