KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > util > gui > propedit > PropertyValueVetoException


1 package net.suberic.util.gui.propedit;
2
3 public class PropertyValueVetoException extends Exception JavaDoc {
4
5   String JavaDoc propertyName;
6   String JavaDoc rejectedValue;
7   String JavaDoc reason;
8   PropertyEditorListener listener;
9   String JavaDoc message = null;
10
11   /**
12    * Creates a new PropertyValueVetoException.
13    */

14   public PropertyValueVetoException(String JavaDoc pProperty, String JavaDoc pRejectedValue, String JavaDoc pReason, PropertyEditorListener pListener) {
15     propertyName = pProperty;
16     rejectedValue = pRejectedValue;
17     reason = pReason;
18     listener = pListener;
19   }
20
21   /**
22    * Creates a new PropertyValueVetoException.
23    */

24   public PropertyValueVetoException(String JavaDoc pMessage) {
25     message = pMessage;
26   }
27
28   /**
29    * Returns the property being changed.
30    */

31   public String JavaDoc getProperty() {
32     return propertyName;
33   }
34
35   /**
36    * Returns the rejected value.
37    */

38   public String JavaDoc getRejectedValue() {
39     return rejectedValue;
40   }
41
42   /**
43    * Returns the reason for rejection.
44    */

45   public String JavaDoc getReason() {
46     return reason;
47   }
48
49   /**
50    * Returns the listener that rejected the change.
51    */

52   public PropertyEditorListener getListener() {
53     return listener;
54   }
55
56   /**
57    * Returns the message for this exception.
58    */

59   public String JavaDoc getMessage() {
60     if (message == null)
61       return "Error changing value " + getProperty() + " to '" + getRejectedValue() + "': " + getReason();
62     else
63       return message;
64   }
65 }
66
Popular Tags