java.beans.beancontext

Class BeanContextChildSupport

Implemented Interfaces:
BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, EventListener, Serializable
Known Direct Subclasses:
BeanContextSupport

public class BeanContextChildSupport
extends Object
implements BeanContextChild, BeanContextServicesListener, Serializable

This is a general support class to provide support for implementing the BeanContextChild protocol. This class may either be directly subclassed, or encapsulated and delegated to in order to implement this interface for a given component.
Since:
1.2
See Also:
BeanContext, BeanContextServices, BeanContextChild, Serialized Form

Field Summary

protected BeanContext
beanContext
BeanContextChild
beanContextChildPeer
The BeanContext in which this BeanContextChild is nested.
protected PropertyChangeSupport
pcSupport
The PropertyChangeSupport associated with this BeanContextChildSupport.
protected boolean
rejectedSetBCOnce
A flag indicating that there has been at least one PropertyChangeVetoException thrown for the attempted setBeanContext operation.
protected VetoableChangeSupport
vcSupport
The VetoableChangeSupport associated with this BeanContextChildSupport.

Constructor Summary

BeanContextChildSupport()
construct a BeanContextChildSupport where this class has been subclassed in order to implement the JavaBean component itself.
BeanContextChildSupport(BeanContextChild bcc)
construct a BeanContextChildSupport where the JavaBean component itself implements BeanContextChild, and encapsulates this, delegating that interface to this implementation

Method Summary

void
addPropertyChangeListener(String name, PropertyChangeListener pcl)
Add a PropertyChangeListener for a specific property.
void
addVetoableChangeListener(String name, VetoableChangeListener vcl)
Add a VetoableChangeListener for a specific property.
void
firePropertyChange(String name, Object oldValue, Object newValue)
Report a bound property update to any registered listeners.
void
fireVetoableChange(String name, Object oldValue, Object newValue)
Report a vetoable property update to any registered listeners.
BeanContext
getBeanContext()
Gets the nesting BeanContext for this BeanContextChildSupport.
BeanContextChild
getBeanContextChildPeer()
Gets the BeanContextChild associated with this BeanContextChildSupport.
protected void
initializeBeanContextResources()
This method may be overridden by subclasses to provide their own initialization behaviors.
boolean
isDelegated()
Reports whether or not this class is a delegate of another.
protected void
releaseBeanContextResources()
This method may be overridden by subclasses to provide their own release behaviors.
void
removePropertyChangeListener(String name, PropertyChangeListener pcl)
Remove a PropertyChangeListener for a specific property.
void
removeVetoableChangeListener(String name, VetoableChangeListener vcl)
Removes a VetoableChangeListener.
void
serviceAvailable(BeanContextServiceAvailableEvent bcsae)
A new service is available from the nesting BeanContext.
void
serviceRevoked(BeanContextServiceRevokedEvent bcsre)
A service provided by the nesting BeanContext has been revoked.
void
setBeanContext(BeanContext bc)
Sets the BeanContext for this BeanContextChildSupport.
boolean
validatePendingSetBeanContext(BeanContext newValue)
Called from setBeanContext to validate (or otherwise) the pending change in the nesting BeanContext property value.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

beanContext

protected BeanContext beanContext

beanContextChildPeer

public BeanContextChild beanContextChildPeer
The BeanContext in which this BeanContextChild is nested.

pcSupport

protected PropertyChangeSupport pcSupport
The PropertyChangeSupport associated with this BeanContextChildSupport.

rejectedSetBCOnce

protected boolean rejectedSetBCOnce
A flag indicating that there has been at least one PropertyChangeVetoException thrown for the attempted setBeanContext operation.

vcSupport

protected VetoableChangeSupport vcSupport
The VetoableChangeSupport associated with this BeanContextChildSupport.

Constructor Details

BeanContextChildSupport

public BeanContextChildSupport()
construct a BeanContextChildSupport where this class has been subclassed in order to implement the JavaBean component itself.
Usages and Demos :

