GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.beans.beancontext.BeanContextChildSupport
public class BeanContextChildSupport
extends Object
implements BeanContextChild, BeanContextServicesListener, Serializable
BeanContextChild
.
This class contains the most common implementations of the methods in
the BeanContextChild
BeanContextChild
, Serialized FormField Summary | |
protected BeanContext |
|
BeanContextChild |
|
protected PropertyChangeSupport |
|
protected boolean |
|
protected VetoableChangeSupport |
|
Constructor Summary | |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
BeanContext |
|
BeanContextChild |
|
protected void |
|
boolean |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
boolean |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public BeanContextChild beanContextChildPeer
The peer on which to performset
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
Listeners are registered here and events are fired through here.
protected boolean rejectedSetBCOnce
IfsetBeanContext()
was vetoed once before, this is set totrue
so that the next time, vetoes will be ignored.
protected VetoableChangeSupport vcSupport
Listeners are registered here and events are fired through here.
public BeanContextChildSupport()
Create a newBeanContextChildSupport
with itself as the peer. This is meant to be used when you subclassBeanContextChildSupport
to create your child.
public BeanContextChildSupport(BeanContextChild peer)
Create a newBeanContextChildSupport
with the specified peer.
- Parameters:
peer
- the peer to use, ornull
to specifythis
.
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Add a listener that will be notified when a specific property changes.
- Specified by:
- addPropertyChangeListener in interface BeanContextChild
- Parameters:
propertyName
- the name of the property to listen on.listener
- the listener to listen on the property.
public void addVetoableChangeListener(String propertyName, 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.
- Specified by:
- addVetoableChangeListener in interface BeanContextChild
- Parameters:
propertyName
- the name of the property to listen on.listener
- the listener to listen on the property.
public void firePropertyChange(String propertyName, Object oldVal, Object newVal)
Fire a property change.
- Parameters:
propertyName
- the name of the property that changedoldVal
- the old value of the propertynewVal
- the new value of the property
public void fireVetoableChange(String propertyName, Object oldVal, Object newVal) throws PropertyVetoException
Fire a vetoable property change.
- Parameters:
propertyName
- the name of the property that changedoldVal
- the old value of the propertynewVal
- the new value of the property
- Throws:
PropertyVetoException
- if the change is vetoed.
public BeanContext getBeanContext()
Get the parentBeanContext
.
- Specified by:
- getBeanContext in interface BeanContextChild
- Returns:
- the parent
BeanContext
.
public BeanContextChild getBeanContextChildPeer()
Get the peer (orthis
if there is no peer).
- Returns:
- the peer, or
this
if there is no peer.
protected void initializeBeanContextResources()
Called bysetBeanContext()
to grab resources when the parent has been set.This method is meant to be overriden.
BeanContextChildSupport
's implementation does nothing.
public boolean isDelegated()
Determine whether there is a peer. This is true iffgetBeanContextChildPeer() == this
.
- Returns:
- whether there is a peer.
protected void releaseBeanContextResources()
Called bysetBeanContext()
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(String propertyName, PropertyChangeListener listener)
Remove a listener to a certain property.
- Specified by:
- removePropertyChangeListener in interface BeanContextChild
- Parameters:
propertyName
- the name of the property being listened on.listener
- the listener listening on the property.
public void removeVetoableChangeListener(String propertyName, VetoableChangeListener listener)
Remove a listener to a certain property.
- Specified by:
- removeVetoableChangeListener in interface BeanContextChild
- Parameters:
propertyName
- the name of the property being listened onlistener
- the listener listening on the property.
public void serviceAvailable(BeanContextServiceAvailableEvent event)
Called byBeanContextServices
whenever a service is made available.This method is meant to be overriden.
BeanContextChildSupport
's implementation does nothing.
- Specified by:
- serviceAvailable in interface BeanContextServicesListener
- Parameters:
event
- the service revoked event, with useful information about the new service.
public void serviceRevoked(BeanContextServiceRevokedEvent event)
Called byBeanContextServices.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.
- Specified by:
- serviceRevoked in interface BeanContextServiceRevokedListener
- Parameters:
event
- the service revoked event.
public void setBeanContext(BeanContext newBeanContext) throws PropertyVetoException
Set the parentBeanContext
.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 parameternull
.Order of events:
- If the new
BeanContext
is the same as the old one, nothing happens.- If the change has not been rejected or vetoed before, call
validatePendingSetBeanContext()
. If this call returnsfalse
, the change is rejected and aPropertyVetoException
is thrown.- If the change has not been rejected or vetoed before,
VetoableChangeEvent
s are fired with the name"beanContext"
, using thefireVetoableChange()
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.- The change is made.
PropertyChangeEvent
s are fired using thefirePropertyChange()
method.initializeBeanContextResources()
is called.
- Specified by:
- setBeanContext in interface BeanContextChild
- Parameters:
newBeanContext
- the new parent for theBeanContextChild
, ornull
to signify removal from a tree.
- Throws:
PropertyVetoException
- if theBeanContextChild
implementor does not wish to have its parent changed.
public boolean validatePendingSetBeanContext(BeanContext newBeanContext)
Called bysetBeanContext()
to determine whether the set should be rejected.This method is meant to be overriden.
BeanContextChildSupport
's implementation simply returnstrue
.
- Parameters:
newBeanContext
- the new parent.
- Returns:
- whether to allow the parent to be changed to the new value.
GNU Classpath (0.95) |