com.sas.util.errorhandlers
Class JOptionPaneErrorHandler

com.sas.util.errorhandlers.JOptionPaneErrorHandler
All Implemented Interfaces:
GenericErrorHandlerInterface, java.io.Serializable

public class JOptionPaneErrorHandler
implements GenericErrorHandlerInterface, java.io.Serializable

JOptionPaneErrorHandler is an error handler which displays a JOptionPane when handleError() is called. The JOptionPane displays the passed in message and an Ok button.

See Also:
Serialized Form

Field Summary
protected  java.awt.Component component
          The frame to parent the JOptionPane dialog to.
protected  int messageType
           
protected  java.lang.String overrideMessage
          A message used to override the message returned by the validator.
static java.lang.String RB_KEY
           
protected  java.lang.String titleString
           
static java.lang.String validationErrorText
           
 
Constructor Summary
JOptionPaneErrorHandler()
          Default constructor
JOptionPaneErrorHandler(java.awt.Component frame)
          Constructor.
JOptionPaneErrorHandler(java.awt.Component frame, java.lang.String overrideMessage)
          Constructor.
JOptionPaneErrorHandler(java.lang.String overrideMessage)
          Constructor.
 
Method Summary
 int getMessageType()
          Returns the message type.
 java.lang.String getTitle()
          Returns the title that is going to be used on the JOptionPane.
 void handleError(java.lang.Object object, com.sas.text.Message message, java.lang.String messageCode)
          handleError should perform whatever action is desired when an error occurs.
 void setMessageType(int messageType)
          Sets the message type to be used.
 void setTitle(java.lang.String newTitle)
          Sets the title to be used on the JOptionPane, null to remove the title.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

validationErrorText

public static final java.lang.String validationErrorText

titleString

protected java.lang.String titleString

messageType

protected int messageType

component

protected java.awt.Component component
The frame to parent the JOptionPane dialog to.


overrideMessage

protected java.lang.String overrideMessage
A message used to override the message returned by the validator.

Constructor Detail

JOptionPaneErrorHandler

public JOptionPaneErrorHandler()
Default constructor


JOptionPaneErrorHandler

public JOptionPaneErrorHandler(java.lang.String overrideMessage)
Constructor.

Parameters:
overrideMessage - A message to display instead of the message returned by the validator.

JOptionPaneErrorHandler

public JOptionPaneErrorHandler(java.awt.Component frame)
Constructor.

Parameters:
frame - A java.awt.Component used to determine the parent frame for the JOptionPane dialog.

JOptionPaneErrorHandler

public JOptionPaneErrorHandler(java.awt.Component frame,
                               java.lang.String overrideMessage)
Constructor.

Parameters:
frame - A java.awt.Component used to determine the parent frame for the JOptionPane dialog.
overrideMessage - A message to display instead of the message returned by the validator.
Method Detail

setTitle

public void setTitle(java.lang.String newTitle)
Sets the title to be used on the JOptionPane, null to remove the title.

Parameters:
newTitle - the new title
See Also:
getTitle()

getTitle

public java.lang.String getTitle()
Returns the title that is going to be used on the JOptionPane.

Returns:
the JOptionPane title
See Also:
setTitle(String)

getMessageType

public int getMessageType()
Returns the message type.

Returns:
message type
See Also:
setMessageType(int messageType)

setMessageType

public void setMessageType(int messageType)
Sets the message type to be used.

Parameters:
messageType - message type. Valid entries are:
 
 
  • JOptionPane.INFORMATION_MESSAGE
  • JOptionPane.WARNING_MESSAGE
  • JOptionPane.QUESTION_MESSAGE
  • JOptionPane.PLAIN_MESSAGE
  • JOptionPane.ERROR_MESSAGE
  • If an invalid value is specified for the message type, the message type will be set to JOptionPane.ERROR_MESSAGE

    See Also:
    getMessageType()

    handleError

    public void handleError(java.lang.Object object,
                            com.sas.text.Message message,
                            java.lang.String messageCode)
    Description copied from interface: GenericErrorHandlerInterface
    handleError should perform whatever action is desired when an error occurs. Examples might be displaying a MessageBox, writing a message to the log, or printing a message to a stream.

    Specified by:
    handleError in interface GenericErrorHandlerInterface
    message - A Message object with formatted with the message to display. The object should also contain the necessary arguments for formatting the message.
    messageCode - A non-translatable string which indicates the type of error that occured.



    Copyright © 2009 SAS Institute Inc. All Rights Reserved.