- java.lang.Object
-
- java.beans.beancontext.BeanContextChildSupport
-
- All Implemented Interfaces:
- BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, Serializable, EventListener
- Direct Known 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
Fields Modifier and Type Field and Description protected BeanContextbeanContextBeanContextChildbeanContextChildPeerTheBeanContextin which thisBeanContextChildis nested.protected PropertyChangeSupportpcSupportThe PropertyChangeSupport associated with this BeanContextChildSupport.protected booleanrejectedSetBCOnceA flag indicating that there has been at least onePropertyChangeVetoExceptionthrown for the attempted setBeanContext operation.protected VetoableChangeSupportvcSupportThe VetoableChangeSupport associated with this BeanContextChildSupport.
-
Constructor Summary
Constructors Constructor and Description 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
Methods Modifier and Type Method and Description voidaddPropertyChangeListener(String name, PropertyChangeListener pcl)Add a PropertyChangeListener for a specific property.voidaddVetoableChangeListener(String name, VetoableChangeListener vcl)Add a VetoableChangeListener for a specific property.voidfirePropertyChange(String name, Object oldValue, Object newValue)Report a bound property update to any registered listeners.voidfireVetoableChange(String name, Object oldValue, Object newValue)Report a vetoable property update to any registered listeners.BeanContextgetBeanContext()Gets the nestingBeanContextfor thisBeanContextChildSupport.BeanContextChildgetBeanContextChildPeer()Gets the BeanContextChild associated with this BeanContextChildSupport.protected voidinitializeBeanContextResources()This method may be overridden by subclasses to provide their own initialization behaviors.booleanisDelegated()Reports whether or not this class is a delegate of another.protected voidreleaseBeanContextResources()This method may be overridden by subclasses to provide their own release behaviors.voidremovePropertyChangeListener(String name, PropertyChangeListener pcl)Remove a PropertyChangeListener for a specific property.voidremoveVetoableChangeListener(String name, VetoableChangeListener vcl)Removes aVetoableChangeListener.voidserviceAvailable(BeanContextServiceAvailableEvent bcsae)A new service is available from the nesting BeanContext.voidserviceRevoked(BeanContextServiceRevokedEvent bcsre)A service provided by the nesting BeanContext has been revoked.voidsetBeanContext(BeanContext bc)Sets theBeanContextfor thisBeanContextChildSupport.booleanvalidatePendingSetBeanContext(BeanContext newValue)Called from setBeanContext to validate (or otherwise) the pending change in the nesting BeanContext property value.
-
-
-
Field Detail
-
beanContextChildPeer
public BeanContextChild beanContextChildPeer
TheBeanContextin which thisBeanContextChildis nested.
-
pcSupport
protected PropertyChangeSupport pcSupport
The PropertyChangeSupport associated with this BeanContextChildSupport.
-
vcSupport
protected VetoableChangeSupport vcSupport
The VetoableChangeSupport associated with this BeanContextChildSupport.
-
beanContext
protected transient BeanContext beanContext
-
rejectedSetBCOnce
protected transient boolean rejectedSetBCOnce
A flag indicating that there has been at least onePropertyChangeVetoExceptionthrown for the attempted setBeanContext operation.
-
-
Constructor Detail
-
BeanContextChildSupport
public BeanContextChildSupport()
construct a BeanContextChildSupport where this class has been subclassed in order to implement the JavaBean component itself.
-
BeanContextChildSupport
public BeanContextChildSupport(BeanContextChild bcc)
construct a BeanContextChildSupport where the JavaBean component itself implements BeanContextChild, and encapsulates this, delegating that interface to this implementation
-
-
Method Detail
-
setBeanContext
public void setBeanContext(BeanContext bc) throws PropertyVetoException
Sets theBeanContextfor thisBeanContextChildSupport.- Specified by:
setBeanContextin interfaceBeanContextChild- Parameters:
bc- the new value to be assigned to theBeanContextproperty- Throws:
- if the change is rejectedPropertyVetoExceptionPropertyVetoException
-
getBeanContext
public BeanContext getBeanContext()
Gets the nestingBeanContextfor thisBeanContextChildSupport.- Specified by:
getBeanContextin interfaceBeanContextChild- Returns:
- the nesting
BeanContextfor thisBeanContextChildSupport.
-
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. Ifnameorpclis null, no exception is thrown and no action is taken.- Specified by:
addPropertyChangeListenerin interfaceBeanContextChild- Parameters:
name- The name of the property to listen onpcl- ThePropertyChangeListenerto be added
-
removePropertyChangeListener
public void removePropertyChangeListener(String name, PropertyChangeListener pcl)
Remove a PropertyChangeListener for a specific property. Ifpclwas added more than once to the same event source for the specified property, it will be notified one less time after being removed. Ifnameis null, no exception is thrown and no action is taken. Ifpclis null, or was never added for the specified property, no exception is thrown and no action is taken.- Specified by:
removePropertyChangeListenerin interfaceBeanContextChild- Parameters:
name- The name of the property that was listened onpcl- The PropertyChangeListener to be removed
-
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. Ifnameorvclis null, no exception is thrown and no action is taken.- Specified by:
addVetoableChangeListenerin interfaceBeanContextChild- Parameters:
name- The name of the property to listen onvcl- TheVetoableChangeListenerto be added
-
removeVetoableChangeListener
public void removeVetoableChangeListener(String name, VetoableChangeListener vcl)
Removes aVetoableChangeListener. Ifpclwas added more than once to the same event source for the specified property, it will be notified one less time after being removed. Ifnameis null, no exception is thrown and no action is taken. Ifvclis null, or was never added for the specified property, no exception is thrown and no action is taken.- Specified by:
removeVetoableChangeListenerin interfaceBeanContextChild- Parameters:
name- The name of the property that was listened onvcl- TheVetoableChangeListenerto be removed
-
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:
serviceRevokedin interfaceBeanContextServiceRevokedListener- Parameters:
bcsre- TheBeanContextServiceRevokedEventfired as a result of a service being revoked
-
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:
serviceAvailablein interfaceBeanContextServicesListener- Parameters:
bcsae- The BeanContextServiceAvailableEvent fired as a result of a service becoming available
-
getBeanContextChildPeer
public BeanContextChild getBeanContextChildPeer()
Gets the BeanContextChild associated with this BeanContextChildSupport.- Returns:
- the BeanContextChild peer of this class
-
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
-
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 changedoldValue- The old value of the propertynewValue- 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 changeoldValue- The old value of the propertynewValue- - The new value of the property- Throws:
PropertyVetoException- if the recipient wishes the property change to be rolled back.
-
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:
trueif the change operation is to be vetoed
-
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.
-
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.
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
04/10/2025 07:48:47 Cette version de la page est en cache (à la date du 04/10/2025 07:48:47) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 26/09/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/beans/beancontext/beancontextchildsupport.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.