KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > beans > BaseEvent


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.beans;
8
9
10 import java.util.EventObject JavaDoc;
11
12
13 /**
14  * This class is the base event that all events will extends
15  * from. It contains the fundamental items that all events
16  * should have. Since this event derives from the EeventObject,
17  * the source of the event is the BaseBeanProperty object
18  * that created the event.
19  *
20  * @author Brian Pontarelli
21  */

22 public abstract class BaseEvent extends EventObject JavaDoc {
23
24     private BaseBeanProperty property;
25     private Object JavaDoc oldValue;
26     private Object JavaDoc newValue;
27     private Object JavaDoc bean;
28
29     /**
30      * Creates a new base event using the values given
31      */

32     public BaseEvent(BaseBeanProperty property, Object JavaDoc oldValue, Object JavaDoc newValue,
33             Object JavaDoc bean) {
34         super(property);
35         this.property = property;
36         this.oldValue = oldValue;
37         this.newValue = newValue;
38         this.bean = bean;
39     }
40
41     /** Retrieves the name of the property the event occurred for */
42     public String JavaDoc getPropertyName() {
43         return property.getPropertyName();
44     }
45
46     /**
47      * Returns the type of the property the event occurred for. This may be null
48      * if the property type is unknown. For example, nested properties are always
49      * unknown because they type may change at runtime.
50      */

51     public Class JavaDoc getPropertyType() {
52         return property.getPropertyType();
53     }
54
55     /** Returns the full name of the property the event occurred for */
56     public String JavaDoc getFullName() {
57         return property.getFullName();
58     }
59
60     /**
61      * Returns the old value. This is different for each type of event, so
62      * please consult the sub-classes for a more complete description of
63      * this method.
64      */

65     public Object JavaDoc getOldValue() {
66         return oldValue;
67     }
68      
69     /**
70      * Returns the new value. This is different for each type of event, so
71      * please consult the sub-classes for a more complete description of
72      * this method.
73      */

74     public Object JavaDoc getNewValue() {
75         return newValue;
76     }
77
78     /** Returns the bean object whose property the event occurred for */
79     public Object JavaDoc getBean() {
80         return bean;
81     }
82 }
83
Popular Tags