KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)BeanContextChild.java 1.20 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.beans.PropertyChangeListener JavaDoc;
11 import java.beans.VetoableChangeListener JavaDoc;
12 import java.beans.PropertyVetoException JavaDoc;
13
14 import java.beans.beancontext.BeanContext JavaDoc;
15
16 /**
17  * <p>
18  * JavaBeans wishing to be nested within, and obtain a reference to their
19  * execution environment, or context, as defined by the BeanContext
20  * sub-interface shall implement this interface.
21  * </p>
22  * <p>
23  * Conformant BeanContexts shall as a side effect of adding a BeanContextChild
24  * object shall pass a reference to itself via the setBeanContext() method of
25  * this interface.
26  * </p>
27  * <p>
28  * Note that a BeanContextChild may refuse a change in state by throwing
29  * PropertyVetoedException in response.
30  * </p>
31  * <p>
32  * In order for persistence mechanisms to function properly on BeanContextChild
33  * instances across a broad variety of scenarios, implementing classes of this
34  * interface are required to define as transient, any or all fields, or
35  * instance variables, that may contain, or represent, references to the
36  * nesting BeanContext instance or other resources obtained
37  * from the BeanContext via any unspecified mechanisms.
38  * </p>
39  *
40  * @author Laurence P. G. Cable
41  * @version 1.20, 12/19/03
42  * @since 1.2
43  *
44  * @see java.beans.beancontext.BeanContext
45  * @see java.beans.PropertyChangeEvent
46  * @see java.beans.PropertyChangeListener
47  * @see java.beans.PropertyVetoEvent
48  * @see java.beans.PropertyVetoListener
49  * @see java.beans.PropertyVetoException
50  */

51
52 public interface BeanContextChild {
53
54     /**
55      * <p>
56      * Objects that implement this interface,
57      * shall fire a java.beans.PropertyChangeEvent, with parameters:
58      *
59      * propertyName "beanContext", oldValue (the previous nesting
60      * <code>BeanContext</code> instance, or <code>null</code>),
61      * newValue (the current nesting
62      * <code>BeanContext</code> instance, or <code>null</code>).
63      * <p>
64      * A change in the value of the nesting BeanContext property of this
65      * BeanContextChild may be vetoed by throwing the appropriate exception.
66      * </p>
67      * @param bc The <code>BeanContext</code> with which
68      * to associate this <code>BeanContextChild</code>.
69      * @throws <code>PropertyVetoException</code> if the
70      * addition of the specified <code>BeanContext</code> is refused.
71      */

72     void setBeanContext(BeanContext JavaDoc bc) throws PropertyVetoException JavaDoc;
73
74     /**
75      * Gets the <code>BeanContext</code> associated
76      * with this <code>BeanContextChild</code>.
77      * @return the <code>BeanContext</code> associated
78      * with this <code>BeanContextChild</code>.
79      */

80     BeanContext JavaDoc getBeanContext();
81
82     /**
83      * Adds a <code>PropertyChangeListener</code>
84      * to this <code>BeanContextChild</code>
85      * in order to receive a <code>PropertyChangeEvent</code>
86      * whenever the specified property has changed.
87      * @param name the name of the property to listen on
88      * @param pcl the <code>PropertyChangeListener</code> to add
89      */

90     void addPropertyChangeListener(String JavaDoc name, PropertyChangeListener JavaDoc pcl);
91
92     /**
93      * Removes a <code>PropertyChangeListener</code> from this
94      * <code>BeanContextChild</code> so that it no longer
95      * receives <code>PropertyChangeEvents</code> when the
96      * specified property is changed.
97      *
98      * @param name the name of the property that was listened on
99      * @param pcl the <code>PropertyChangeListener</code> to remove
100      */

101     void removePropertyChangeListener(String JavaDoc name, PropertyChangeListener JavaDoc pcl);
102
103     /**
104      * Adds a <code>VetoableChangeListener</code> to
105      * this <code>BeanContextChild</code>
106      * to receive events whenever the specified property changes.
107      * @param name the name of the property to listen on
108      * @param vcl the <code>VetoableChangeListener</code> to add
109      */

110     void addVetoableChangeListener(String JavaDoc name, VetoableChangeListener JavaDoc vcl);
111
112     /**
113      * Removes a <code>VetoableChangeListener</code> from this
114      * <code>BeanContextChild</code> so that it no longer receives
115      * events when the specified property changes.
116      * @param name the name of the property that was listened on.
117      * @param vcl the <code>VetoableChangeListener</code> to remove.
118      */

119     void removeVetoableChangeListener(String JavaDoc name, VetoableChangeListener JavaDoc vcl);
120
121 }
122
Popular Tags