JavaTM 2 Platform
Standard Ed. 6

java.beans.beancontext
类 BeanContextChildSupport

java.lang.Object
  继承者 java.beans.beancontext.BeanContextChildSupport
所有已实现的接口:
BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, Serializable, EventListener
直接已知子类:
BeanContextSupport

public class BeanContextChildSupport
extends Object
implements BeanContextChild, BeanContextServicesListener, Serializable

这是一个为实现 BeanContextChild 协议提供支持的一般支持类。 要为给定的组件实现此接口,可以直接为此类创建子类,也可以封装和委托此类。

从以下版本开始:
1.2
另请参见:
BeanContext, BeanContextServices, BeanContextChild, 序列化表格

字段摘要
protected  BeanContext beanContext
           
 BeanContextChild beanContextChildPeer
          在其中嵌套此 BeanContextChildBeanContext
protected  PropertyChangeSupport pcSupport
          与此 BeanContextChildSupport 相关联的 PropertyChangeSupport
protected  boolean rejectedSetBCOnce
          一个标志,指示在试图执行 setBeanContext 操作时,至少已经抛出了一个 PropertyChangeVetoException
protected  VetoableChangeSupport vcSupport
          与此 BeanContextChildSupport 相关联的 VetoableChangeSupport
 
构造方法摘要
BeanContextChildSupport()
          构造一个 BeanContextChildSupport,其中已经为此类创建了子类以便实现 JavaBean 组件自身。
BeanContextChildSupport(BeanContextChild bcc)
          构造一个 BeanContextChildSupport,其中 JavaBean 组件自身实现 BeanContextChild 并封装它,并将该接口委托给此实现
 
方法摘要
 void addPropertyChangeListener(String name, PropertyChangeListener pcl)
          为特定属性添加一个 PropertyChangeListener。
 void addVetoableChangeListener(String name, VetoableChangeListener vcl)
          为特定属性添加一个 VetoableChangeListener。
 void firePropertyChange(String name, Object oldValue, Object newValue)
          向所有已注册的侦听器报告绑定 (bound) 属性更新。
 void fireVetoableChange(String name, Object oldValue, Object newValue)
          向所有已注册的侦听器报告 vetoable 属性更新。
 BeanContext getBeanContext()
          获得此 BeanContextChildSupport 的嵌套 BeanContext
 BeanContextChild getBeanContextChildPeer()
          获得与此 BeanContextChildSupport 相关联的 BeanContextChild
protected  void initializeBeanContextResources()
          子类可重写此方法来提供它们自己的初始化行为。
 boolean isDelegated()
          报告此类是否是另一个类的委托。
protected  void releaseBeanContextResources()
          子类可重写此方法来提供它们自己的释放行为。
 void removePropertyChangeListener(String name, PropertyChangeListener pcl)
          为特定属性移除一个 PropertyChangeListener。
 void removeVetoableChangeListener(String name, VetoableChangeListener vcl)
          移除一个 VetoableChangeListener
 void serviceAvailable(BeanContextServiceAvailableEvent bcsae)
          可从嵌套 BeanContext 中获得新的服务。
 void serviceRevoked(BeanContextServiceRevokedEvent bcsre)
          由嵌套 BeanContext 提供的服务已经被取消。
 void setBeanContext(BeanContext bc)
          设置此 BeanContextChildSupportBeanContext
 boolean validatePendingSetBeanContext(BeanContext newValue)
          从 setBeanContext 调用,以验证(或相反)嵌套 BeanContext 属性值中的挂起更改。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

beanContextChildPeer

public BeanContextChild beanContextChildPeer
在其中嵌套此 BeanContextChildBeanContext


pcSupport

protected PropertyChangeSupport pcSupport
与此 BeanContextChildSupport 相关联的 PropertyChangeSupport


vcSupport

protected VetoableChangeSupport vcSupport
与此 BeanContextChildSupport 相关联的 VetoableChangeSupport


beanContext

protected transient BeanContext beanContext

rejectedSetBCOnce

protected transient boolean rejectedSetBCOnce
一个标志,指示在试图执行 setBeanContext 操作时,至少已经抛出了一个 PropertyChangeVetoException

构造方法详细信息

BeanContextChildSupport

public BeanContextChildSupport()
构造一个 BeanContextChildSupport,其中已经为此类创建了子类以便实现 JavaBean 组件自身。


BeanContextChildSupport

public BeanContextChildSupport(BeanContextChild bcc)
构造一个 BeanContextChildSupport,其中 JavaBean 组件自身实现 BeanContextChild 并封装它,并将该接口委托给此实现

方法详细信息

setBeanContext

public void setBeanContext(BeanContext bc)
                    throws PropertyVetoException
设置此 BeanContextChildSupportBeanContext

指定者:
接口 BeanContextChild 中的 setBeanContext
参数:
bc - 分配给 BeanContext 属性的新值
抛出:
PropertyVetoException - 如果拒绝更改
PropertyVetoException

getBeanContext

public BeanContext getBeanContext()
获得此 BeanContextChildSupport 的嵌套 BeanContext

