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