< prev index next >

src/java.desktop/share/classes/java/beans/beancontext/BeanContextEvent.java

Print this page




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.beans.beancontext;
  27 
  28 import java.util.EventObject;
  29 
  30 import java.beans.beancontext.BeanContext;
  31 
  32 /**
  33  * <p>
  34  * <code>BeanContextEvent</code> is the abstract root event class
  35  * for all events emitted
  36  * from, and pertaining to the semantics of, a <code>BeanContext</code>.
  37  * This class introduces a mechanism to allow the propagation of
  38  * <code>BeanContextEvent</code> subclasses through a hierarchy of
  39  * <code>BeanContext</code>s. The <code>setPropagatedFrom()</code>
  40  * and <code>getPropagatedFrom()</code> methods allow a
  41  * <code>BeanContext</code> to identify itself as the source
  42  * of a propagated event.
  43  * </p>
  44  *
  45  * @author      Laurence P. G. Cable
  46  * @since       1.2
  47  * @see         java.beans.beancontext.BeanContext
  48  */
  49 
  50 public abstract class BeanContextEvent extends EventObject {
  51     private static final long serialVersionUID = 7267998073569045052L;
  52 
  53     /**
  54      * Contruct a BeanContextEvent
  55      *
  56      * @param bc        The BeanContext source
  57      */
  58     protected BeanContextEvent(BeanContext bc) {
  59         super(bc);
  60     }
  61 
  62     /**
  63      * Gets the <code>BeanContext</code> associated with this event.
  64      * @return the <code>BeanContext</code> associated with this event.
  65      */
  66     public BeanContext getBeanContext() { return (BeanContext)getSource(); }
  67 
  68     /**
  69      * Sets the <code>BeanContext</code> from which this event was propagated.
  70      * @param bc the <code>BeanContext</code> from which this event
  71      * was propagated
  72      */
  73     public synchronized void setPropagatedFrom(BeanContext bc) {
  74         propagatedFrom = bc;
  75     }
  76 
  77     /**
  78      * Gets the <code>BeanContext</code> from which this event was propagated.
  79      * @return the <code>BeanContext</code> from which this
  80      * event was propagated
  81      */
  82     public synchronized BeanContext getPropagatedFrom() {
  83         return propagatedFrom;
  84     }
  85 
  86     /**
  87      * Reports whether or not this event is
  88      * propagated from some other <code>BeanContext</code>.
  89      * @return <code>true</code> if propagated, <code>false</code>
  90      * if not
  91      */
  92     public synchronized boolean isPropagated() {
  93         return propagatedFrom != null;
  94     }
  95 
  96     /*
  97      * fields
  98      */
  99 
 100     /**
 101      * The <code>BeanContext</code> from which this event was propagated
 102      */
 103     protected BeanContext propagatedFrom;
 104 }


  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.beans.beancontext;
  27 
  28 import java.util.EventObject;
  29 
  30 import java.beans.beancontext.BeanContext;
  31 
  32 /**
  33  * <p>
  34  * {@code BeanContextEvent} is the abstract root event class
  35  * for all events emitted
  36  * from, and pertaining to the semantics of, a {@code BeanContext}.
  37  * This class introduces a mechanism to allow the propagation of
  38  * {@code BeanContextEvent} subclasses through a hierarchy of
  39  * {@code BeanContext}s. The {@code setPropagatedFrom()}
  40  * and {@code getPropagatedFrom()} methods allow a
  41  * {@code BeanContext} to identify itself as the source
  42  * of a propagated event.
  43  * </p>
  44  *
  45  * @author      Laurence P. G. Cable
  46  * @since       1.2
  47  * @see         java.beans.beancontext.BeanContext
  48  */
  49 
  50 public abstract class BeanContextEvent extends EventObject {
  51     private static final long serialVersionUID = 7267998073569045052L;
  52 
  53     /**
  54      * Contruct a BeanContextEvent
  55      *
  56      * @param bc        The BeanContext source
  57      */
  58     protected BeanContextEvent(BeanContext bc) {
  59         super(bc);
  60     }
  61 
  62     /**
  63      * Gets the {@code BeanContext} associated with this event.
  64      * @return the {@code BeanContext} associated with this event.
  65      */
  66     public BeanContext getBeanContext() { return (BeanContext)getSource(); }
  67 
  68     /**
  69      * Sets the {@code BeanContext} from which this event was propagated.
  70      * @param bc the {@code BeanContext} from which this event
  71      * was propagated
  72      */
  73     public synchronized void setPropagatedFrom(BeanContext bc) {
  74         propagatedFrom = bc;
  75     }
  76 
  77     /**
  78      * Gets the {@code BeanContext} from which this event was propagated.
  79      * @return the {@code BeanContext} from which this
  80      * event was propagated
  81      */
  82     public synchronized BeanContext getPropagatedFrom() {
  83         return propagatedFrom;
  84     }
  85 
  86     /**
  87      * Reports whether or not this event is
  88      * propagated from some other {@code BeanContext}.
  89      * @return {@code true} if propagated, {@code false}
  90      * if not
  91      */
  92     public synchronized boolean isPropagated() {
  93         return propagatedFrom != null;
  94     }
  95 
  96     /*
  97      * fields
  98      */
  99 
 100     /**
 101      * The {@code BeanContext} from which this event was propagated
 102      */
 103     protected BeanContext propagatedFrom;
 104 }
< prev index next >