samples/trycatchredo/src/org/apidesign/exceptions/trycatchredo/api/UserQuestionException.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 21:30:10 +0100
changeset 409 40cabcdcd2be
parent 312 0678c9589013
permissions -rw-r--r--
Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
     1 package org.apidesign.exceptions.trycatchredo.api;
     2 
     3 import java.io.IOException;
     4 import javax.swing.JOptionPane;
     5 
     6 // BEGIN: trycatchredo.UserQuestionException
     7 /** Specialized I/O exception to request some kind of user confirmation.
     8  * A code that needs to ask user shall not attempt to open a dialog itself,
     9  * rather it shall emit this exception and let its callers show the dialog
    10  * at appropriate time.
    11  *
    12  * @author Jaroslav Tulach
    13  * @since 2.0
    14  */
    15 public abstract class UserQuestionException extends IOException {
    16     /** Description of the dialog to show to the user. Whoever catches
    17      * this exception shall use 
    18      * {@link #getQuestionPane()}.
    19      * {@link JOptionPane#createDialog(java.lang.String)}
    20      * to construct and display the dialog.
    21      * 
    22      * @return the pane to display to user
    23      */
    24     public abstract JOptionPane getQuestionPane();
    25     /** When the user confirms (or rejects) message presented by the
    26      * {@link #getQuestionPane()} dialog, the exception shall be notified
    27      * by calling this method with {@link JOptionPane#getValue()} option.
    28      *
    29      * @param option the option selected by the user
    30      */
    31     public abstract void confirm(Object option);
    32 }
    33 // END: trycatchredo.UserQuestionException