Use server and port specified in ConnectDialog rather than in the preference.

This commit is contained in:
Me Car 2016-01-14 10:01:30 +09:00
parent cb050c3208
commit f5765383c7
3 changed files with 20 additions and 8 deletions

View file

@ -97,10 +97,10 @@ public class ConnectDialog extends MageDialog {
this.txtUserName.addActionListener(connectAction); this.txtUserName.addActionListener(connectAction);
this.txtPassword.addActionListener(connectAction); this.txtPassword.addActionListener(connectAction);
registerUserDialog = new RegisterUserDialog(); registerUserDialog = new RegisterUserDialog(this);
MageFrame.getDesktop().add(registerUserDialog, JLayeredPane.POPUP_LAYER); MageFrame.getDesktop().add(registerUserDialog, JLayeredPane.POPUP_LAYER);
resetPasswordDialog = new ResetPasswordDialog(); resetPasswordDialog = new ResetPasswordDialog(this);
MageFrame.getDesktop().add(resetPasswordDialog, JLayeredPane.POPUP_LAYER); MageFrame.getDesktop().add(resetPasswordDialog, JLayeredPane.POPUP_LAYER);
} }
@ -587,6 +587,14 @@ public class ConnectDialog extends MageDialog {
resetPasswordDialog.showDialog(); resetPasswordDialog.showDialog();
}//GEN-LAST:event_btnForgotPasswordActionPerformed }//GEN-LAST:event_btnForgotPasswordActionPerformed
public String getServer() {
return this.txtServer.getText();
}
public String getPort() {
return this.txtPort.getText();
}
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel; private javax.swing.JButton btnCancel;
private javax.swing.JButton btnConnect; private javax.swing.JButton btnConnect;

View file

@ -15,6 +15,7 @@ import org.apache.log4j.Logger;
public class RegisterUserDialog extends MageDialog { public class RegisterUserDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(ConnectDialog.class); private static final Logger logger = Logger.getLogger(ConnectDialog.class);
private ConnectDialog connectDialog;
private Connection connection; private Connection connection;
private ConnectTask task; private ConnectTask task;
private Session session; private Session session;
@ -22,13 +23,14 @@ public class RegisterUserDialog extends MageDialog {
/** /**
* Creates new form RegisterUserDialog * Creates new form RegisterUserDialog
*/ */
public RegisterUserDialog() { public RegisterUserDialog(ConnectDialog connectDialog) {
initComponents(); initComponents();
this.connectDialog = connectDialog;
} }
public void showDialog() { public void showDialog() {
this.txtServer.setText(MageFrame.getPreferences().get("serverAddress", Config.serverName)); this.txtServer.setText(this.connectDialog.getServer());
this.txtPort.setText(MageFrame.getPreferences().get("serverPort", Integer.toString(Config.port))); this.txtPort.setText(this.connectDialog.getPort());
this.lblStatus.setText(""); this.lblStatus.setText("");
this.setModal(true); this.setModal(true);

View file

@ -15,6 +15,7 @@ import org.apache.log4j.Logger;
public class ResetPasswordDialog extends MageDialog { public class ResetPasswordDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(ResetPasswordDialog.class); private static final Logger logger = Logger.getLogger(ResetPasswordDialog.class);
private ConnectDialog connectDialog;
private Connection connection; private Connection connection;
private Session session; private Session session;
private GetAuthTokenTask getAuthTokenTask; private GetAuthTokenTask getAuthTokenTask;
@ -23,13 +24,14 @@ public class ResetPasswordDialog extends MageDialog {
/** /**
* Creates new form ResetPasswordDialog * Creates new form ResetPasswordDialog
*/ */
public ResetPasswordDialog() { public ResetPasswordDialog(ConnectDialog connectDialog) {
initComponents(); initComponents();
this.connectDialog = connectDialog;
} }
public void showDialog() { public void showDialog() {
this.txtServer.setText(MageFrame.getPreferences().get("serverAddress", Config.serverName)); this.txtServer.setText(this.connectDialog.getServer());
this.txtPort.setText(MageFrame.getPreferences().get("serverPort", Integer.toString(Config.port))); this.txtPort.setText(this.connectDialog.getPort());
this.lblStatus.setText(""); this.lblStatus.setText("");
this.setModal(true); this.setModal(true);