aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2008-05-19 12:09:42 +0000
committerYana Stamcheva <yana@jitsi.org>2008-05-19 12:09:42 +0000
commit2f037f18f31f3cf3d3fd9f4452b0ac63f00d393c (patch)
treefc5c2edff3ecd0ce8c201de030a851d6272efd07 /src/net/java/sip
parent89a97e5c55d6be970586e49dcdb1f6206388aa13 (diff)
downloadjitsi-2f037f18f31f3cf3d3fd9f4452b0ac63f00d393c.zip
jitsi-2f037f18f31f3cf3d3fd9f4452b0ac63f00d393c.tar.gz
jitsi-2f037f18f31f3cf3d3fd9f4452b0ac63f00d393c.tar.bz2
Give the possibility to the user to retry when connection to the server fails.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java31
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java52
2 files changed, 67 insertions, 16 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java
index 57f90e2..3f111b7 100644
--- a/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java
+++ b/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java
@@ -49,6 +49,8 @@ public class MessageDialog
private JPanel messagePanel = new JPanel(new BorderLayout(5, 5));
+ private boolean isConfirmationEnabled = true;
+
private int returnCode;
/**
@@ -76,7 +78,7 @@ public class MessageDialog
*/
public MessageDialog(Frame owner)
{
- super(owner);
+ super(owner, false);
this.getContentPane().setLayout(new BorderLayout(5, 5));
@@ -133,6 +135,30 @@ public class MessageDialog
* @param owner the dialog owner
* @param title the title of the message
* @param message the message to be displayed
+ * @param okButtonName ok button name
+ * @param isConfirmationEnabled indicates whether the "Do not ask again"
+ * button should be enabled or not
+ */
+ public MessageDialog( Frame owner,
+ String title,
+ String message,
+ String okButtonName,
+ boolean isConfirmationEnabled)
+ {
+ this(owner, title, message);
+
+ this.okButton.setText(okButtonName);
+ this.okButton.setMnemonic(okButtonName.charAt(0));
+
+ this.isConfirmationEnabled = isConfirmationEnabled;
+ }
+
+ /**
+ * Creates an instance of <tt>MessageDialog</tt> by specifying the
+ * owner window and the message to be displayed.
+ * @param owner the dialog owner
+ * @param title the title of the message
+ * @param message the message to be displayed
* @param isCancelButtonEnabled <code>true</code> to show the Cancel button,
* <code>false</code> - otherwise
*/
@@ -159,7 +185,8 @@ public class MessageDialog
{
this.getRootPane().setDefaultButton(okButton);
- this.checkBoxPanel.add(doNotAskAgain);
+ if(isConfirmationEnabled)
+ this.checkBoxPanel.add(doNotAskAgain);
this.buttonsPanel.add(okButton);
this.buttonsPanel.add(cancelButton);
diff --git a/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java b/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java
index 316ae05..e3bc8d2 100644
--- a/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java
+++ b/src/net/java/sip/communicator/impl/gui/main/login/LoginManager.java
@@ -17,7 +17,6 @@ import net.java.sip.communicator.impl.gui.main.account.*;
import net.java.sip.communicator.impl.gui.main.authorization.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.impl.gui.utils.Constants;
-import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@@ -224,7 +223,7 @@ public class LoginManager
presence.setAuthorizationHandler(new AuthorizationHandlerImpl(
mainFrame));
}
-
+
if(multiUserChat != null)
{
mainFrame.getChatRoomsListPanel().getChatRoomsList()
@@ -235,7 +234,6 @@ public class LoginManager
else if (evt.getNewState().equals(
RegistrationState.AUTHENTICATION_FAILED))
{
-
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
if (evt.getReasonCode() == RegistrationStateChangeEvent
@@ -278,22 +276,27 @@ public class LoginManager
}
else if (evt.getNewState().equals(RegistrationState.CONNECTION_FAILED))
{
-
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
String msgText = Messages.getI18NString("connectionFailedMessage",
new String[]
{ accountID.getUserID(), accountID.getService() }).getText();
- new ErrorDialog(null,
+ int result = new MessageDialog(null,
Messages.getI18NString("error").getText(),
- msgText).showDialog();
+ msgText,
+ Messages.getI18NString("retry").getText(),
+ false).showDialog();
+
+ if (result == MessageDialog.OK_RETURN_CODE)
+ {
+ this.login(protocolProvider);
+ }
logger.error(evt.getReason());
}
else if (evt.getNewState().equals(RegistrationState.EXPIRED))
{
-
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
String msgText = Messages.getI18NString("connectionExpiredMessage",
@@ -308,7 +311,6 @@ public class LoginManager
}
else if (evt.getNewState().equals(RegistrationState.UNREGISTERED))
{
-
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
if (mainFrame.getCallManager()
@@ -395,7 +397,8 @@ public class LoginManager
{
// if the event is caused by a bundle being stopped, we don't want to
// know
- if (event.getServiceReference().getBundle().getState() == Bundle.STOPPING)
+ if (event.getServiceReference().getBundle().getState()
+ == Bundle.STOPPING)
{
return;
}
@@ -508,6 +511,11 @@ public class LoginManager
protocolProvider.getAccountID().getUserID(),
protocolProvider.getAccountID().getService()
}).getText();
+
+ new ErrorDialog(mainFrame,
+ Messages.getI18NString("error").getText(),
+ errorMessage,
+ ex).showDialog();
}
else if (errorCode == OperationFailedException.INTERNAL_ERROR)
{
@@ -519,6 +527,11 @@ public class LoginManager
protocolProvider.getAccountID().getUserID(),
protocolProvider.getAccountID().getService()
}).getText();
+
+ new ErrorDialog(mainFrame,
+ Messages.getI18NString("error").getText(),
+ errorMessage,
+ ex).showDialog();
}
else if (errorCode == OperationFailedException.NETWORK_FAILURE)
{
@@ -530,6 +543,17 @@ public class LoginManager
protocolProvider.getAccountID().getUserID(),
protocolProvider.getAccountID().getService()
}).getText();
+
+ int result = new MessageDialog(null,
+ Messages.getI18NString("error").getText(),
+ errorMessage,
+ Messages.getI18NString("retry").getText(),
+ false).showDialog();
+
+ if (result == MessageDialog.OK_RETURN_CODE)
+ {
+ login(protocolProvider);
+ }
}
else if (errorCode
== OperationFailedException.INVALID_ACCOUNT_PROPERTIES)
@@ -542,17 +566,17 @@ public class LoginManager
protocolProvider.getAccountID().getUserID(),
protocolProvider.getAccountID().getService()
}).getText();
+
+ new ErrorDialog(mainFrame,
+ Messages.getI18NString("error").getText(),
+ errorMessage,
+ ex).showDialog();
}
else
{
logger.error("Provider could not be registered.", ex);
}
- new ErrorDialog(mainFrame,
- Messages.getI18NString("error").getText(),
- errorMessage,
- ex).showDialog();
-
mainFrame.getStatusPanel().updateStatus(protocolProvider);
}
catch (Throwable ex)