KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwtx > swing > event > ValidationEvent


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: ValidationEvent.java,v $
11    Revision 1.1 2004/01/13 11:14:25 bobintetley
12    ErrorProvider and validation implementation
13
14 */

15
16 package swingwtx.swing.event;
17
18 /**
19  * This event object is used to determine if a particular
20  * component passes/fails it's validation.
21  */

22 public class ValidationEvent extends java.util.EventObject JavaDoc {
23     
24     protected boolean valid = false;
25     protected String JavaDoc errorMessage = "";
26     
27     public ValidationEvent(Object JavaDoc source) { super(source); }
28     
29     /** Getter for property errorMessage.
30      * @return Value of property errorMessage.
31      *
32      */

33     public java.lang.String JavaDoc getErrorMessage() {
34         return errorMessage;
35     }
36     
37     /** Setter for property errorMessage. Set this value if
38      * the component fails validation and the reason why
39      * @param errorMessage New value of property errorMessage.
40      *
41      */

42     public void setErrorMessage(java.lang.String JavaDoc errorMessage) {
43         this.errorMessage = errorMessage;
44     }
45     
46     /** Getter for property valid.
47      * @return Value of property valid.
48      *
49      */

50     public boolean isValid() {
51         return valid;
52     }
53     
54     /** Setter for property valid. Set this appropriately
55      * depending on whether the component passes validation
56      * @param valid New value of property valid.
57      *
58      */

59     public void setValid(boolean valid) {
60         this.valid = valid;
61         if (valid) errorMessage = "";
62     }
63     
64     public void setValid(boolean valid, String JavaDoc errorMessage) {
65         this.valid = valid;
66         this.errorMessage = errorMessage;
67     }
68     
69 }
70
Popular Tags