* 1800951 Connection dialog perform test when is cancel

* 1800952 Changing database type is slow
This commit is contained in:
Heng Sin Low 2007-09-24 08:04:25 +00:00
parent a483634643
commit 1f3b626b4d
3 changed files with 32 additions and 5 deletions

View File

@ -37,7 +37,7 @@ import org.jboss.security.SimplePrincipal;
* @author Marek Mosiewicz<marek.mosiewicz@jotel.com.pl> - support for RMI over HTTP * @author Marek Mosiewicz<marek.mosiewicz@jotel.com.pl> - support for RMI over HTTP
* @version $Id: CConnection.java,v 1.5 2006/07/30 00:55:13 jjanke Exp $ * @version $Id: CConnection.java,v 1.5 2006/07/30 00:55:13 jjanke Exp $
*/ */
public class CConnection implements Serializable public class CConnection implements Serializable, Cloneable
{ {
/** Connection */ /** Connection */
private static CConnection s_cc = null; private static CConnection s_cc = null;
@ -1679,6 +1679,16 @@ public class CConnection implements Serializable
m_server = null; m_server = null;
} }
@Override
public Object clone() throws CloneNotSupportedException {
CConnection c = (CConnection)super.clone();
String[] info = new String[2];
info[0] = m_info[0];
info[1] = m_info[1];
c.m_info = info;
return c;
}
/************************************************************************** /**************************************************************************
* Testing * Testing
* @param args ignored * @param args ignored
@ -1709,4 +1719,6 @@ public class CConnection implements Serializable
new CConnectionDialog(cc); new CConnectionDialog(cc);
} // main } // main
} // CConnection } // CConnection

View File

@ -126,6 +126,7 @@ public class CConnectionDialog extends CDialog implements ActionListener
private CLabel connectionProfileLabel = new CLabel(); private CLabel connectionProfileLabel = new CLabel();
private CComboBox connectionProfileField = new CComboBox(CConnection.CONNECTIONProfiles); private CComboBox connectionProfileField = new CComboBox(CConnection.CONNECTIONProfiles);
private boolean isCancel = true;
/** /**
* Static Layout * Static Layout
@ -293,7 +294,12 @@ public class CConnectionDialog extends CDialog implements ActionListener
m_cc.setName(); m_cc.setName();
} }
// Should copy values // Should copy values
m_ccResult = m_cc; try {
m_ccResult = (CConnection)m_cc.clone();
} catch (CloneNotSupportedException e) {
// should not happen
e.printStackTrace();
}
// //
String type = m_cc.getType(); String type = m_cc.getType();
if (type == null || type.length() == 0) if (type == null || type.length() == 0)
@ -327,6 +333,7 @@ public class CConnectionDialog extends CDialog implements ActionListener
m_cc.setName(); m_cc.setName();
m_ccResult = m_cc; m_ccResult = m_cc;
dispose(); dispose();
isCancel = false;
return; return;
} }
else if (src == bCancel) else if (src == bCancel)
@ -354,8 +361,11 @@ public class CConnectionDialog extends CDialog implements ActionListener
if (Ini.isClient()) if (Ini.isClient())
{ {
m_cc.setAppsHost(appsHostField.getText()); //hengsin: avoid unnecessary requery of application server status
m_cc.setAppsPort(appsPortField.getText()); if (!appsHostField.getText().equals(m_cc.getAppsHost()))
m_cc.setAppsHost(appsHostField.getText());
if (!appsPortField.getText().equals(Integer.toString(m_cc.getAppsPort())))
m_cc.setAppsPort(appsPortField.getText());
} }
else else
m_cc.setAppsHost("localhost"); m_cc.setAppsHost("localhost");
@ -511,4 +521,8 @@ public class CConnectionDialog extends CDialog implements ActionListener
setBusy (false); setBusy (false);
} // cmd_testApps } // cmd_testApps
public boolean isCancel() {
return isCancel;
}
} // CConnectionDialog } // CConnectionDialog

View File

@ -274,7 +274,8 @@ public class CConnectionEditor extends JComponent
// //
CConnectionDialog cd = new CConnectionDialog(m_value); CConnectionDialog cd = new CConnectionDialog(m_value);
setValue(cd.getConnection()); setValue(cd.getConnection());
fireActionPerformed(); if (!cd.isCancel())
fireActionPerformed();
// //
setCursor(Cursor.getDefaultCursor()); setCursor(Cursor.getDefaultCursor());
m_active = false; m_active = false;