指定者:
接口 BeanContextChild 中的 getBeanContext
返回:
BeanContextChildSupport 的嵌套 BeanContext

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener pcl)
为特定属性添加一个 PropertyChangeListener。可以多次添加同一侦听器对象。对于每个属性,该侦听器被调用的次数与为该属性添加此侦听器的次数相同。如果 namepcl 为 null,则不会抛出任何异常并且不执行任何操作。

指定者:
接口 BeanContextChild 中的 addPropertyChangeListener
参数:
name - 要侦听的属性的名称
pcl - 要添加的 PropertyChangeListener

removePropertyChangeListener

public void removePropertyChangeListener(String name,
                                         PropertyChangeListener pcl)
为特定属性移除一个 PropertyChangeListener。如果将 pcl 多次添加到指定属性的同一事件源,则在被移除之后,它获得的通知将减少一次。如果 name 为 null,则不会抛出任何异常并且不执行任何操作。如果 pcl 为 null,或者从不为指定属性添加 pcl,则不抛出任何异常并且不执行任何操作。

指定者:
接口 BeanContextChild 中的 removePropertyChangeListener
参数:
name - 已被侦听的属性的名称
pcl - 要移除的 PropertyChangeListener

addVetoableChangeListener

public void addVetoableChangeListener(String name,
                                      VetoableChangeListener vcl)
为特定属性添加一个 VetoableChangeListener。可以多次添加同一侦听器对象。对于每个属性,该侦听器被调用的次数与为该属性添加此侦听器的次数相同。如果 namevcl 为 null,则不会抛出任何异常并且不执行任何操作。

指定者:
接口 BeanContextChild 中的 addVetoableChangeListener
参数:
name - 要侦听的属性的名称
vcl - 要添加的 VetoableChangeListener

removeVetoableChangeListener

public void removeVetoableChangeListener(String name,
                                         VetoableChangeListener vcl)
移除一个 VetoableChangeListener。如果将 pcl 多次添加到指定属性的同一事件源,则在被移除之后,它获得的通知将减少一次。如果 name 为 null,则不会抛出任何异常并且不执行任何操作。如果 vcl 为 null,或者从不为指定属性添加 pcl,则不抛出任何异常并且不执行任何操作。

指定者:
接口 BeanContextChild 中的 removeVetoableChangeListener
参数:
name - 已被侦听的属性的名称
vcl - 要移除的 VetoableChangeListener

serviceRevoked

public void serviceRevoked(BeanContextServiceRevokedEvent bcsre)
由嵌套 BeanContext 提供的服务已经被取消。 子类可以重写此方法以便实现自己的行为。

指定者:
接口 BeanContextServiceRevokedListener 中的 serviceRevoked
参数:
bcsre - 由于取消服务而触发的 BeanContextServiceRevokedEvent

serviceAvailable

public void serviceAvailable(BeanContextServiceAvailableEvent bcsae)
可从嵌套 BeanContext 中获得新的服务。 子类可以重写此方法以便实现自己的行为。

指定者:
接口 BeanContextServicesListener 中的 serviceAvailable
参数:
bcsae - 由于服务变得可用而触发的 BeanContextServiceAvailableEvent

getBeanContextChildPeer

public BeanContextChild getBeanContextChildPeer()
获得与此 BeanContextChildSupport 相关联的 BeanContextChild

返回:
此类的 BeanContextChild 同位体。

isDelegated

public boolean isDelegated()
报告此类是否是另一个类的委托。

返回:
true 如果此类是另一个类的委托

firePropertyChange

public void firePropertyChange(String name,
                               Object oldValue,
                               Object newValue)
向所有已注册的侦听器报告绑定 (bound) 属性更新。如果新属性和旧属性相同并且是非 null 的,则不会触发事件。

参数:
name - 已更改属性的编程名称
oldValue - 属性的旧值
newValue - 属性的新值

fireVetoableChange

public void fireVetoableChange(String name,
                               Object oldValue,
                               Object newValue)
                        throws PropertyVetoException
向所有已注册的侦听器报告 vetoable 属性更新。如果任何人禁止更改,则触发一个新的事件,该事件将每个人的属性还原为旧值,然后再次抛出 PropertyVetoException。

如果新属性和旧属性相等并且是非 null 的,则不会触发事件。

参数:
name - 将更改属性的编程名称
oldValue - 属性的旧值
newValue - 属性的新值
抛出:
PropertyVetoException - 如果接收方希望回滚属性更改。

validatePendingSetBeanContext

public boolean validatePendingSetBeanContext(BeanContext newValue)
从 setBeanContext 调用,以验证(或相反)嵌套 BeanContext 属性值中的挂起更改。返回 false 将造成 setBeanContext 抛出 PropertyVetoException。

参数:
newValue - 已为 BeanContext 属性请求的新值
返回:
如果禁止执行更改操作,则返回 true

releaseBeanContextResources

protected void releaseBeanContextResources()
子类可重写此方法来提供它们自己的释放行为。在调用此方法时,应该释放此实例从其当前 BeanContext 属性中获得的所有资源,因为对象不再嵌套在 BeanContext 中。


initializeBeanContextResources

protected void initializeBeanContextResources()
子类可重写此方法来提供它们自己的初始化行为。在调用此方法时,BeanContextChild 所需的资源应该从当前 BeanContext 中获得。


JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策