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