home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / beans / beancontext / BeanContextChild.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  3.4 KB  |  111 lines

  1. /*
  2.  * @(#)BeanContextChild.java    1.9 98/03/18
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.beans.beancontext;
  16.  
  17. import java.beans.PropertyChangeListener;
  18. import java.beans.VetoableChangeListener;
  19. import java.beans.PropertyVetoException;
  20.  
  21. import java.beans.beancontext.BeanContext;
  22.  
  23. /**
  24.  * <p>
  25.  * JavaBeans wishing to be nested within, and obtain a reference to their
  26.  * execution environment, or context, as defined by the BeanContext
  27.  * sub-interface shall implement this interface.
  28.  * </p>
  29.  * <p>
  30.  * Conformant BeanContexts shall as a side effect of adding a BeanContextChild
  31.  * object shall pass a reference to itself via the setBeanContext() method of
  32.  * this interface.
  33.  * </p>
  34.  * <p>
  35.  * Note that a BeanContextChild may refuse a change in state by throwing
  36.  * PropertyVetoedException in response.
  37.  * </p>
  38.  * <p>
  39.  * In order for persistence mechanisms to function properly on BeanContextChild
  40.  * instances across a broad variety of scenarios, implementing classes of this
  41.  * interface are required to define as transient, any or all fields, or
  42.  * instance variables, that may contain, or represent, references to the
  43.  * nesting BeanContext instance, Delegates indirectly obtained via the nesting
  44.  * BeanContext's java.util.Aggregate interface, or other resources obtained
  45.  * from the BeanContext via any unspecified mechanisms.
  46.  * </p>
  47.  *
  48.  * @author    Laurence P. G. Cable
  49.  * @version    1.9
  50.  * @since    JDK1.2
  51.  * 
  52.  * @seealso    java.beans.beancontext.BeanContext
  53.  * @seealso    java.beans.PropertyChangeEvent
  54.  * @seealso    java.beans.PropertyChangeListener
  55.  * @seealso    java.beans.PropertyVetoEvent
  56.  * @seealso    java.beans.PropertyVetoListener
  57.  * @seealso    java.beans.PropertyVetoException
  58.  */
  59.  
  60. public interface BeanContextChild {
  61.  
  62.     /**
  63.      * <p>
  64.      * Objects that implement this interface, 
  65.      * shall fire a java.beans.PropertyChangeEvent, with parameters:
  66.      *
  67.      * @param propertyName    "beanContext"
  68.      * @param oldValue        the previous nesting BeanContext instance, or null
  69.      * @param newValue        the current nesting BeanContext instance, or null
  70.      * </p>
  71.      * <p>
  72.      * A change in the value of the nesting BeanContext property of this
  73.      * BeanContextChild may be vetoed by throwing the appropriate exception.
  74.      * </p>
  75.      */
  76.  
  77.  
  78.     void setBeanContext(BeanContext bc) throws PropertyVetoException;
  79.  
  80.     /**
  81.      * @returns the current BeanContext associated with the JavaBean
  82.      */
  83.  
  84.     BeanContext getBeanContext();
  85.  
  86.     /**
  87.      * add a property change listener to this bean child
  88.      */
  89.  
  90.     void addPropertyChangeListener(String name, PropertyChangeListener pcl);
  91.  
  92.     /**
  93.      * remove a property change listener to this bean child
  94.      */
  95.  
  96.     void removePropertyChangeListener(String name, PropertyChangeListener pcl);
  97.  
  98.     /**
  99.      * add a vetoable change listener to this child
  100.      */
  101.  
  102.     void addVetoableChangeListener(String name, VetoableChangeListener vcl);
  103.  
  104.     /**
  105.      * remove a vetoable change listener to this child
  106.      */
  107.  
  108.     void removeVetoableChangeListener(String name, VetoableChangeListener vcl);
  109.  
  110. }
  111.