samples/exceptions/src/org/apidesign/exceptions/trycatchredo/UserQuestionException.java
changeset 310 fba31e9504a1
parent 309 1687adb2b7f0
     1.1 --- a/samples/exceptions/src/org/apidesign/exceptions/trycatchredo/UserQuestionException.java	Sun Feb 01 13:38:08 2009 +0100
     1.2 +++ b/samples/exceptions/src/org/apidesign/exceptions/trycatchredo/UserQuestionException.java	Sun Feb 01 16:03:37 2009 +0100
     1.3 @@ -3,11 +3,27 @@
     1.4  import java.io.IOException;
     1.5  import javax.swing.JOptionPane;
     1.6  
     1.7 -/**
     1.8 +/** Specialized I/O exception to request some kind of user confirmation.
     1.9 + * A code that needs to ask user shall not attempt to open a dialog itself,
    1.10 + * rather it shall emit this exception and let its callers show the dialog
    1.11 + * at appropriate time.
    1.12   *
    1.13   * @author Jaroslav Tulach
    1.14 + * @since 2.0
    1.15   */
    1.16  public abstract class UserQuestionException extends IOException {
    1.17 +    /** Description of the dialog to show to the user. Whoever catches
    1.18 +     * this exception shall use {@link #getQuestionPane()}.{@link JOptionPane#createDialog(java.lang.String)}
    1.19 +     * to construct and display the dialog.
    1.20 +     * 
    1.21 +     * @return the pane to display to user
    1.22 +     */
    1.23      public abstract JOptionPane getQuestionPane();
    1.24 +    /** When the user confirms (or rejects) message presented by the
    1.25 +     * {@link #getQuestionPane()} dialog, the exception shall be notified
    1.26 +     * by calling this method with {@link JOptionPane#getValue()} option.
    1.27 +     *
    1.28 +     * @param option the option selected by the user
    1.29 +     */
    1.30      public abstract void confirm(Object option);
    1.31  }