java.lang.Object | +--java.beans.beancontext.BeanContextChildSupportAll Implemented Interfaces:
java.beans.beancontext.BeanContextChild
transient java.beans.beancontext.BeanContext | beanContext The parent |
java.beans.beancontext.BeanContextChild | beanContextChildPeer The peer on which to perform |
java.beans.PropertyChangeSupport | pcSupport Listeners are registered here and events are fired through here. |
transient boolean | rejectedSetBCOnce If |
java.beans.VetoableChangeSupport | vcSupport Listeners are registered here and events are fired through here. |
BeanContextChildSupport() Create a new |
BeanContextChildSupport(java.beans.beancontext.BeanContextChild peer) Create a new |
void | addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener) Add a listener that will be notified when a specific property changes. |
void | addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener) Add a listener that will be notified when a specific property change is requested (a PropertyVetoException may be thrown) as well as after the change is successfully made. |
void | firePropertyChange(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal) Fire a property change. |
void | fireVetoableChange(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal) Fire a vetoable property change. |
java.beans.beancontext.BeanContext | getBeanContext() Get the parent |
java.beans.beancontext.BeanContextChild | getBeanContextChildPeer() Get the peer (or |
void | initializeBeanContextResources() Called by |
boolean | isDelegated() Determine whether there is a peer. |
void | releaseBeanContextResources() Called by |
void | removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener) Remove a listener to a certain property. |
void | removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener) Remove a listener to a certain property. |
void | serviceAvailable(java.beans.beancontext.BeanContextServiceAvailableEvent event) Called by |
void | serviceRevoked(java.beans.beancontext.BeanContextServiceRevokedEvent event) Called by |
void | setBeanContext(java.beans.beancontext.BeanContext newBeanContext) Set the parent |
boolean | validatePendingSetBeanContext(java.beans.beancontext.BeanContext newBeanContext) Called by |
protected transient BeanContext beanContext
BeanContext
.
public BeanContextChild beanContextChildPeer
set
actions.
This is here so that this class can be used as a peer.
When extending this class, this variable will be set to
this
.
protected PropertyChangeSupport pcSupport
protected transient boolean rejectedSetBCOnce
setBeanContext()
was vetoed once before, this
is set to true
so that the next time, vetoes will
be ignored.
protected VetoableChangeSupport vcSupport
public BeanContextChildSupport()
BeanContextChildSupport
with itself as the peer.
This is meant to be used when you subclass
BeanContextChildSupport
to create your child.
public BeanContextChildSupport(java.beans.beancontext.BeanContextChild peer)
BeanContextChildSupport
with the specified peer.
peer
- the peer to use, or null
to specify
this
.public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- the name of the property to listen on.listener
- the listener to listen on the property.public void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
propertyName
- the name of the property to listen on.listener
- the listener to listen on the property.public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal)
propertyName
- the name of the property that changedoldVal
- the old value of the propertynewVal
- the new value of the propertypublic void fireVetoableChange(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal)
propertyName
- the name of the property that changedoldVal
- the old value of the propertynewVal
- the new value of the propertyPropertyVetoException
- if the change is vetoed.public BeanContext getBeanContext()
BeanContext
.
BeanContext
.public BeanContextChild getBeanContextChildPeer()
this
if there is no peer).
this
if there is no peer.protected void initializeBeanContextResources()
setBeanContext()
to grab resources when the parent has been set.
This method is meant to be overriden.
BeanContextChildSupport
's implementation does
nothing.
public boolean isDelegated()
getBeanContextChildPeer() == this
.
protected void releaseBeanContextResources()
setBeanContext()
to release resources of a what will soon no longer be the parent.
This method is meant to be overriden.
BeanContextChildSupport
's implementation does
nothing.
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- the name of the property being listened on.listener
- the listener listening on the property.public void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
propertyName
- the name of the property being listened onlistener
- the listener listening on the property.public void serviceAvailable(java.beans.beancontext.BeanContextServiceAvailableEvent event)
BeanContextServices
whenever a service is made available.
This method is meant to be overriden.
BeanContextChildSupport
's implementation does
nothing.
event
- the service revoked event, with useful information
about the new service.public void serviceRevoked(java.beans.beancontext.BeanContextServiceRevokedEvent event)
BeanContextServices.revokeService()
to indicate that a service has been revoked.
If you have a reference to such a service, it should be
discarded and may no longer function properly.
getService()
will no longer work on the specified
service class after this event has been fired.
This method is meant to be overriden.
BeanContextChildSupport
's implementation does
nothing.
event
- the service revoked event.public void setBeanContext(java.beans.beancontext.BeanContext newBeanContext)
BeanContext
.
When this Object is being added to a new BeanContext or moved from an old one, a non-null value will be passed in.
When this Object is being removed from the current
BeanContext
, setBeanContext()
will
receive the parameter null
.
Order of events:
BeanContext
is the same as the old
one, nothing happens.
validatePendingSetBeanContext()
. If this call
returns false
, the change is rejected and a
PropertyVetoException
is thrown.
VetoableChangeEvent
s are fired with the name
"beanContext"
, using the
fireVetoableChange()
method. If a veto
occurs, reversion events are fired using the same method,
the change is rejected, and the veto is rethrown.
releaseBeanContextResources()
is called.
PropertyChangeEvent
s are fired using the
firePropertyChange()
method.
initializeBeanContextResources()
is called.
newBeanContext
- the new parent for the
BeanContextChild
, or null
to
signify removal from a tree.PropertyVetoException
- if the
BeanContextChild
implementor does not
wish to have its parent changed.public boolean validatePendingSetBeanContext(java.beans.beancontext.BeanContext newBeanContext)
setBeanContext()
to determine whether the set should be rejected.
This method is meant to be overriden.
BeanContextChildSupport
's implementation simply
returns true
.
newBeanContext
- the new parent.
BeanContextChild
. This class contains the most common implementations of the methods in theBeanContextChild