Browse Source

Merge pull request #8985 in DESIGN/design from feature/10.0 to feature/big-screen

* commit '10effddc73c9334f5b748c434bff17e00771391a':
  REPORT-71890 重新加上 使用refresh模式
  REPORT-71890 填报-填报属性设置-填报属性的数据库保存后打开,不显示了
feature/big-screen
superman 3 years ago
parent
commit
0da16a380d
  1. 49
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

49
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -649,12 +649,49 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
*/ */
@Override @Override
public void registerDSChangeListener() { public void registerDSChangeListener() {
this.addAncestorListener(new ManageDsListenerRegisterListener(new ChangeListener() { // 还是需要保留 恶心
@Override // 1. 切换工作目录需要依赖这个监听 切换工作目录没有一个数据连接的刷新触发 就很坑
public void stateChanged(ChangeEvent e) { // 2. DesignerContext.getDesignerBean("databasename").refreshBeanElement()有坑 a.调用不全 b.某些场景下 因为注册覆盖 会失效
initDsNameComboBox(); // 监听内容变成刷新模式 不会覆盖 populate填充内容
} this.addAncestorListener(new ManageDsListenerRegisterListener(new ChangeListener() {
})); @Override
public void stateChanged(ChangeEvent e) {
refreshDsNameComboBox();
}
}));
}
@SuppressWarnings("unchecked")
private void refreshDsNameComboBox() {
if (initWorker != null && !initWorker.isDone()) {
initWorker.cancel(true);
}
dsNameComboBox.setRefreshingModel(true);
initWorker = new SwingWorker<List<String>, Void>() {
@Override
protected List<String> doInBackground() throws Exception {
return getHasAuthConnections();
}
@Override
protected void done() {
try {
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(get());
String selected = dsNameComboBox.getSelectedItem();
dsNameComboBox.setModel(dsNameComboBoxModel);
dsNameComboBox.setRefreshingModel(true);
dsNameComboBox.setSelectedItem(selected);
dsNameComboBox.setRefreshingModel(false);
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
};
initWorker.execute();
} }
/** /**

Loading…
Cancel
Save