org.springframework.richclient.exceptionhandling
Class MessagesDialogExceptionHandler
java.lang.Object
org.springframework.richclient.exceptionhandling.AbstractRegisterableExceptionHandler
org.springframework.richclient.exceptionhandling.AbstractLoggingExceptionHandler
org.springframework.richclient.exceptionhandling.AbstractDialogExceptionHandler
org.springframework.richclient.exceptionhandling.MessagesDialogExceptionHandler
- All Implemented Interfaces:
- Thread.UncaughtExceptionHandler, InitializingBean, RegisterableExceptionHandler
- Direct Known Subclasses:
- JXErrorDialogExceptionHandler
public class MessagesDialogExceptionHandler
- extends AbstractDialogExceptionHandler
Displays a message to the user which is fetched from the I18N files
based on the class and superclasses of the throwable.
For example if an IllegalArgumentException is thrown, it will search for
java.lang.IllegalArgumentException.caption and java.lang.IllegalArgumentException.description first,
and if it cant find that it will try in order:
java.lang.RuntimeException.caption/description, java.lang.Exception.caption/description and
java.lang.Throwable.caption/description.
The exception message is passed as a parameter, but is idented and wrapped first.
Note for the repacing of {0} to work in a property file double quotes(") need to be escaped (\")
and that single quotes (') should be avoided (escaping doesn't seem to work).
- Since:
- 0.3
- Author:
- Geoffrey De Smet
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessagesDialogExceptionHandler
public MessagesDialogExceptionHandler()
setWrapLength
public void setWrapLength(int wrapLength)
- Sets the wrap length applied on the exception message passed as a parameter.
Defaults to 120.
- Parameters:
wrapLength
-
setIdentLength
public void setIdentLength(int identLength)
- Sets the identation applied on the exception message passed as a parameter.
Defaults to 2.
- Parameters:
identLength
-
setMessagesKey
public void setMessagesKey(String messagesKey)
- If messagesKey is set, the caption and description shown in the dialog
are not based dynamically on the throwable,
but instead statically on the keys messageKey.caption and messageKey.description.
- Parameters:
messagesKey
- the key used for the caption and title
resolveExceptionCaption
public String resolveExceptionCaption(Throwable throwable)
- Specified by:
resolveExceptionCaption
in class AbstractDialogExceptionHandler
createExceptionContent
public Object createExceptionContent(Throwable throwable)
- Specified by:
createExceptionContent
in class AbstractDialogExceptionHandler
formatMessage
protected String formatMessage(String message)
Copyright © 2004-2008 The Spring Framework. All Rights Reserved.