package com.onaro.sanscreen.client.error; import java.net.SocketException; import java.util.HashSet; import java.util.ResourceBundle; import java.util.Set; import javax.naming.NamingException; import javax.swing.JOptionPane; import com.onaro.commons.lang.OnaroExceptionUtils; import com.onaro.sanscreen.client.SessionsHelper; /** * Handles errors in the communication with the server. When such an error occurs, it notifies the * {@link SessionsHelper} the connection is lost to allow it to clear its caching of server related stuff. It provide * the user with the options to ignore the error (and try again later) or to exit the application. */ public class ServerConnectionHandler extends MessageWindowHandler { /** * Gets the mesaages and titles from the resources. Set the options to "exit" and "ignore". * * @param bundle * locale dependant resources */ public ServerConnectionHandler(ResourceBundle bundle) { super(bundle.getString("server.connection.title"), bundle.getString("server.connection.message"), //$NON-NLS-1$ //$NON-NLS-2$ JOptionPane.ERROR_MESSAGE); addActionIgnore(); addActionExit(); addActionShowException(); } /** * Handle the error if the exception is any of: *
SocketException
* NamingException
*