Give the possibility to the user to retry when connection to the server fails.

cusax-fix
Yana Stamcheva 18 years ago
parent 89a97e5c55
commit 2f037f18f3

@ -97,7 +97,11 @@ conference=Conference
configure=&Configure
configuration=Configuration
connectionFailed=Connection failed
connectionFailedMessage=Connection failed for the following account: User name: {0}, Server name: {1}. Please check your network connection or contact your network administrator for more information.
connectionFailedMessage=<DIV>Connection failed for the following account: <BR> \
User name: {0} <BR>\
Server name: {1}. <BR>\
Please check your network connection or contact <BR>\
your network administrator for more information.</DIV>
connectionExpiredMessage=You are currently disconnected from the {0} server.
contactAddress=Contact address
contactNotSupportingTelephony=The choosen {0} contact doesn't support telephony.
@ -186,7 +190,10 @@ launchOnStartUp=Launch on start up
leave=&Leave
limitReachedForIp=You have too many existing registrations from the local IP address and the {0} server doesn't allow to open any more of them.
login=&Login
loginNetworkError=Unable to log in with account: User name: {0}, Server name: {1}, due to a network failure. Please check your network connection.
loginNetworkError=<DIV>Unable to log in with account:<BR>\
User name: {0}<BR>\
Server name: {1}<BR>\
due to a network failure. Please check your network connection.</DIV>
loginGeneralError=An error occured while logging in with account: User name: {0}, Server name: {1}.
loginInternalError=An error occured while logging in with account: User name: {0}, Server name: {1}. This is most probably an internal application error. You could report your problem to issues@sip-communicator.dev.java.net.
loginInvalidPropsError=Unable to log in with account: User name: {0}, Server name: {1}, due to an account configuration problem. Please check your account configuration.
@ -261,6 +268,7 @@ requestAuthorizationInfo=Can't add {0} to your Contact List. {0} must authorize
requestAuthReason=Request reason
requestAuthReasonEnter=Enter request reason
responseAuthReasonEnter=Enter response reason
retry=Retry
rootGroup=Root group
save=&Save
search=&Search

@ -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));
@ -127,6 +129,30 @@ public MessageDialog( Frame owner,
this.okButton.setMnemonic(okButtonName.charAt(0));
}
/**
* 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 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.
@ -159,7 +185,8 @@ private void init()
{
this.getRootPane().setDefaultButton(okButton);
this.checkBoxPanel.add(doNotAskAgain);
if(isConfirmationEnabled)
this.checkBoxPanel.add(doNotAskAgain);
this.buttonsPanel.add(okButton);
this.buttonsPanel.add(cancelButton);

@ -17,7 +17,6 @@
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 void registrationStateChanged(RegistrationStateChangeEvent evt)
presence.setAuthorizationHandler(new AuthorizationHandlerImpl(
mainFrame));
}
if(multiUserChat != null)
{
mainFrame.getChatRoomsListPanel().getChatRoomsList()
@ -235,7 +234,6 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
else if (evt.getNewState().equals(
RegistrationState.AUTHENTICATION_FAILED))
{
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
if (evt.getReasonCode() == RegistrationStateChangeEvent
@ -278,22 +276,27 @@ else if (evt.getReasonCode() == RegistrationStateChangeEvent
}
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 @@ else if (evt.getNewState().equals(RegistrationState.EXPIRED))
}
else if (evt.getNewState().equals(RegistrationState.UNREGISTERED))
{
this.mainFrame.getStatusPanel().updateStatus(evt.getProvider());
if (mainFrame.getCallManager()
@ -395,7 +397,8 @@ public void serviceChanged(ServiceEvent event)
{
// 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 void run()
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 @@ else if (errorCode == OperationFailedException.INTERNAL_ERROR)
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 @@ else if (errorCode == OperationFailedException.NETWORK_FAILURE)
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 @@ else if (errorCode
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)

Loading…
Cancel
Save