01: /**
02: * Wizard Framework
03: * Copyright 2004 - 2005 Andrew Pietsch
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *
19: * $Id: InvalidStateException.java,v 1.7 2005/05/16 23:06:58 pietschy Exp $
20: */package org.pietschy.wizard;
21:
22: /**
23: * This exception is thrown by {@link WizardStep} instances if the call to
24: * {@link WizardStep#applyState} can't be fullfilled. By default this exception's message will
25: * be displayed to the user. To disable this feature, please ensure you call {@link #setShowUser}
26: * with the value of <tt>false</tt>.
27: */
28: public class InvalidStateException extends Exception {
29: private boolean showUser = true;
30:
31: public InvalidStateException() {
32: this .showUser = false;
33: }
34:
35: public InvalidStateException(String message) {
36: this (message, true);
37: }
38:
39: public InvalidStateException(String message, Throwable cause) {
40: this (message, cause, true);
41: }
42:
43: public InvalidStateException(String message, boolean showUser) {
44: super (message);
45: this .showUser = showUser;
46: }
47:
48: public InvalidStateException(String message, Throwable cause,
49: boolean showUser) {
50: super (message, cause);
51: this .showUser = showUser;
52: }
53:
54: /**
55: * Checks if this exception should be presented to the user.
56: * @return <tt>true</tt> to present the exception to the user, <tt>false</tt> otherwise.
57: */
58: public boolean isShowUser() {
59: return showUser;
60: }
61:
62: /**
63: * Configures if this exception should be presented to the user.
64: * @param showUser <tt>true</tt> to present the exception to the user, <tt>false</tt> otherwise.
65: */
66: public void setShowUser(boolean showUser) {
67: this.showUser = showUser;
68: }
69: }
|