[ 1833556 ] Ok in connection dialog doesn't always save changes

[ 1833558 ] connection dialog test database fail on a new installation
This commit is contained in:
Heng Sin Low 2007-11-17 07:38:27 +00:00
parent 7b36ea8f93
commit a1a9f7f770
2 changed files with 32 additions and 25 deletions

View File

@ -100,6 +100,9 @@ public class CConnection implements Serializable, Cloneable
if (cc == null) cc = new CConnection(apps_host);
CConnectionDialog ccd = new CConnectionDialog (cc);
s_cc = ccd.getConnection ();
if (!s_cc.isDatabaseOK() && !ccd.isCancel()) {
s_cc.testDatabase(true);
}
// set also in ALogin and Ctrl
Ini.setProperty (Ini.P_CONNECTION, s_cc.toStringLong ());
Ini.saveProperties (Ini.isClient ());
@ -955,8 +958,7 @@ public class CConnection implements Serializable, Cloneable
if (!retest && m_ds != null && m_okDB)
return null;
if (m_ds != null)
getDatabase().close();
getDatabase().close();
m_ds = null;
setDataSource();
// the actual test

View File

@ -330,7 +330,8 @@ public class CConnectionDialog extends CDialog implements ActionListener
if (src == bOK)
{
m_cc.setName();
updateCConnection();
m_cc.setName();
m_ccResult = m_cc;
dispose();
isCancel = false;
@ -359,6 +360,31 @@ public class CConnectionDialog extends CDialog implements ActionListener
}
updateCConnection();
//
if (src == bTestApps)
cmd_testApps();
// Database Selection Changed
else if (src == dbTypeField)
{
m_cc.setType((String)dbTypeField.getSelectedItem());
dbPortField.setText(String.valueOf(m_cc.getDbPort()));
cbBequeath.setSelected(m_cc.isBequeath());
fwPortField.setText(String.valueOf(m_cc.getFwPort()));
}
//
else if (src == bTestDB)
cmd_testDB();
// Name
if (src == nameField)
m_cc.setName(nameField.getText());
updateInfo();
} // actionPerformed
private void updateCConnection() {
if (Ini.isClient())
{
//hengsin: avoid unnecessary requery of application server status
@ -383,28 +409,7 @@ public class CConnectionDialog extends CDialog implements ActionListener
m_cc.setViaFirewall(cbFirewall.isSelected());
m_cc.setFwHost(fwHostField.getText());
m_cc.setFwPort(fwPortField.getText());
//
if (src == bTestApps)
cmd_testApps();
// Database Selection Changed
else if (src == dbTypeField)
{
m_cc.setType((String)dbTypeField.getSelectedItem());
dbPortField.setText(String.valueOf(m_cc.getDbPort()));
cbBequeath.setSelected(m_cc.isBequeath());
fwPortField.setText(String.valueOf(m_cc.getFwPort()));
}
//
else if (src == bTestDB)
cmd_testDB();
// Name
if (src == nameField)
m_cc.setName(nameField.getText());
updateInfo();
} // actionPerformed
}
/**
* Update Fields from Connection