Browse Source

KERNEL-6188 修改一下doInBackground()方法与done()方法之间传递参数的类型,去除冗余代码

feature/big-screen
Yvan 4 years ago
parent
commit
1320c80082
  1. 16
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

16
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -131,16 +131,13 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public void actionPerformed(ActionEvent evt) {
// Try the java connection.
final SwingWorker connectionThread = new SwingWorker() {
final SwingWorker<Boolean, Void> connectionThread = new SwingWorker<>() {
@Override
protected Object doInBackground() throws Exception {
protected Boolean doInBackground() throws Exception {
try {
Connection database = DatabaseConnectionPane.this.updateBean();
boolean connect = DataOperator.getInstance().testConnection(database);
Map<String, Object> map = new HashMap<>();
map.put("database", database);
map.put("connect", connect);
return map;
// 返回连接结果
return DataOperator.getInstance().testConnection(database);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
}
@ -150,11 +147,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
@Override
protected void done() {
try {
Map<String, Object> map = (Map<String, Object>) get();
Connection database = (Connection) map.get("database");
boolean connect = (boolean) map.get("connect");
boolean connect = get();
okButton.setEnabled(true);
message.setText(database.connectMessage(connect));
if (connect) {
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));

Loading…
Cancel
Save