Enterprise Information Portal APIs

com.ibm.mm.beans.util
Class CMBExceptionHandler

java.lang.Object
  |
  +--com.ibm.mm.beans.util.CMBExceptionHandler
All Implemented Interfaces:
CMBExceptionListener, CMBUtilConstant, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public class CMBExceptionHandler
extends java.lang.Object
implements java.io.Serializable, java.beans.PropertyChangeListener, CMBExceptionListener, CMBUtilConstant

The CMBExceptionHandler utility bean can be used to handle exceptions generated by other beans. It can be customized to pop up a dialog box when it receives a exception event or to print the exception stack trace information on the standard error output stream.

Summary of properties and events:

   imported properties   GUI look and feel style, use default GUI literal,
                         will not veto
   exported properties   none
   standalone properties window title, mute when display exception messages,
                         trace message display mode, and button labels
   interested in events  CMBExceptionEvent   - to service exception
                         PropertyChangeEvent - to import properties
   source of events      none
 

Since:
6.1
See Also:
CMBExceptionEvent, Serialized Form

Fields inherited from interface com.ibm.mm.beans.util.CMBUtilConstant
DISPLAY_MESSAGE_IN_WINDOW, DISPLAY_MESSAGE_ON_STDERR, DISPLAY_MESSAGE_ON_STDOUT, LOOK_AND_FEEL_METAL, LOOK_AND_FEEL_MOTIF, LOOK_AND_FEEL_WINDOWS, PROP_CANCEL_LABEL, PROP_CLEAR_LABEL, PROP_CLOSE_LABEL, PROP_DEBUG_DISPLAY_ENABLED, PROP_DEBUG_LOG_ENABLED, PROP_DEFAULT_GUI_LITERAL, PROP_ERROR_DISPLAY_ENABLED, PROP_ERROR_LOG_ENABLED, PROP_LOG_FULLPATH, PROP_LOG_SESSION_EPILOGUE, PROP_LOG_SESSION_PROLOGUE, PROP_LOOK_AND_FEEL_STYLE, PROP_MESSAGE_DISPLAY_MODE, PROP_MESSAGE_MUTE, PROP_MUTE_LABEL, PROP_OK_LABEL, PROP_PROGRESS_DISPLAY_ENABLED, PROP_PROGRESS_LOG_ENABLED, PROP_SAVE_AS_LABEL, PROP_SAVE_LABEL, PROP_STACK_LABEL, PROP_WINDOW_TITLE, TRACE_LEVEL_DEBUG, TRACE_LEVEL_ERROR, TRACE_LEVEL_PROGRESS
 
Constructor Summary
CMBExceptionHandler()
          Constructor.
 
Method Summary
 void finalize()
          Disposes the exception dialog window.
 java.lang.String getCloseLabel()
          Gets the close button label.
 int getDisplayMode()
          Gets the display mode.
 java.lang.String getMuteLabel()
          Gets the mute checkbox label.
 java.awt.Component getRootNode()
          Get the window frame, may be used for updating GUI look and feel style.
 java.lang.String getStackLabel()
          Gets the stack trace button label on the exception dialog.
 java.lang.String getWindowTitle()
          Gets the title on the exception dialog window.
 boolean isDefaultGuiLiteral()
          Gets the use default GUI literal property value.
 boolean isMute()
          Gets mute property.
 boolean isVisible()
          Query if the exception dialog is visible.
 void onCMBException(CMBExceptionEvent evt)
          When a CMBExceptionEvent received, this is the method that gets called.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          PropertyChangeEvent service routine, to import the and "use default GUI literal" property values.
 void setCloseLabel(java.lang.String newValue)
          Sets the close button label on the exception dialog.
 void setDefaultGuiLiteral(boolean newValue)
          When true, all labels and the window title for the exception dialog will be re-loaded from the resource file.
 void setDisplayMode(int newValue)
          Sets the message display mode property.
 void setMute(boolean newValue)
          Sets the mute property.
 void setMuteLabel(java.lang.String newValue)
          Sets the mute checkbox label on the exception dialog.
 void setStackLabel(java.lang.String newValue)
          Sets the stack trace button label on the exception dialog.
 void setVisible(boolean visible)
          Show or hide the exception dialog.
 void setWindowTitle(java.lang.String newValue)
          Set the title on the exception dialog window.
 void showMessage(java.lang.String msg)
          Display the exception information.
 void showStack(java.lang.Exception exception)
          Show the exception stack trace information.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMBExceptionHandler

