Browse Source

Merge pull request #8238 in DESIGN/design from release/11.0 to feature/x

* commit 'bf975f7f193386207ab7d98aecfdf621e3519710':
  REPORT-67954 远程设计时数据集面板数据连接空白的问题 提交11
feature/x
superman 3 years ago
parent
commit
62a0ae8a97
  1. 12
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

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

@ -10,11 +10,10 @@ import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UILockButton; import com.fr.design.gui.ibutton.UILockButton;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.report.LockItem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth; import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.report.LockItem;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Dimension; import java.awt.Dimension;
@ -96,6 +95,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
continue; continue;
} }
Connection connection = mgr.getConnection(conName); Connection connection = mgr.getConnection(conName);
// nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法
filterConnection(connection, conName, nameList); filterConnection(connection, conName, nameList);
} }
@ -140,12 +140,10 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
} else { } else {
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection(); String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection();
if (StringUtils.isNotBlank(s)) { if (StringUtils.isNotBlank(s)) {
for (int i = 0; i < this.getConnectionSize(); i++) { // 之前的写法有多线程问题,nameList异步尚未初始化完成的时候,这里可能无法匹配设置数据连接名称,导致DBTableDataPane打开后连接面板空白
String t = this.getConnection(i); // 这里的需求无非是设置上一次使用的数据连接,做个简单检查这个连接是否存在即可,存在就设置
if (ComparatorUtils.equals(s, t)) { if (ConnectionConfig.getInstance().getConnection(s) != null) {
this.setSelectedItem(s); this.setSelectedItem(s);
break;
}
} }
} }
// alex:如果这个ComboBox还是没有选中,那么选中第一个 // alex:如果这个ComboBox还是没有选中,那么选中第一个

Loading…
Cancel
Save