com.sdm.quasar.client.swing.application
Class AbstractSwingApplication

java.lang.Object
  extended bycom.sdm.quasar.client.core.application.AbstractApplication
      extended bycom.sdm.quasar.client.swing.application.AbstractSwingApplication
All Implemented Interfaces:
Application, SystemInfoProvider
Direct Known Subclasses:
HelloWorldApplication, SwingShowcaseApplication

public class AbstractSwingApplication
extends AbstractApplication


Constructor Summary
AbstractSwingApplication()
          Creates a new AbstractSwingApplication.
AbstractSwingApplication(ID applicationId)
          Creates a new AbstractSwingApplication.
 
Method Summary
protected  void attemptToDisplayErrorMessage(java.lang.String title, java.lang.String message)
          Attempts to display an error message to the user.
protected  void createSessionInEDT()
          Helper method: This method creates a new session (using AbstractApplication.getSessionManager().
protected  ApplicationConfiguration getApplicationConfiguration()
          Returns the ApplicationConfiguration instance used to configure this application instance.
protected  java.lang.String getErrorMessageForThrowable(java.lang.Throwable throwable)
          Determines the error message displayed to the user in the last resort error handling.
protected  void initializeErrorHandler()
          Initializes the error handling.
 
Methods inherited from class com.sdm.quasar.client.core.application.AbstractApplication
collectSystemInfo, extendDestructionException, getApplicationID, getConfigManager, getServiceManager, getSessionManager, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSwingApplication

public AbstractSwingApplication()
Creates a new AbstractSwingApplication.


AbstractSwingApplication

public AbstractSwingApplication(ID applicationId)
Creates a new AbstractSwingApplication.

Parameters:
applicationId - the application ID to be used
Method Detail

getApplicationConfiguration

protected ApplicationConfiguration getApplicationConfiguration()
Description copied from class: AbstractApplication
Returns the ApplicationConfiguration instance used to configure this application instance.

Overrides:
getApplicationConfiguration in class AbstractApplication
See Also:
AbstractApplication.getApplicationConfiguration()

initializeErrorHandler

protected void initializeErrorHandler()
Initializes the error handling.

This implementation registers a default ErrorHandlerAdapter with the ErrorHandler that calls Application.stop() to stop the application. The ErrorHandlerAdapter registered in this implementation does not attempt to restrict the error to a single dialog or session. If you want to do that, you must override this method.

This implementation also registers the EDT error handler that handles exceptions that reach the EDT event queue.

Before stopping the application the implementation attempts to display an error message to the user in a message box using the method attemptToDisplayErrorMessage(java.lang.String, java.lang.String) which you can override separately. The text displayed is determined by getErrorMessageForThrowable(java.lang.Throwable).

Overrides:
initializeErrorHandler in class AbstractApplication

createSessionInEDT

protected void createSessionInEDT()
Helper method: This method creates a new session (using AbstractApplication.getSessionManager().createSession()) using the event dispatch thread.


getErrorMessageForThrowable

protected java.lang.String getErrorMessageForThrowable(java.lang.Throwable throwable)
Determines the error message displayed to the user in the last resort error handling.

Parameters:
throwable - the exception
Returns:
the error message

attemptToDisplayErrorMessage

protected void attemptToDisplayErrorMessage(java.lang.String title,
                                            java.lang.String message)
Attempts to display an error message to the user. This implementation uses JOptionPane.

Parameters:
message - the message that is displayed to the user. It should give the user some information about what happened.
title - the title of the window that is displayed.