Browse Source

REPORT-59719 下拉框效果还有点问题

final/10.0
hades 3 years ago
parent
commit
0f7eea4bc6
  1. 9
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

9
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<Iterator<String>, 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);

Loading…
Cancel
Save