|
|||||||||
| Home >> All >> java >> beans >> [ beancontext overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.beans.beancontext
Class BeanContextChildSupport

java.lang.Objectjava.beans.beancontext.BeanContextChildSupport
- All Implemented Interfaces:
- BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, java.util.EventListener, java.io.Serializable
- Direct Known Subclasses:
- BeanContextSupport
- public class BeanContextChildSupport
- extends java.lang.Object
- implements BeanContextChild, BeanContextServicesListener, java.io.Serializable
- extends java.lang.Object
Support for creating a BeanContextChild.
This class contains the most common implementations of the methods in
the BeanContextChild
- Since:
- 1.2
| Field Summary | |
protected BeanContext |
beanContext
The parent BeanContext. |
BeanContextChild |
beanContextChildPeer
The peer on which to perform set actions. |
protected java.beans.PropertyChangeSupport |
pcSupport
Listeners are registered here and events are fired through here. |
protected boolean |
rejectedSetBCOnce
If setBeanContext() was vetoed once before, this
is set to true so that the next time, vetoes will
be ignored. |
(package private) static long |
serialVersionUID
|
protected java.beans.VetoableChangeSupport |
vcSupport
Listeners are registered here and events are fired through here. |
| Constructor Summary | |
BeanContextChildSupport()
Create a new BeanContextChildSupport with itself as the peer. |
|
BeanContextChildSupport(BeanContextChild peer)
Create a new BeanContextChildSupport with the specified peer. |
|
| Method Summary | |
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. |
BeanContext |
getBeanContext()
Get the parent BeanContext. |
BeanContextChild |
getBeanContextChildPeer()
Get the peer (or this if there is no peer). |
protected void |
initializeBeanContextResources()
Called by setBeanContext() to grab resources when the parent has been set. |
boolean |
isDelegated()
Determine whether there is a peer. |
protected void |
releaseBeanContextResources()
Called by setBeanContext() to release resources of a what will soon no longer be the parent. |
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(BeanContextServiceAvailableEvent event)
Called by BeanContextServices whenever a service is made available. |
void |
serviceRevoked(BeanContextServiceRevokedEvent event)
Called by BeanContextServices.revokeService() to indicate that a service has been revoked. |
void |
setBeanContext(BeanContext newBeanContext)
Set the parent BeanContext. |
boolean |
validatePendingSetBeanContext(BeanContext newBeanContext)
Called by setBeanContext() to determine whether the set should be rejected. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
beanContextChildPeer
public BeanContextChild beanContextChildPeer
- The peer on which to perform
setactions. This is here so that this class can be used as a peer.When extending this class, this variable will be set to
this.
beanContext
protected transient BeanContext beanContext
- The parent
BeanContext.
rejectedSetBCOnce
protected transient boolean rejectedSetBCOnce
- If
setBeanContext()was vetoed once before, this is set totrueso that the next time, vetoes will be ignored.
pcSupport
protected java.beans.PropertyChangeSupport pcSupport
- Listeners are registered here and events are fired through here.
vcSupport
protected java.beans.VetoableChangeSupport vcSupport
- Listeners are registered here and events are fired through here.
| Constructor Detail |
BeanContextChildSupport
public BeanContextChildSupport()
- Create a new
BeanContextChildSupportwith itself as the peer. This is meant to be used when you subclassBeanContextChildSupportto create your child.
BeanContextChildSupport
public BeanContextChildSupport(BeanContextChild peer)
- Create a new
BeanContextChildSupportwith the specified peer.
| Method Detail |
setBeanContext
public void setBeanContext(BeanContext newBeanContext) throws java.beans.PropertyVetoException
- Set the parent
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 parameternull.Order of events:
-
If the new
BeanContextis 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 aPropertyVetoExceptionis thrown. -
If the change has not been rejected or vetoed before,
VetoableChangeEvents 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.
-
PropertyChangeEvents are fired using thefirePropertyChange()method. -
initializeBeanContextResources()is called.
- Specified by:
setBeanContextin interfaceBeanContextChild
-
If the new
getBeanContext
public BeanContext getBeanContext()
- Get the parent
BeanContext.- Specified by:
getBeanContextin interfaceBeanContextChild
getBeanContextChildPeer
public BeanContextChild getBeanContextChildPeer()
- Get the peer (or
thisif there is no peer).
isDelegated
public boolean isDelegated()
- Determine whether there is a peer.
This is true iff
getBeanContextChildPeer() == this.
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
- Add a listener that will be notified when a specific property changes.
- Specified by:
addPropertyChangeListenerin interfaceBeanContextChild
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
- Remove a listener to a certain property.
- Specified by:
removePropertyChangeListenerin interfaceBeanContextChild
addVetoableChangeListener
public 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.
- Specified by:
addVetoableChangeListenerin interfaceBeanContextChild
removeVetoableChangeListener
public void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
- Remove a listener to a certain property.
- Specified by:
removeVetoableChangeListenerin interfaceBeanContextChild
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal)
- Fire a property change.
fireVetoableChange
public void fireVetoableChange(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal) throws java.beans.PropertyVetoException
- Fire a vetoable property change.
serviceRevoked
public void serviceRevoked(BeanContextServiceRevokedEvent event)
- Called by
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.- Specified by:
serviceRevokedin interfaceBeanContextServiceRevokedListener
serviceAvailable
public void serviceAvailable(BeanContextServiceAvailableEvent event)
- Called by
BeanContextServiceswhenever a service is made available.This method is meant to be overriden.
BeanContextChildSupport's implementation does nothing.- Specified by:
serviceAvailablein interfaceBeanContextServicesListener
validatePendingSetBeanContext
public boolean validatePendingSetBeanContext(BeanContext newBeanContext)
- Called by
setBeanContext()to determine whether the set should be rejected.This method is meant to be overriden.
BeanContextChildSupport's implementation simply returnstrue.
releaseBeanContextResources
protected void releaseBeanContextResources()
- Called by
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.
initializeBeanContextResources
protected void initializeBeanContextResources()
- Called by
setBeanContext()to grab resources when the parent has been set.This method is meant to be overriden.
BeanContextChildSupport's implementation does nothing.
|
|||||||||
| Home >> All >> java >> beans >> [ beancontext overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java.beans.beancontext.BeanContextChildSupport