Package ptolemy.util

Class SimpleMessageHandler

  • All Implemented Interfaces:
    java.lang.Thread.UncaughtExceptionHandler

    public class SimpleMessageHandler
    extends MessageHandler
    This is a message handler that reports errors in a graphical dialog box.

    See ptolemy.gui.GraphicalMessageHandler

    Since:
    Ptolemy II 10.0 b @Pt.ProposedRating Red (cxh)
    Version:
    $Id$
    Author:
    Christopher Brooks
    Pt.AcceptedRating:
    Red (cxh)
    • Constructor Detail

      • SimpleMessageHandler

        public SimpleMessageHandler()
    • Method Detail

      • _error

        protected void _error​(java.lang.String info)
        Throw a RuntimeException.
        Overrides:
        _error in class MessageHandler
        Parameters:
        info - The message.
      • _error

        protected void _error​(java.lang.String info,
                              java.lang.Throwable throwable)
        Show the specified message and throwable information. If the throwable is an instance of CancelException, then nothing is shown.
        Overrides:
        _error in class MessageHandler
        Parameters:
        info - The message.
        throwable - The throwable.
        See Also:
        CancelException
      • _message

        protected void _message​(java.lang.String info)
        Display the warning message. In this base class, the the default handler merely prints the warning to stderr.
        Overrides:
        _message in class MessageHandler
        Parameters:
        info - The message.
      • _warning

        protected void _warning​(java.lang.String info)
                         throws CancelException
        Show the specified message. In this base class, the message is printed to standard error.

        Derived classes might show the specified message in a modal dialog. If the user clicks on the "Cancel" button, then throw an exception. This gives the user the option of not continuing the execution, something that is particularly useful if continuing execution will result in repeated warnings.

        Overrides:
        _warning in class MessageHandler
        Parameters:
        info - The message.
        Throws:
        CancelException - If the user clicks on the "Cancel" button.
      • _warning

        protected void _warning​(java.lang.String info,
                                java.lang.Throwable throwable)
                         throws CancelException
        Display the warning message and throwable information. In this base class, the the default handler merely prints the warning to stderr.
        Overrides:
        _warning in class MessageHandler
        Parameters:
        info - The message.
        throwable - The Throwable.
        Throws:
        CancelException - If the user clicks on the "Cancel" button.
      • _yesNoQuestion

        protected boolean _yesNoQuestion​(java.lang.String question)
        Ask the user a yes/no question, and return true if the answer is yes. In this base class, this prints the question on standard output and looks for the reply on standard input.
        Overrides:
        _yesNoQuestion in class MessageHandler
        Parameters:
        question - The yes/no question to be asked.
        Returns:
        True if the answer is yes.
      • _yesNoCancelQuestion

        protected boolean _yesNoCancelQuestion​(java.lang.String question,
                                               java.lang.String trueOption,
                                               java.lang.String falseOption,
                                               java.lang.String exceptionOption)
                                        throws CancelException
        Ask the user a question with three possible answers; return true if the answer is the first one and false if the answer is the second one; throw an exception if the user selects the third one.
        Overrides:
        _yesNoCancelQuestion in class MessageHandler
        Parameters:
        question - The question.
        trueOption - The option for which to return true.
        falseOption - The option for which to return false.
        exceptionOption - The option for which to throw an exception.
        Returns:
        Always return false.
        Throws:
        CancelException - If the user selects the third option.