模块 java.desktop

接口 BeanContextChild

所有已知的子接口:
BeanContext , BeanContextServices
所有已知的实现类:
BeanContextChildSupport , BeanContextServicesSupport , BeanContextSupport

public interface BeanContextChild

希望嵌套在其中并获得对其执行环境或上下文的引用的 JavaBeans,如 BeanContext 子接口所定义,应实现此接口。

作为添加 BeanContextChild 对象的副作用,符合要求的 BeanContexts 应通过此接口的 setBeanContext() 方法传递对自身的引用。

请注意,BeanContextChild 可以通过抛出 PropertyVetoedException 作为响应来拒绝状态更改。

为了使持久性机制在各种场景中在 BeanContextChild 实例上正常运行,需要实现此接口的类来定义瞬态、任何或所有字段或实例变量,这些字段可能包含或表示对嵌套的引用BeanContext 实例或通过任何未指定的机制从 BeanContext 获得的其他资源。

自从:
1.2
参见:
  • 方法详情

    • setBeanContext

      void setBeanContext(BeanContext  bc) throws PropertyVetoException

      实现此接口的对象应触发 java.beans.PropertyChangeEvent,参数为:propertyName“beanContext”,oldValue(前一个嵌套 BeanContext 实例,或 null),newValue(当前嵌套 BeanContext 实例,或 null)。

      可以通过抛出适当的异常来否决此 BeanContextChild 的嵌套 BeanContext 属性值的更改。

      参数:
      bc - 与此 BeanContextChild 关联的 BeanContext
      抛出:
      PropertyVetoException - 如果添加指定的 BeanContext 被拒绝。
    • getBeanContext

      BeanContext  getBeanContext()
      获取与此 BeanContextChild 关联的 BeanContext
      返回:
      与此 BeanContextChild 关联的 BeanContext
    • addPropertyChangeListener

      void addPropertyChangeListener(String  name, PropertyChangeListener  pcl)
      PropertyChangeListener 添加到此 BeanContextChild,以便在指定属性发生更改时接收 PropertyChangeEvent
      参数:
      name - 要监听的属性的名称
      pcl - 要添加的 PropertyChangeListener
    • removePropertyChangeListener

      void removePropertyChangeListener(String  name, PropertyChangeListener  pcl)
      从此 BeanContextChild 中删除一个 PropertyChangeListener,以便它在更改指定属性时不再接收 PropertyChangeEvents
      参数:
      name - 被监听的属性的名称
      pcl - 要移除的 PropertyChangeListener
    • addVetoableChangeListener

      void addVetoableChangeListener(String  name, VetoableChangeListener  vcl)
      VetoableChangeListener 添加到此 BeanContextChild 以在指定属性更改时接收事件。
      参数:
      name - 要监听的属性的名称
      vcl - 要添加的 VetoableChangeListener
    • removeVetoableChangeListener

      void removeVetoableChangeListener(String  name, VetoableChangeListener  vcl)
      从此 BeanContextChild 中删除一个 VetoableChangeListener,以便它在指定的属性更改时不再接收事件。
      参数:
      name - 被监听的属性的名称。
      vcl - 要删除的 VetoableChangeListener