Browse Source

Merge pull request #8983 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '0f60d52434aa65c6eec8edc5cc0c32ad44eb306f':
  REPORT-71890 重新加上 使用refresh模式
  REPORT-71890 填报-填报属性设置-填报属性的数据库保存后打开,不显示了
feature/10.0
superman 3 years ago
parent
commit
10effddc73
  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
public void registerDSChangeListener() {
this.addAncestorListener(new ManageDsListenerRegisterListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initDsNameComboBox();
}
}));
// 还是需要保留 恶心
// 1. 切换工作目录需要依赖这个监听 切换工作目录没有一个数据连接的刷新触发 就很坑
// 2. DesignerContext.getDesignerBean("databasename").refreshBeanElement()有坑 a.调用不全 b.某些场景下 因为注册覆盖 会失效
// 监听内容变成刷新模式 不会覆盖 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