|
|
|
@ -100,6 +100,7 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); |
|
|
|
|
|
|
|
|
|
private JDBCDatabaseConnection jdbcDatabase; |
|
|
|
|
private boolean needRefresh = true; |
|
|
|
|
|
|
|
|
|
public JDBCDefPane() { |
|
|
|
|
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); |
|
|
|
@ -201,11 +202,11 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populate(JDBCDatabaseConnection jdbcDatabase) { |
|
|
|
|
needRefresh = false; |
|
|
|
|
if (jdbcDatabase == null) { |
|
|
|
|
jdbcDatabase = new JDBCDatabaseConnection(); |
|
|
|
|
} |
|
|
|
|
this.jdbcDatabase = jdbcDatabase; |
|
|
|
|
this.dbtypeComboBox.removeActionListener(dbtypeActionListener); |
|
|
|
|
if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver") |
|
|
|
|
&& jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) { |
|
|
|
|
this.dbtypeComboBox.setSelectedItem("Access"); |
|
|
|
@ -230,7 +231,6 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
this.dbtypeComboBox.setSelectedItem(OTHER_DB); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.dbtypeComboBox.addActionListener(dbtypeActionListener); |
|
|
|
|
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); |
|
|
|
|
this.urlTextField.setText(jdbcDatabase.getURL()); |
|
|
|
|
this.userNameTextField.setText(jdbcDatabase.getUser()); |
|
|
|
@ -254,6 +254,7 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); |
|
|
|
|
this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); |
|
|
|
|
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); |
|
|
|
|
needRefresh = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JDBCDatabaseConnection update() { |
|
|
|
@ -306,7 +307,9 @@ public class JDBCDefPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致
|
|
|
|
|
jdbcDatabase.setDatabase(StringUtils.EMPTY); |
|
|
|
|
if (needRefresh) { |
|
|
|
|
jdbcDatabase.setDatabase(StringUtils.EMPTY); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|