BeanContextSupport (Java Platform SE 6) (original) (raw)



java.beans.beancontext

Class BeanContextSupport

java.lang.Object extended by java.beans.beancontext.BeanContextChildSupport extended by java.beans.beancontext.BeanContextSupport

All Implemented Interfaces:

BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, DesignMode, PropertyChangeListener, VetoableChangeListener, Visibility, Serializable, Iterable, Collection, EventListener

Direct Known Subclasses:

BeanContextServicesSupport


public class BeanContextSupport

extends BeanContextChildSupport

implements BeanContext, Serializable, PropertyChangeListener, VetoableChangeListener

This helper class provides a utility implementation of the java.beans.beancontext.BeanContext interface.

Since this class directly implements the BeanContext interface, the class can, and is intended to be used either by subclassing this implementation, or via ad-hoc delegation of an instance of this class from another.

Since:

1.2

See Also:

Serialized Form


Nested Class Summary
protected class BeanContextSupport.BCSChild
protected static class BeanContextSupport.BCSIterator protected final subclass that encapsulates an iterator but implements a noop remove() method.
Field Summary
protected ArrayList bcmListeners all accesses to the protected ArrayList bcmListeners field shall be synchronized on that object.
protected HashMap children all accesses to the protected HashMap children field shall be synchronized on that object.
protected boolean designTime A boolean indicating whether or not this object is currently in design time mode.
protected Locale locale The current locale of this BeanContext.
protected boolean okToUseGui A boolean indicating if this instance may now render a GUI.
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
Fields inherited from interface java.beans.beancontext.BeanContext
globalHierarchyLock
Fields inherited from interface java.beans.DesignMode
PROPERTYNAME
Constructor Summary
BeanContextSupport() Create an instance that is not a delegate of another object
BeanContextSupport(BeanContext peer) Create an instance using with a default locale
[BeanContextSupport](../../../java/beans/beancontext/BeanContextSupport.html#BeanContextSupport%28java.beans.beancontext.BeanContext, java.util.Locale%29)(BeanContext peer,Locale lcle) Create an instance using the specified locale
[BeanContextSupport](../../../java/beans/beancontext/BeanContextSupport.html#BeanContextSupport%28java.beans.beancontext.BeanContext, java.util.Locale, boolean%29)(BeanContext peer,Locale lcle, boolean dtime) Create an instance using the specified Locale and design mode.
[BeanContextSupport](../../../java/beans/beancontext/BeanContextSupport.html#BeanContextSupport%28java.beans.beancontext.BeanContext, java.util.Locale, boolean, boolean%29)(BeanContext peer,Locale lcle, boolean dTime, boolean visible) Construct a BeanContextSupport instance
Method Summary
boolean add(Object targetChild) Adds/nests a child within this BeanContext.
boolean addAll(Collection c) add Collection to set of Children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field
void addBeanContextMembershipListener(BeanContextMembershipListener bcml) Adds a BeanContextMembershipListener
boolean avoidingGui() Used to determine if the BeanContext child is avoiding using its GUI.
protected Iterator bcsChildren() Returns an iterator of all children of this BeanContext.
protected void bcsPreDeserializationHook(ObjectInputStream ois) called by readObject after defaultReadObject() but prior to deserialization of any children.
protected void bcsPreSerializationHook(ObjectOutputStream oos) called by writeObject after defaultWriteObject() but prior to serialization of currently serializable children.
protected void [childDeserializedHook](../../../java/beans/beancontext/BeanContextSupport.html#childDeserializedHook%28java.lang.Object, java.beans.beancontext.BeanContextSupport.BCSChild%29)(Object child,BeanContextSupport.BCSChild bcsc) Called by readObject with the newly deserialized child and BCSChild.
protected void [childJustAddedHook](../../../java/beans/beancontext/BeanContextSupport.html#childJustAddedHook%28java.lang.Object, java.beans.beancontext.BeanContextSupport.BCSChild%29)(Object child,BeanContextSupport.BCSChild bcsc) subclasses may override this method to simply extend add() semantics after the child has been added and before the event notification has occurred.
protected void [childJustRemovedHook](../../../java/beans/beancontext/BeanContextSupport.html#childJustRemovedHook%28java.lang.Object, java.beans.beancontext.BeanContextSupport.BCSChild%29)(Object child,BeanContextSupport.BCSChild bcsc) subclasses may override this method to simply extend remove() semantics after the child has been removed and before the event notification has occurred.
protected static boolean [classEquals](../../../java/beans/beancontext/BeanContextSupport.html#classEquals%28java.lang.Class, java.lang.Class%29)(Class first,Class second) Tests to see if two class objects, or their names are equal.
void clear() clear the children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field
boolean contains(Object o) Determines whether or not the specified object is currently a child of this BeanContext.
boolean containsAll(Collection c) Tests to see if all objects in the specified Collection are children of this BeanContext.
boolean containsKey(Object o) Determines whether or not the specified object is currently a child of this BeanContext.
protected Object[] copyChildren() Gets a copy of the this BeanContext's children.
protected BeanContextSupport.BCSChild [createBCSChild](../../../java/beans/beancontext/BeanContextSupport.html#createBCSChild%28java.lang.Object, java.lang.Object%29)(Object targetChild,Object peer) Subclasses can override this method to insert their own subclass of Child without having to override add() or the other Collection methods that add children to the set.
protected void [deserialize](../../../java/beans/beancontext/BeanContextSupport.html#deserialize%28java.io.ObjectInputStream, java.util.Collection%29)(ObjectInputStream ois,Collection coll) used by readObject to deserialize a collection.
void dontUseGui() notify this instance that it may no longer render a GUI.
protected void fireChildrenAdded(BeanContextMembershipEvent bcme) Fire a BeanContextshipEvent on the BeanContextMembershipListener interface
protected void fireChildrenRemoved(BeanContextMembershipEvent bcme) Fire a BeanContextshipEvent on the BeanContextMembershipListener interface
BeanContext getBeanContextPeer() Gets the instance of BeanContext that this object is providing the implementation for.
protected static BeanContextChild getChildBeanContextChild(Object child) Gets the BeanContextChild (if any) of the specified child
protected static BeanContextMembershipListener getChildBeanContextMembershipListener(Object child) Gets the BeanContextMembershipListener (if any) of the specified child
protected static PropertyChangeListener getChildPropertyChangeListener(Object child) Gets the PropertyChangeListener (if any) of the specified child
protected static Serializable getChildSerializable(Object child) Gets the Serializable (if any) associated with the specified Child
protected static VetoableChangeListener getChildVetoableChangeListener(Object child) Gets the VetoableChangeListener (if any) of the specified child
protected static Visibility getChildVisibility(Object child) Gets the Component (if any) associated with the specified child.
Locale getLocale() Gets the locale for this BeanContext.
URL [getResource](../../../java/beans/beancontext/BeanContextSupport.html#getResource%28java.lang.String, java.beans.beancontext.BeanContextChild%29)(String name,BeanContextChild bcc) Analagous to java.lang.ClassLoader.getResource(), this method allows a BeanContext implementation to interpose behavior between the child Component and underlying ClassLoader.
InputStream [getResourceAsStream](../../../java/beans/beancontext/BeanContextSupport.html#getResourceAsStream%28java.lang.String, java.beans.beancontext.BeanContextChild%29)(String name,BeanContextChild bcc) Analagous to java.lang.ClassLoader.getResourceAsStream(), this method allows a BeanContext implementation to interpose behavior between the child Component and underlying ClassLoader.
protected void initialize() protected method called from constructor and readObject to initialize transient state of BeanContextSupport instance.
Object instantiateChild(String beanName) The instantiateChild method is a convenience hook in BeanContext to simplify the task of instantiating a Bean, nested, into a BeanContext.
boolean isDesignTime() Reports whether or not this object is in currently in design time mode.
boolean isEmpty() Reports whether or not this BeanContext is empty.
boolean isSerializing() Is this BeanContext in the process of being serialized?
Iterator iterator() Gets all JavaBean or BeanContext instances currently nested in this BeanContext.
boolean needsGui() This method is typically called from the environment in order to determine if the implementor "needs" a GUI.
void okToUseGui() Notify this instance that it may now render a GUI
void propertyChange(PropertyChangeEvent pce) subclasses may envelope to monitor child property changes.
void readChildren(ObjectInputStream ois) When an instance of this class is used as a delegate for the implementation of the BeanContext protocols (and its subprotocols) there exists a 'chicken and egg' problem during deserialization
boolean remove(Object targetChild) Removes a child from this BeanContext.
protected boolean [remove](../../../java/beans/beancontext/BeanContextSupport.html#remove%28java.lang.Object, boolean%29)(Object targetChild, boolean callChildSetBC) internal remove used when removal caused by unexpected setBeanContext or by remove() invocation.
boolean removeAll(Collection c) remove all specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field
void removeBeanContextMembershipListener(BeanContextMembershipListener bcml) Removes a BeanContextMembershipListener
boolean retainAll(Collection c) retain only specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field
protected void [serialize](../../../java/beans/beancontext/BeanContextSupport.html#serialize%28java.io.ObjectOutputStream, java.util.Collection%29)(ObjectOutputStream oos,Collection coll) Used by writeObject to serialize a Collection.
void setDesignTime(boolean dTime) Sets the new design time value for this BeanContext.
void setLocale(Locale newLocale) Sets the locale of this BeanContext.
int size() Gets the number of children currently nested in this BeanContext.
Object[] toArray() Gets all JavaBean or BeanContext instances currently nested in this BeanContext.
Object[] toArray(Object[] arry) Gets an array containing all children of this BeanContext that match the types contained in arry.
protected boolean validatePendingAdd(Object targetChild) Subclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being added to the BeanContext.
protected boolean validatePendingRemove(Object targetChild) Subclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being removed from the BeanContext.
void vetoableChange(PropertyChangeEvent pce) subclasses may envelope to monitor veto child property changes.
void writeChildren(ObjectOutputStream oos) Used to serialize all children of this BeanContext.
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
[addPropertyChangeListener](../../../java/beans/beancontext/BeanContextChildSupport.html#addPropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), [addVetoableChangeListener](../../../java/beans/beancontext/BeanContextChildSupport.html#addVetoableChangeListener%28java.lang.String, java.beans.VetoableChangeListener%29), [firePropertyChange](../../../java/beans/beancontext/BeanContextChildSupport.html#firePropertyChange%28java.lang.String, java.lang.Object, java.lang.Object%29), [fireVetoableChange](../../../java/beans/beancontext/BeanContextChildSupport.html#fireVetoableChange%28java.lang.String, java.lang.Object, java.lang.Object%29), getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, [removePropertyChangeListener](../../../java/beans/beancontext/BeanContextChildSupport.html#removePropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), [removeVetoableChangeListener](../../../java/beans/beancontext/BeanContextChildSupport.html#removeVetoableChangeListener%28java.lang.String, java.beans.VetoableChangeListener%29), serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, [wait](../../../java/lang/Object.html#wait%28long, int%29)
Methods inherited from interface java.beans.beancontext.BeanContextChild
[addPropertyChangeListener](../../../java/beans/beancontext/BeanContextChild.html#addPropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), [addVetoableChangeListener](../../../java/beans/beancontext/BeanContextChild.html#addVetoableChangeListener%28java.lang.String, java.beans.VetoableChangeListener%29), getBeanContext, [removePropertyChangeListener](../../../java/beans/beancontext/BeanContextChild.html#removePropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), [removeVetoableChangeListener](../../../java/beans/beancontext/BeanContextChild.html#removeVetoableChangeListener%28java.lang.String, java.beans.VetoableChangeListener%29), setBeanContext
Methods inherited from interface java.util.Collection
equals, hashCode
Field Detail

children

protected transient HashMap children

all accesses to the protected HashMap children field shall be synchronized on that object.


bcmListeners

protected transient ArrayList bcmListeners

all accesses to the protected ArrayList bcmListeners field shall be synchronized on that object.


locale

protected Locale locale

The current locale of this BeanContext.


okToUseGui

protected boolean okToUseGui

A boolean indicating if this instance may now render a GUI.


designTime

protected boolean designTime

A boolean indicating whether or not this object is currently in design time mode.

Constructor Detail

BeanContextSupport

public BeanContextSupport(BeanContext peer, Locale lcle, boolean dTime, boolean visible)

Construct a BeanContextSupport instance

Parameters:

peer - The peer BeanContext we are supplying an implementation for, or null if this object is its own peer

lcle - The current Locale for this BeanContext. If lcle is null, the default locale is assigned to the BeanContext instance.

dTime - The initial state, true if in design mode, false if runtime.

visible - The initial visibility.

See Also:

Locale.getDefault(), Locale.setDefault(java.util.Locale)


BeanContextSupport

public BeanContextSupport(BeanContext peer, Locale lcle, boolean dtime)

Create an instance using the specified Locale and design mode.

Parameters:

peer - The peer BeanContext we are supplying an implementation for, or null if this object is its own peer

lcle - The current Locale for this BeanContext. If lcle is null, the default locale is assigned to the BeanContext instance.

dtime - The initial state, true if in design mode, false if runtime.

See Also:

Locale.getDefault(), Locale.setDefault(java.util.Locale)


BeanContextSupport

public BeanContextSupport(BeanContext peer, Locale lcle)

Create an instance using the specified locale

Parameters:

peer - The peer BeanContext we are supplying an implementation for, or null if this object is its own peer

lcle - The current Locale for this BeanContext. If lcle is null, the default locale is assigned to the BeanContext instance.

See Also:

Locale.getDefault(), Locale.setDefault(java.util.Locale)


BeanContextSupport

public BeanContextSupport(BeanContext peer)

Create an instance using with a default locale

Parameters:

peer - The peer BeanContext we are supplying an implementation for, or null if this object is its own peer


BeanContextSupport

public BeanContextSupport()

Create an instance that is not a delegate of another object

Method Detail

getBeanContextPeer

public BeanContext getBeanContextPeer()

Gets the instance of BeanContext that this object is providing the implementation for.

Returns:

the BeanContext instance


instantiateChild

public Object instantiateChild(String beanName) throws IOException, ClassNotFoundException

The instantiateChild method is a convenience hook in BeanContext to simplify the task of instantiating a Bean, nested, into a BeanContext.

The semantics of the beanName parameter are defined by java.beans.Beans.instantate.

Specified by:

[instantiateChild](../../../java/beans/beancontext/BeanContext.html#instantiateChild%28java.lang.String%29) in interface [BeanContext](../../../java/beans/beancontext/BeanContext.html "interface in java.beans.beancontext")

Parameters:

beanName - the name of the Bean to instantiate within this BeanContext

Returns:

the new object

Throws:

[IOException](../../../java/io/IOException.html "class in java.io") - if there is an I/O error when the bean is being deserialized

[ClassNotFoundException](../../../java/lang/ClassNotFoundException.html "class in java.lang") - if the class identified by the beanName parameter is not found


size

public int size()

Gets the number of children currently nested in this BeanContext.

Specified by:

[size](../../../java/util/Collection.html#size%28%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Returns:

number of children


isEmpty

public boolean isEmpty()

Reports whether or not this BeanContext is empty. A BeanContext is considered empty when it contains zero nested children.

Specified by:

[isEmpty](../../../java/util/Collection.html#isEmpty%28%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Returns:

if there are not children


contains

public boolean contains(Object o)

Determines whether or not the specified object is currently a child of this BeanContext.

Specified by:

[contains](../../../java/util/Collection.html#contains%28java.lang.Object%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

o - the Object in question

Returns:

if this object is a child


containsKey

public boolean containsKey(Object o)

Determines whether or not the specified object is currently a child of this BeanContext.

Parameters:

o - the Object in question

Returns:

if this object is a child


iterator

public Iterator iterator()

Gets all JavaBean or BeanContext instances currently nested in this BeanContext.

Specified by:

[iterator](../../../java/lang/Iterable.html#iterator%28%29) in interface [Iterable](../../../java/lang/Iterable.html "interface in java.lang")

Specified by:

[iterator](../../../java/util/Collection.html#iterator%28%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Returns:

an Iterator of the nested children


toArray

public Object[] toArray()

Gets all JavaBean or BeanContext instances currently nested in this BeanContext.

Specified by:

[toArray](../../../java/util/Collection.html#toArray%28%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Returns:

an array containing all of the elements in this collection


toArray

public Object[] toArray(Object[] arry)

Gets an array containing all children of this BeanContext that match the types contained in arry.

Specified by:

[toArray](../../../java/util/Collection.html#toArray%28T[]%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

arry - The array of object types that are of interest.

Returns:

an array of children


createBCSChild

protected BeanContextSupport.BCSChild createBCSChild(Object targetChild, Object peer)

Subclasses can override this method to insert their own subclass of Child without having to override add() or the other Collection methods that add children to the set.

Parameters:

targetChild - the child to create the Child on behalf of

peer - the peer if the tragetChild and the peer are related by an implementation of BeanContextProxy


add

public boolean add(Object targetChild)

Adds/nests a child within this BeanContext.

Invoked as a side effect of java.beans.Beans.instantiate(). If the child object is not valid for adding then this method throws an IllegalStateException.

Specified by:

[add](../../../java/util/Collection.html#add%28E%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

targetChild - The child objects to nest within this BeanContext

Returns:

true if the child was added successfully.

See Also:

validatePendingAdd(java.lang.Object)


remove

public boolean remove(Object targetChild)

Removes a child from this BeanContext. If the child object is not for adding then this method throws an IllegalStateException.

Specified by:

[remove](../../../java/util/Collection.html#remove%28java.lang.Object%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

targetChild - The child objects to remove

Returns:

true if an element was removed as a result of this call

See Also:

validatePendingRemove(java.lang.Object)


remove

protected boolean remove(Object targetChild, boolean callChildSetBC)

internal remove used when removal caused by unexpected setBeanContext or by remove() invocation.

Parameters:

targetChild - the JavaBean, BeanContext, or Object to be removed

callChildSetBC - used to indicate that the child should be notified that it is no longer nested in this BeanContext.


containsAll

public boolean containsAll(Collection c)

Tests to see if all objects in the specified Collection are children of this BeanContext.

Specified by:

[containsAll](../../../java/util/Collection.html#containsAll%28java.util.Collection%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

c - the specified Collection

Returns:

true if all objects in the collection are children of this BeanContext, false if not.

See Also:

Collection.contains(Object)


addAll

public boolean addAll(Collection c)

add Collection to set of Children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field

Specified by:

[addAll](../../../java/util/Collection.html#addAll%28java.util.Collection%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

c - collection containing elements to be added to this collection

Returns:

true if this collection changed as a result of the call

Throws:

[UnsupportedOperationException](../../../java/lang/UnsupportedOperationException.html "class in java.lang")

See Also:

Collection.add(Object)


removeAll

public boolean removeAll(Collection c)

remove all specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field

Specified by:

[removeAll](../../../java/util/Collection.html#removeAll%28java.util.Collection%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

c - collection containing elements to be removed from this collection

Returns:

true if this collection changed as a result of the call

Throws:

[UnsupportedOperationException](../../../java/lang/UnsupportedOperationException.html "class in java.lang")

See Also:

Collection.remove(Object), Collection.contains(Object)


retainAll

public boolean retainAll(Collection c)

retain only specified children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field

Specified by:

[retainAll](../../../java/util/Collection.html#retainAll%28java.util.Collection%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Parameters:

c - collection containing elements to be retained in this collection

Returns:

true if this collection changed as a result of the call

Throws:

[UnsupportedOperationException](../../../java/lang/UnsupportedOperationException.html "class in java.lang")

See Also:

Collection.remove(Object), Collection.contains(Object)


clear

public void clear()

clear the children (Unsupported) implementations must synchronized on the hierarchy lock and "children" protected field

Specified by:

[clear](../../../java/util/Collection.html#clear%28%29) in interface [Collection](../../../java/util/Collection.html "interface in java.util")

Throws:

[UnsupportedOperationException](../../../java/lang/UnsupportedOperationException.html "class in java.lang")


addBeanContextMembershipListener

public void addBeanContextMembershipListener(BeanContextMembershipListener bcml)

Adds a BeanContextMembershipListener

Specified by:

[addBeanContextMembershipListener](../../../java/beans/beancontext/BeanContext.html#addBeanContextMembershipListener%28java.beans.beancontext.BeanContextMembershipListener%29) in interface [BeanContext](../../../java/beans/beancontext/BeanContext.html "interface in java.beans.beancontext")

Parameters:

bcml - the BeanContextMembershipListener to add

Throws:

[NullPointerException](../../../java/lang/NullPointerException.html "class in java.lang")


removeBeanContextMembershipListener

public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)

Removes a BeanContextMembershipListener

Specified by:

[removeBeanContextMembershipListener](../../../java/beans/beancontext/BeanContext.html#removeBeanContextMembershipListener%28java.beans.beancontext.BeanContextMembershipListener%29) in interface [BeanContext](../../../java/beans/beancontext/BeanContext.html "interface in java.beans.beancontext")

Parameters:

bcml - the BeanContextMembershipListener to remove

Throws:

[NullPointerException](../../../java/lang/NullPointerException.html "class in java.lang")


getResourceAsStream

public InputStream getResourceAsStream(String name, BeanContextChild bcc)

Description copied from interface: [BeanContext](../../../java/beans/beancontext/BeanContext.html#getResourceAsStream%28java.lang.String, java.beans.beancontext.BeanContextChild%29)

Analagous to java.lang.ClassLoader.getResourceAsStream(), this method allows a BeanContext implementation to interpose behavior between the child Component and underlying ClassLoader.

Specified by:

[getResourceAsStream](../../../java/beans/beancontext/BeanContext.html#getResourceAsStream%28java.lang.String, java.beans.beancontext.BeanContextChild%29) in interface [BeanContext](../../../java/beans/beancontext/BeanContext.html "interface in java.beans.beancontext")

Parameters:

name - the name of the resource requested.

bcc - the child object making the request.

Returns:

the requested resource as an InputStream

Throws:

[NullPointerException](../../../java/lang/NullPointerException.html "class in java.lang")


getResource

public URL getResource(String name, BeanContextChild bcc)

Description copied from interface: [BeanContext](../../../java/beans/beancontext/BeanContext.html#getResource%28java.lang.String, java.beans.beancontext.BeanContextChild%29)

Analagous to java.lang.ClassLoader.getResource(), this method allows a BeanContext implementation to interpose behavior between the child Component and underlying ClassLoader.

Specified by:

[getResource](../../../java/beans/beancontext/BeanContext.html#getResource%28java.lang.String, java.beans.beancontext.BeanContextChild%29) in interface [BeanContext](../../../java/beans/beancontext/BeanContext.html "interface in java.beans.beancontext")

Parameters:

name - the name of the resource requested.

bcc - the child object making the request.

Returns:

the requested resource as an InputStream


setDesignTime

public void setDesignTime(boolean dTime)

Sets the new design time value for this BeanContext.

Specified by:

[setDesignTime](../../../java/beans/DesignMode.html#setDesignTime%28boolean%29) in interface [DesignMode](../../../java/beans/DesignMode.html "interface in java.beans")

Parameters:

dTime - the new designTime value

See Also:

BeanContext, BeanContextMembershipListener, PropertyChangeEvent


isDesignTime

public boolean isDesignTime()

Reports whether or not this object is in currently in design time mode.

Specified by:

[isDesignTime](../../../java/beans/DesignMode.html#isDesignTime%28%29) in interface [DesignMode](../../../java/beans/DesignMode.html "interface in java.beans")

Returns:

true if in design time mode, false if not


setLocale

public void setLocale(Locale newLocale) throws PropertyVetoException

Sets the locale of this BeanContext.

Parameters:

newLocale - the new locale. This method call will have no effect if newLocale is null.

Throws:

[PropertyVetoException](../../../java/beans/PropertyVetoException.html "class in java.beans") - if the new value is rejected


getLocale

public Locale getLocale()

Gets the locale for this BeanContext.

Returns:

the current Locale of the BeanContext


needsGui

public boolean needsGui()

This method is typically called from the environment in order to determine if the implementor "needs" a GUI.

The algorithm used herein tests the BeanContextPeer, and its current children to determine if they are either Containers, Components, or if they implement Visibility and return needsGui() == true.

Specified by:

[needsGui](../../../java/beans/Visibility.html#needsGui%28%29) in interface [Visibility](../../../java/beans/Visibility.html "interface in java.beans")

Returns:

true if the implementor needs a GUI


dontUseGui

public void dontUseGui()

notify this instance that it may no longer render a GUI.

Specified by:

[dontUseGui](../../../java/beans/Visibility.html#dontUseGui%28%29) in interface [Visibility](../../../java/beans/Visibility.html "interface in java.beans")


okToUseGui

public void okToUseGui()

Notify this instance that it may now render a GUI

Specified by:

[okToUseGui](../../../java/beans/Visibility.html#okToUseGui%28%29) in interface [Visibility](../../../java/beans/Visibility.html "interface in java.beans")


avoidingGui

public boolean avoidingGui()

Used to determine if the BeanContext child is avoiding using its GUI.

Specified by:

[avoidingGui](../../../java/beans/Visibility.html#avoidingGui%28%29) in interface [Visibility](../../../java/beans/Visibility.html "interface in java.beans")

Returns:

is this instance avoiding using its GUI?

See Also:

Visibility


isSerializing

public boolean isSerializing()

Is this BeanContext in the process of being serialized?

Returns:

if this BeanContext is currently being serialized


bcsChildren

protected Iterator bcsChildren()

Returns an iterator of all children of this BeanContext.

Returns:

an iterator for all the current BCSChild values


bcsPreSerializationHook

protected void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException

called by writeObject after defaultWriteObject() but prior to serialization of currently serializable children. This method may be overridden by subclasses to perform custom serialization of their state prior to this superclass serializing the children. This method should not however be used by subclasses to replace their own implementation (if any) of writeObject().

Throws:

[IOException](../../../java/io/IOException.html "class in java.io")


bcsPreDeserializationHook

protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException

called by readObject after defaultReadObject() but prior to deserialization of any children. This method may be overridden by subclasses to perform custom deserialization of their state prior to this superclass deserializing the children. This method should not however be used by subclasses to replace their own implementation (if any) of readObject().

Throws:

[IOException](../../../java/io/IOException.html "class in java.io")

[ClassNotFoundException](../../../java/lang/ClassNotFoundException.html "class in java.lang")


childDeserializedHook

protected void childDeserializedHook(Object child, BeanContextSupport.BCSChild bcsc)

Called by readObject with the newly deserialized child and BCSChild.

Parameters:

child - the newly deserialized child

bcsc - the newly deserialized BCSChild


serialize

protected final void serialize(ObjectOutputStream oos, Collection coll) throws IOException

Used by writeObject to serialize a Collection.

Parameters:

oos - the ObjectOutputStream to use during serialization

coll - the Collection to serialize

Throws:

[IOException](../../../java/io/IOException.html "class in java.io") - if serialization failed


deserialize

protected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException, ClassNotFoundException

used by readObject to deserialize a collection.

Parameters:

ois - the ObjectInputStream to use

coll - the Collection

Throws:

[IOException](../../../java/io/IOException.html "class in java.io")

[ClassNotFoundException](../../../java/lang/ClassNotFoundException.html "class in java.lang")


writeChildren

public final void writeChildren(ObjectOutputStream oos) throws IOException

Used to serialize all children of this BeanContext.

Parameters:

oos - the ObjectOutputStream to use during serialization

Throws:

[IOException](../../../java/io/IOException.html "class in java.io") - if serialization failed


readChildren

public final void readChildren(ObjectInputStream ois) throws IOException, ClassNotFoundException

When an instance of this class is used as a delegate for the implementation of the BeanContext protocols (and its subprotocols) there exists a 'chicken and egg' problem during deserialization

Throws:

[IOException](../../../java/io/IOException.html "class in java.io")

[ClassNotFoundException](../../../java/lang/ClassNotFoundException.html "class in java.lang")


vetoableChange

public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException

subclasses may envelope to monitor veto child property changes.

Specified by:

[vetoableChange](../../../java/beans/VetoableChangeListener.html#vetoableChange%28java.beans.PropertyChangeEvent%29) in interface [VetoableChangeListener](../../../java/beans/VetoableChangeListener.html "interface in java.beans")

Parameters:

pce - a PropertyChangeEvent object describing the event source and the property that has changed.

Throws:

[PropertyVetoException](../../../java/beans/PropertyVetoException.html "class in java.beans") - if the recipient wishes the property change to be rolled back.


propertyChange

public void propertyChange(PropertyChangeEvent pce)

subclasses may envelope to monitor child property changes.

Specified by:

[propertyChange](../../../java/beans/PropertyChangeListener.html#propertyChange%28java.beans.PropertyChangeEvent%29) in interface [PropertyChangeListener](../../../java/beans/PropertyChangeListener.html "interface in java.beans")

Parameters:

pce - A PropertyChangeEvent object describing the event source and the property that has changed.


validatePendingAdd

protected boolean validatePendingAdd(Object targetChild)

Subclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being added to the BeanContext.

Returns:

true iff the child may be added to this BeanContext, otherwise false.


validatePendingRemove

protected boolean validatePendingRemove(Object targetChild)

Subclasses of this class may override, or envelope, this method to add validation behavior for the BeanContext to examine child objects immediately prior to their being removed from the BeanContext.

Returns:

true iff the child may be removed from this BeanContext, otherwise false.


childJustAddedHook

protected void childJustAddedHook(Object child, BeanContextSupport.BCSChild bcsc)

subclasses may override this method to simply extend add() semantics after the child has been added and before the event notification has occurred. The method is called with the child synchronized.


childJustRemovedHook

protected void childJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc)

subclasses may override this method to simply extend remove() semantics after the child has been removed and before the event notification has occurred. The method is called with the child synchronized.


getChildVisibility

protected static final Visibility getChildVisibility(Object child)

Gets the Component (if any) associated with the specified child.

Parameters:

child - the specified child

Returns:

the Component (if any) associated with the specified child.


getChildSerializable

protected static final Serializable getChildSerializable(Object child)

Gets the Serializable (if any) associated with the specified Child

Parameters:

child - the specified child

Returns:

the Serializable (if any) associated with the specified Child


getChildPropertyChangeListener

protected static final PropertyChangeListener getChildPropertyChangeListener(Object child)

Gets the PropertyChangeListener (if any) of the specified child

Parameters:

child - the specified child

Returns:

the PropertyChangeListener (if any) of the specified child


getChildVetoableChangeListener

protected static final VetoableChangeListener getChildVetoableChangeListener(Object child)

Gets the VetoableChangeListener (if any) of the specified child

Parameters:

child - the specified child

Returns:

the VetoableChangeListener (if any) of the specified child


getChildBeanContextMembershipListener

protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object child)

Gets the BeanContextMembershipListener (if any) of the specified child

Parameters:

child - the specified child

Returns:

the BeanContextMembershipListener (if any) of the specified child


getChildBeanContextChild

protected static final BeanContextChild getChildBeanContextChild(Object child)

Gets the BeanContextChild (if any) of the specified child

Parameters:

child - the specified child

Returns:

the BeanContextChild (if any) of the specified child

Throws:

[IllegalArgumentException](../../../java/lang/IllegalArgumentException.html "class in java.lang") - if child implements both BeanContextChild and BeanContextProxy


fireChildrenAdded

protected final void fireChildrenAdded(BeanContextMembershipEvent bcme)

Fire a BeanContextshipEvent on the BeanContextMembershipListener interface


fireChildrenRemoved

protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme)

Fire a BeanContextshipEvent on the BeanContextMembershipListener interface


initialize

protected void initialize()

protected method called from constructor and readObject to initialize transient state of BeanContextSupport instance. This class uses this method to instantiate inner class listeners used to monitor PropertyChange and VetoableChange events on children. subclasses may envelope this method to add their own initialization behavior


copyChildren

protected final Object[] copyChildren()

Gets a copy of the this BeanContext's children.

Returns:

a copy of the current nested children


classEquals

protected static final boolean classEquals(Class first, Class second)

Tests to see if two class objects, or their names are equal.

Parameters:

first - the first object

second - the second object

Returns:

true if equal, false if not



Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

Scripting on this page tracks web page traffic, but does not change the content in any way.