public CMBExceptionHandler()
Constructor.
Method Detail

finalize

public void finalize()
Disposes the exception dialog window. The user of the bean can call this method to free resources used by the exception dialog.
Overrides:
finalize in class java.lang.Object

onCMBException

public void onCMBException(CMBExceptionEvent evt)
When a CMBExceptionEvent received, this is the method that gets called. It prints the exception information into a popped up modal dialog box or on the standard error output stream, depending on the setting of the displayMode property.
Specified by:
onCMBException in interface CMBExceptionListener
Parameters:
evt - an exception event

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
PropertyChangeEvent service routine, to import the and "use default GUI literal" property values.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - a prpoerty changed event

getDisplayMode

public int getDisplayMode()
Gets the display mode.
Returns:
the display mode.

setDisplayMode

public void setDisplayMode(int newValue)
Sets the message display mode property. Can be:
DISPLAY_MESSAGE_ON_STDERR - send exception information to standard error, or
DISPLAY_MESSAGE_IN_WINDOW - display exception information in a dialog window.
This method also shows/hides the dialog window accordingly.
Parameters:
newValue - new message display mode

isDefaultGuiLiteral

public boolean isDefaultGuiLiteral()
Gets the use default GUI literal property value.
Returns:
use the default GUI literal

setDefaultGuiLiteral

public void setDefaultGuiLiteral(boolean newValue)
When true, all labels and the window title for the exception dialog will be re-loaded from the resource file.
Parameters:
newValue - new use default GUI literal option

getWindowTitle

public java.lang.String getWindowTitle()
Gets the title on the exception dialog window.
Returns:
window title

setWindowTitle

public void setWindowTitle(java.lang.String newValue)
Set the title on the exception dialog window.
Parameters:
newValue - new window title

isMute

public boolean isMute()
Gets mute property.
Returns:
mute setting

setMute

public void setMute(boolean newValue)
Sets the mute property. If set to false, an alarm is sounded when an exception is handled.
Parameters:
newValue - new mute setting value

getCloseLabel

public java.lang.String getCloseLabel()
Gets the close button label.
Returns:
close button label

setCloseLabel

public void setCloseLabel(java.lang.String newValue)
Sets the close button label on the exception dialog.
Parameters:
newValue - new close button label

getMuteLabel

public java.lang.String getMuteLabel()
Gets the mute checkbox label.
Returns:
mute checkbox label

setMuteLabel

public void setMuteLabel(java.lang.String newValue)
Sets the mute checkbox label on the exception dialog.
Parameters:
newValue - new mute checkbox label

getStackLabel

public java.lang.String getStackLabel()
Gets the stack trace button label on the exception dialog.
Returns:
stack trace button label

setStackLabel

public void setStackLabel(java.lang.String newValue)
Sets the stack trace button label on the exception dialog.
Parameters:
newValue - new stack trace button label

showMessage

public void showMessage(java.lang.String msg)
Display the exception information.
Parameters:
msg - the error message

showStack

public void showStack(java.lang.Exception exception)
Show the exception stack trace information.
Parameters:
exception - the exception to show

setVisible

public void setVisible(boolean visible)
Show or hide the exception dialog. Effective only if the display mode is DISPLAY_MESSAGE_IN_WINDOW.
Parameters:
visible - if true, the exception dialog is shown. If false, the dialog is hidden.

isVisible

public boolean isVisible()
Query if the exception dialog is visible.
Returns:
true if the exception dialog is visible, else false

getRootNode

public java.awt.Component getRootNode()
Get the window frame, may be used for updating GUI look and feel style.
Returns:
the window frame

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.