net.sf.doolin.gui.service.support
Class DefaultInfoService

java.lang.Object
  extended by net.sf.doolin.gui.service.support.DefaultInfoService
All Implemented Interfaces:
InfoService

public class DefaultInfoService
extends Object
implements InfoService

Logger service based on the display of alerts.

Author:
Damien Coraboeuf

Constructor Summary
DefaultInfoService()
           
 
Method Summary
 boolean confirm(ActionContext actionContext, Object messageKey, Object... messageParameters)
          Asks a confirmation from the user
 ConfirmResult confirm3(ActionContext actionContext, Object messageKey, Object... messageParameters)
          Asks a three-choices confirmation from the user
protected  JComponent createMessageComponent(String message)
          Creates the component for a message
 void error(ActionContext actionContext, Throwable e, Object messageKey, Object... messageParameters)
          Logs an error
protected  String getErrorMessage(Throwable e)
          Creates the error message for an exception
 ErrorMessageService getErrorMessageService()
           
 void info(ActionContext actionContext, Object messageKey, Object... messageParameters)
          Logs an information message
 void setErrorMessageService(ErrorMessageService errorMessageService)
           
 void warning(ActionContext actionContext, Throwable e, Object messageKey, Object... messageParameters)
          Logs a warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInfoService

public DefaultInfoService()
Method Detail

confirm

public boolean confirm(ActionContext actionContext,
                       Object messageKey,
                       Object... messageParameters)
Description copied from interface: InfoService
Asks a confirmation from the user

Specified by:
confirm in interface InfoService
Parameters:
actionContext - Action context
messageKey - Key of the message
messageParameters - Parameters for the message
Returns:
Result of the confirmation

confirm3

public ConfirmResult confirm3(ActionContext actionContext,
                              Object messageKey,
                              Object... messageParameters)
Description copied from interface: InfoService
Asks a three-choices confirmation from the user

Specified by:
confirm3 in interface InfoService
Parameters:
actionContext - Action context
messageKey - Key of the message
messageParameters - Parameters for the message
Returns:
Result of the confirmation

createMessageComponent

protected JComponent createMessageComponent(String message)
Creates the component for a message

Parameters:
message - Message to display
Returns:
Message component

error

public void error(ActionContext actionContext,
                  Throwable e,
                  Object messageKey,
                  Object... messageParameters)
Description copied from interface: InfoService
Logs an error

Specified by:
error in interface InfoService
Parameters:
actionContext - Action context
e - Error to log
messageKey - Key of the message
messageParameters - Parameters for the message

getErrorMessage

protected String getErrorMessage(Throwable e)
Creates the error message for an exception

Parameters:
e - Exception
Returns:
Error message
See Also:
ErrorMessageService

getErrorMessageService

public ErrorMessageService getErrorMessageService()

info

public void info(ActionContext actionContext,
                 Object messageKey,
                 Object... messageParameters)
Description copied from interface: InfoService
Logs an information message

Specified by:
info in interface InfoService
Parameters:
actionContext - Action context
messageKey - Key of the message
messageParameters - Parameters for the message

setErrorMessageService

public void setErrorMessageService(ErrorMessageService errorMessageService)

warning

public void warning(ActionContext actionContext,
                    Throwable e,
                    Object messageKey,
                    Object... messageParameters)
Description copied from interface: InfoService
Logs a warning

Specified by:
warning in interface InfoService
Parameters:
actionContext - Action context
e - Warning to log
messageKey - Key of the message
messageParameters - Parameters for the message


Copyright © 2011. All Rights Reserved.