Browse Source

Merge pull request #5925 in DESIGN/design from final/10.0 to release/10.0

* commit '40486a3e46cae6147927e9761d0cf0b78f953d6e':
  REPORT-59719 【10.0】点击数据源的刷新按钮,数据列表会变空白
zheng-1641779399395
superman 3 years ago
parent
commit
1ed410b320
  1. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  2. 9
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -87,12 +87,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items
*/
protected Iterator<String> items() {
nameList = new ArrayList<String>();
ConnectionConfig mgr = ConnectionConfig.getInstance();
Iterator<String> nameIt = mgr.getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
nameList = new ArrayList<>();
if (noAuthConnections == null) {
return nameList.iterator();
}

9
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -91,6 +91,9 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
refreshWorker.cancel(true);
}
// 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem();
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeAllElements();
@ -98,6 +101,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
model.addElement(EMPTY);
model.addElement(PENDING);
// 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题
// 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容
if (lastSelectedItem != null) {
model.setSelectedItem(lastSelectedItem);
}
refreshWorker = new SwingWorker<Iterator<String>, Void>() {
@Override
protected Iterator<String> doInBackground() throws Exception {

Loading…
Cancel
Save