KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
11  * <p>
12  * This class is the event that is generated when a bean
13  * property is retrieved or set.
14  * </p>
15  *
16  * <p>
17  * The {@link BaseEvent#getOldValue() getOldValue} and {@link
18  * BaseEvent#getNewValue() getNewValue} methods in {@link
19  * BaseEvent BaseEvent} class are different for this event
20  * and are described here:
21  * </p>
22  *
23  * <p>
24  * <code>getOldValue</code> - Returns the value of the
25  * property. This value is the same whether a call to
26  * getPropertyValue or setPropertyValue is called. It is
27  * always the current value of the property before any
28  * action takes place
29  * </p>
30  *
31  * <p>
32  * <code>getNewValue</code> - Returns the new value of the
33  * property. This is equal to the value of getOldValue for
34  * get events. For set events this contains the value that
35  * was set into the property (which with auto-conversion is
36  * the value after conversion)
37  * </p>
38  *
39  * @author Brian Pontarelli
40  */

41 public class PropertyEvent extends BaseEvent {
42
43     private Object JavaDoc index;
44
45
46     /**
47      * Creates a new property event using the values given. For indexed properties,
48      * the index should be an Integer instance. For all others, this can be null
49      * or other Object indices.
50      */

51     public PropertyEvent(BaseBeanProperty property, Object JavaDoc oldValue, Object JavaDoc newValue,
52             Object JavaDoc bean, Object JavaDoc index) {
53         super(property, oldValue, newValue, bean);
54         this.index = index;
55     }
56
57
58     /**
59      * Returns the indices of the property the event occurred for. This is only used
60      * by the indexed properties or BeanProperties that are Collections and an
61      * indices is available for. This could be an Integer or any Object that was
62      * used as a key into a Map for instance
63      */

64     public Object JavaDoc getIndex() {
65         return index;
66     }
67 }
68
Popular Tags