View More Examples of BeanContextChildSupport()
   1:     private BeanContextChildSupport beanContextChild = 
   2:         new BeanContextChildSupport() {
   3: 
   4:         public void initializeBeanContextResources()    {
   5:             context= getBeanContext();

View Full Code Here
   1:       childSupport =
   2:          new BeanContextChildSupport()
   3:          {  public void setBeanContext(BeanContext context)
   4:                throws PropertyVetoException
   5:             {  super.setBeanContext(context);

View Full Code Here
   1:             (
   2:     private final BeanContextChild dummyBean = new BeanContextChildSupport();
   3:     {
   4:     }

View Full Code Here

BeanContextChildSupport

public BeanContextChildSupport(BeanContextChild bcc)
construct a BeanContextChildSupport where the JavaBean component itself implements BeanContextChild, and encapsulates this, delegating that interface to this implementation
Usages and Demos :

View More Examples of BeanContextChildSupport(BeanContextChild bcc)
   1: {
   2:   private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport(this);
   3: 
   4: 

View Full Code Here

Method Details

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener pcl)
Add a PropertyChangeListener for a specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property. If name or pcl is null, no exception is thrown and no action is taken.
Specified by:
addPropertyChangeListener in interface BeanContextChild
Parameters:
name - The name of the property to listen on
pcl - The PropertyChangeListener to be added
Usages and Demos :

View More Examples of addPropertyChangeListener(String name,PropertyChangeListener pcl)
   1: {
   2:   private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport(this);
   3: 
   4:         ...
   5:                                         PropertyChangeListener pcl) {
   6:     beanContextChildSupport.addPropertyChangeListener(propertyName, pcl);
   7:   }
   8: 

View Full Code Here

addVetoableChangeListener

public void addVetoableChangeListener(String name,
                                      VetoableChangeListener vcl)
Add a VetoableChangeListener for a specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property. If name or vcl is null, no exception is thrown and no action is taken.
Specified by:
addVetoableChangeListener in interface BeanContextChild
Parameters:
name - The name of the property to listen on
vcl - The VetoableChangeListener to be added

firePropertyChange

public void firePropertyChange(String name,
                               Object oldValue,
                               Object newValue)
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.
Parameters:
name - The programmatic name of the property that was changed
oldValue - The old value of the property
newValue - The new value of the property

fireVetoableChange

public void fireVetoableChange(String name,
                               Object oldValue,
                               Object newValue)
            throws PropertyVetoException
Report a vetoable property update to any registered listeners. If anyone vetos the change, then fire a new event reverting everyone to the old value and then rethrow the PropertyVetoException.

No event is fired if old and new are equal and non-null.

Parameters:
name - The programmatic name of the property that is about to change
oldValue - The old value of the property
newValue - - The new value of the property
Throws:
PropertyVetoException - if the recipient wishes the property change to be rolled back.

getBeanContext

public BeanContext getBeanContext()
Gets the nesting BeanContext for this BeanContextChildSupport.
Specified by:
getBeanContext in interface BeanContextChild
Returns:
the nesting BeanContext for this BeanContextChildSupport.

getBeanContextChildPeer

public BeanContextChild getBeanContextChildPeer()
Gets the BeanContextChild associated with this BeanContextChildSupport.
Returns:
the BeanContextChild peer of this class

initializeBeanContextResources

protected void initializeBeanContextResources()
This method may be overridden by subclasses to provide their own initialization behaviors. When invoked any resources requried by the BeanContextChild should be obtained from the current BeanContext.

isDelegated

public boolean isDelegated()
Reports whether or not this class is a delegate of another.
Returns:
true if this class is a delegate of another

releaseBeanContextResources

protected void releaseBeanContextResources()
This method may be overridden by subclasses to provide their own release behaviors. When invoked any resources held by this instance obtained from its current BeanContext property should be released since the object is no longer nested within that BeanContext.

removePropertyChangeListener

public void removePropertyChangeListener(String name,
                                         PropertyChangeListener pcl)
Remove a PropertyChangeListener for a specific property. If pcl was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If name is null, no exception is thrown and no action is taken. If pcl is null, or was never added for the specified property, no exception is thrown and no action is taken.
Specified by:
removePropertyChangeListener in interface BeanContextChild
Parameters:
name - The name of the property that was listened on
pcl - The PropertyChangeListener to be removed
Usages and Demos :

View More Examples of removePropertyChangeListener(String name,PropertyChangeListener pcl)
   1: {
   2:   private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport(this);
   3: 
   4:         ...
   5:                                            PropertyChangeListener pcl) {
   6:     beanContextChildSupport.removePropertyChangeListener(propertyName, pcl);
   7:   }
   8: 

View Full Code Here

removeVetoableChangeListener

public void removeVetoableChangeListener(String name,
                                         VetoableChangeListener vcl)
Removes a VetoableChangeListener. If pcl was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If name is null, no exception is thrown and no action is taken. If vcl is null, or was never added for the specified property, no exception is thrown and no action is taken.
Specified by:
removeVetoableChangeListener in interface BeanContextChild
Parameters:
name - The name of the property that was listened on
vcl - The VetoableChangeListener to be removed
Usages and Demos :

View More Examples of removeVetoableChangeListener(String name,VetoableChangeListener vcl)
   1: {
   2:   private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport(this);
   3: 
   4:         ...
   5:                                            VetoableChangeListener in_vcl) {
   6:     beanContextChildSupport.removeVetoableChangeListener(propertyName, in_vcl);
   7:   }
   8: 

View Full Code Here

serviceAvailable

public void serviceAvailable(BeanContextServiceAvailableEvent bcsae)
A new service is available from the nesting BeanContext. Subclasses may override this method in order to implement their own behaviors
Specified by:
serviceAvailable in interface BeanContextServicesListener
Parameters:
bcsae - The BeanContextServiceAvailableEvent fired as a result of a service becoming available

serviceRevoked

public void serviceRevoked(BeanContextServiceRevokedEvent bcsre)
A service provided by the nesting BeanContext has been revoked. Subclasses may override this method in order to implement their own behaviors.
Specified by:
serviceRevoked in interface BeanContextServiceRevokedListener
Parameters:
bcsre - The BeanContextServiceRevokedEvent fired as a result of a service being revoked

setBeanContext

public void setBeanContext(BeanContext bc)
            throws PropertyVetoException
Sets the BeanContext for this BeanContextChildSupport.
Specified by:
setBeanContext in interface BeanContextChild
Parameters:
bc - the new value to be assigned to the BeanContext property
Usages and Demos :

View More Examples of setBeanContext(BeanContext bc)
   1: {
   2:   private BeanContextChildSupport beanContextChildSupport = new BeanContextChildSupport(this);
   3: 
   4:         ...
   5:       in_bc.addBeanContextMembershipListener(this);
   6:       beanContextChildSupport.setBeanContext(in_bc);
   7:       findAndInit(in_bc.iterator());
   8:     }
   9:   }

View Full Code Here

validatePendingSetBeanContext

public boolean validatePendingSetBeanContext(BeanContext newValue)
Called from setBeanContext to validate (or otherwise) the pending change in the nesting BeanContext property value. Returning false will cause setBeanContext to throw PropertyVetoException.
Parameters:
newValue - the new value that has been requested for the BeanContext property
Returns:
true if the change operation is to be vetoed