KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > beans > beancontext > BeanContextEvent


1 /*
2  * @(#)BeanContextEvent.java 1.14 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.beans.beancontext;
9
10 import java.util.EventObject JavaDoc;
11
12 import java.beans.beancontext.BeanContext JavaDoc;
13
14 /**
15  * <p>
16  * <code>BeanContextEvent</code> is the abstract root event class
17  * for all events emitted
18  * from, and pertaining to the semantics of, a <code>BeanContext</code>.
19  * This class introduces a mechanism to allow the propagation of
20  * <code>BeanContextEvent</code> subclasses through a hierarchy of
21  * <code>BeanContext</code>s. The <code>setPropagatedFrom()</code>
22  * and <code>getPropagatedFrom()</code> methods allow a
23  * <code>BeanContext</code> to identify itself as the source
24  * of a propagated event.
25  * </p>
26  *
27  * @author Laurence P. G. Cable
28  * @version 1.14, 12/19/03
29  * @since 1.2
30  * @see java.beans.beancontext.BeanContext
31  */

32
33 public abstract class BeanContextEvent extends EventObject JavaDoc {
34
35     /**
36      * Contruct a BeanContextEvent
37      *
38      * @param bc The BeanContext source
39      */

40     protected BeanContextEvent(BeanContext JavaDoc bc) {
41     super(bc);
42     }
43
44     /**
45      * Gets the <code>BeanContext</code> associated with this event.
46      * @return the <code>BeanContext</code> associated with this event.
47      */

48     public BeanContext JavaDoc getBeanContext() { return (BeanContext JavaDoc)getSource(); }
49
50     /**
51      * Sets the <code>BeanContext</code> from which this event was propagated.
52      * @param bc the <code>BeanContext</code> from which this event
53      * was propagated
54      */

55     public synchronized void setPropagatedFrom(BeanContext JavaDoc bc) {
56     propagatedFrom = bc;
57     }
58
59     /**
60      * Gets the <code>BeanContext</code> from which this event was propagated.
61      * @return the <code>BeanContext</code> from which this
62      * event was propagated
63      */

64     public synchronized BeanContext JavaDoc getPropagatedFrom() {
65     return propagatedFrom;
66     }
67
68     /**
69      * Reports whether or not this event is
70      * propagated from some other <code>BeanContext</code>.
71      * @return <code>true</code> if propagated, <code>false</code>
72      * if not
73      */

74     public synchronized boolean isPropagated() {
75     return propagatedFrom != null;
76     }
77
78     /*
79      * fields
80      */

81
82     /**
83      * The <code>BeanContext</code> from which this event was propagated
84      */

85     protected BeanContext JavaDoc propagatedFrom;
86 }
87
88
89
90
91
92
93
94
Popular Tags