Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.beans.beancontext
Class BeanContextSupport  view BeanContextSupport download BeanContextSupport.java

java.lang.Object
  extended byjava.beans.beancontext.BeanContextChildSupport
      extended byjava.beans.beancontext.BeanContextSupport
All Implemented Interfaces:
BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, java.util.Collection, java.beans.DesignMode, java.util.EventListener, java.lang.Iterable, java.beans.PropertyChangeListener, java.io.Serializable, java.beans.VetoableChangeListener, java.beans.Visibility
Direct Known Subclasses:
BeanContextServicesSupport

public class BeanContextSupport
extends BeanContextChildSupport
implements BeanContext, java.io.Serializable, java.beans.PropertyChangeListener, java.beans.VetoableChangeListener

Since:
1.2

Nested Class Summary
protected  class BeanContextSupport.BCSChild
           
protected static class BeanContextSupport.BCSIterator
           
 
Field Summary
protected  java.util.ArrayList bcmListeners
           
protected  java.util.HashMap children
           
protected  boolean designTime
           
protected  java.util.Locale locale
           
protected  boolean okToUseGui
           
private static long serialVersionUID
           
 
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()
          Construct a BeanContextSupport instance.
BeanContextSupport(BeanContext peer)
          Construct a BeanContextSupport instance.
BeanContextSupport(BeanContext peer, java.util.Locale lcle)
          Construct a BeanContextSupport instance.
BeanContextSupport(BeanContext peer, java.util.Locale lcle, boolean dtime)
          Construct a BeanContextSupport instance.
BeanContextSupport(BeanContext peer, java.util.Locale lcle, boolean dtime, boolean visible)
          Construct a BeanContextSupport instance.
 
Method Summary
 boolean add(java.lang.Object targetChild)
          Add an element to this collection.
 boolean addAll(java.util.Collection c)
          Add the contents of a given collection to this collection.
 void addBeanContextMembershipListener(BeanContextMembershipListener listener)
          Add a listener on changes to the membership of this BeanContext object.
 boolean avoidingGui()
          Tells whether Bean is trying not to use the GUI.
protected  java.util.Iterator bcsChildren()
           
protected  void bcsPreDeserializationHook(java.io.ObjectInputStream ois)
           
protected  void bcsPreSerializationHook(java.io.ObjectOutputStream oos)
           
protected  void childDeserializedHook(java.lang.Object child, BeanContextSupport.BCSChild bcsc)
           
protected  void childJustAddedHook(java.lang.Object child, BeanContextSupport.BCSChild bcsc)
           
protected  void childJustRemovedHook(java.lang.Object child, BeanContextSupport.BCSChild bcsc)
           
protected static boolean classEquals(java.lang.Class first, java.lang.Class second)
           
 void clear()
          Clear the collection, such that a subsequent call to isEmpty() would return true.
 boolean contains(java.lang.Object o)
          Test whether this collection contains a given object as one of its elements.
 boolean containsAll(java.util.Collection c)
          Test whether this collection contains every element in a given collection.
 boolean containsKey(java.lang.Object o)
           
protected  java.lang.Object[] copyChildren()
           
protected  BeanContextSupport.BCSChild createBCSChild(java.lang.Object targetChild, java.lang.Object peer)
           
protected  void deserialize(java.io.ObjectInputStream ois, java.util.Collection coll)
           
 void dontUseGui()
          Tells the Bean not to use GUI methods.
protected  void fireChildrenAdded(BeanContextMembershipEvent bcme)
           
protected  void fireChildrenRemoved(BeanContextMembershipEvent bcme)
           
 BeanContext getBeanContextPeer()
           
protected static BeanContextChild getChildBeanContextChild(java.lang.Object child)
           
protected static BeanContextMembershipListener getChildBeanContextMembershipListener(java.lang.Object child)
           
protected static java.beans.PropertyChangeListener getChildPropertyChangeListener(java.lang.Object child)
           
protected static java.io.Serializable getChildSerializable(java.lang.Object child)
           
protected static java.beans.VetoableChangeListener getChildVetoableChangeListener(java.lang.Object child)
           
protected static java.beans.Visibility getChildVisibility(java.lang.Object child)
           
 java.util.Locale getLocale()
           
 java.net.URL getResource(java.lang.String name, BeanContextChild bcc)
          Get a resource.
 java.io.InputStream getResourceAsStream(java.lang.String name, BeanContextChild bcc)
          Get a resource as a stream.
protected  void initialize()
           
 java.lang.Object instantiateChild(java.lang.String beanName)
          Instantiate a Bean using this Bean's ClassLoader and this BeanContext as the parent.
 boolean isDesignTime()
          This method should tell whether it is design time or runtime.
 boolean isEmpty()
          Test whether this collection is empty, that is, if size() == 0.
 boolean isSerializing()
           
 java.util.Iterator iterator()
          Obtain an Iterator over this collection.
 boolean needsGui()
          Tells whether the Bean can run without a GUI or not.
 void okToUseGui()
          Tells the Bean it may use the GUI.
 void propertyChange(java.beans.PropertyChangeEvent pce)
          Fired after a Bean's property has changed.
 void readChildren(java.io.ObjectInputStream ois)
           
private  void readObject(java.io.ObjectInputStream s)
           
 boolean remove(java.lang.Object targetChild)
          Remove a single occurrence of an object from this collection.
protected  boolean remove(java.lang.Object targetChild, boolean callChildSetBC)
           
 boolean removeAll(java.util.Collection c)
          Remove all elements of a given collection from this collection.
 void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)
          Remove a listener on changes to the membership of this BeanContext object.
 boolean retainAll(java.util.Collection c)
          Remove all elements of this collection that are not contained in a given collection.
protected  void serialize(java.io.ObjectOutputStream oos, java.util.Collection coll)
           
 void setDesignTime(boolean dtime)
          The environment will call this method on your BeanContextChild when it is registered in a parent BeanContext or when behavior needs to switch from design time to runtime behavior (or vice versa).
 void setLocale(java.util.Locale newLocale)
           
 int size()
          Get the number of elements in this collection.
 java.lang.Object[] toArray()
          Copy the current contents of this collection into an array.
 java.lang.Object[] toArray(java.lang.Object[] array)
          Copy the current contents of this collection into an array.
protected  boolean validatePendingAdd(java.lang.Object targetChild)
           
protected  boolean validatePendingRemove(java.lang.Object targetChild)
           
 void vetoableChange(java.beans.PropertyChangeEvent pce)
          Fired before a Bean's property changes.
 void writeChildren(java.io.ObjectOutputStream oos)
           
private  void writeObject(java.io.ObjectOutputStream s)
           
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

bcmListeners

protected transient java.util.ArrayList bcmListeners

children

protected transient java.util.HashMap children

designTime

protected transient boolean designTime

locale

protected transient java.util.Locale locale

okToUseGui

protected transient boolean okToUseGui
Constructor Detail

BeanContextSupport

public BeanContextSupport()
Construct a BeanContextSupport instance.


BeanContextSupport

public BeanContextSupport(BeanContext peer)
Construct a BeanContextSupport instance.


BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          java.util.Locale lcle)
Construct a BeanContextSupport instance.


BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          java.util.Locale lcle,
                          boolean dtime)
Construct a BeanContextSupport instance.


BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          java.util.Locale lcle,
                          boolean dtime,
                          boolean visible)
Construct a BeanContextSupport instance.

Method Detail

readObject

private void readObject(java.io.ObjectInputStream s)
                 throws java.lang.ClassNotFoundException,
                        java.io.IOException,
                        gnu.classpath.NotImplementedException

writeObject

private void writeObject(java.io.ObjectOutputStream s)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException,
                         gnu.classpath.NotImplementedException

add

public boolean add(java.lang.Object targetChild)
Description copied from interface: java.util.Collection
Add an element to this collection.

Specified by:
add in interface java.util.Collection

addAll

public boolean addAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Add the contents of a given collection to this collection.

Specified by:
addAll in interface java.util.Collection

addBeanContextMembershipListener

public void addBeanContextMembershipListener(BeanContextMembershipListener listener)
Description copied from interface: BeanContext
Add a listener on changes to the membership of this BeanContext object.

Specified by:
addBeanContextMembershipListener in interface BeanContext

avoidingGui

public boolean avoidingGui()
                    throws gnu.classpath.NotImplementedException
Description copied from interface: java.beans.Visibility
Tells whether Bean is trying not to use the GUI. If needsGui() is true, this method should always return false.

Specified by:
avoidingGui in interface java.beans.Visibility

bcsChildren

protected java.util.Iterator bcsChildren()

bcsPreDeserializationHook

protected void bcsPreDeserializationHook(java.io.ObjectInputStream ois)
                                  throws java.lang.ClassNotFoundException,
                                         java.io.IOException,
                                         gnu.classpath.NotImplementedException

bcsPreSerializationHook

protected void bcsPreSerializationHook(java.io.ObjectOutputStream oos)
                                throws java.io.IOException,
                                       gnu.classpath.NotImplementedException

childDeserializedHook

protected void childDeserializedHook(java.lang.Object child,
                                     BeanContextSupport.BCSChild bcsc)
                              throws gnu.classpath.NotImplementedException

childJustAddedHook

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

childJustRemovedHook

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

classEquals

protected static final boolean classEquals(java.lang.Class first,
                                           java.lang.Class second)

clear

public void clear()
Description copied from interface: java.util.Collection
Clear the collection, such that a subsequent call to isEmpty() would return true.

Specified by:
clear in interface java.util.Collection

contains

public boolean contains(java.lang.Object o)
Description copied from interface: java.util.Collection
Test whether this collection contains a given object as one of its elements.

Specified by:
contains in interface java.util.Collection

containsAll

public boolean containsAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Test whether this collection contains every element in a given collection.

Specified by:
containsAll in interface java.util.Collection

containsKey

public boolean containsKey(java.lang.Object o)

copyChildren

protected final java.lang.Object[] copyChildren()

createBCSChild

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

deserialize

protected final void deserialize(java.io.ObjectInputStream ois,
                                 java.util.Collection coll)
                          throws java.lang.ClassNotFoundException,
                                 java.io.IOException,
                                 gnu.classpath.NotImplementedException

dontUseGui

public void dontUseGui()
                throws gnu.classpath.NotImplementedException
Description copied from interface: java.beans.Visibility
Tells the Bean not to use GUI methods. If needsGUI() is false, then after this method is called, avoidingGui() should return true.

Specified by:
dontUseGui in interface java.beans.Visibility

fireChildrenAdded

protected final void fireChildrenAdded(BeanContextMembershipEvent bcme)

fireChildrenRemoved

protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme)

getBeanContextPeer

public BeanContext getBeanContextPeer()
                               throws gnu.classpath.NotImplementedException

getChildBeanContextChild

protected static final BeanContextChild getChildBeanContextChild(java.lang.Object child)
                                                          throws gnu.classpath.NotImplementedException

getChildBeanContextMembershipListener

protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(java.lang.Object child)
                                                                                    throws gnu.classpath.NotImplementedException

getChildPropertyChangeListener

protected static final java.beans.PropertyChangeListener getChildPropertyChangeListener(java.lang.Object child)
                                                                                 throws gnu.classpath.NotImplementedException

getChildSerializable

protected static final java.io.Serializable getChildSerializable(java.lang.Object child)
                                                          throws gnu.classpath.NotImplementedException

getChildVetoableChangeListener

protected static final java.beans.VetoableChangeListener getChildVetoableChangeListener(java.lang.Object child)
                                                                                 throws gnu.classpath.NotImplementedException

getChildVisibility

protected static final java.beans.Visibility getChildVisibility(java.lang.Object child)
                                                         throws gnu.classpath.NotImplementedException

getLocale

public java.util.Locale getLocale()

getResource

public java.net.URL getResource(java.lang.String name,
                                BeanContextChild bcc)
Description copied from interface: BeanContext
Get a resource. The BeanContext will typically call ClassLoader.getResource(), but may do it any way it wants to. This allows a BeanContext to have its own set of resources separate from the rest of the system.

Beans should call this method on their parent rather than the associated ClassLoader method.

I am assuming, but am not entirely sure, that if a BeanContext cannot find a resource, its responsibility is to call the getResource method of its parent BeanContext.

Specified by:
getResource in interface BeanContext

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String name,
                                               BeanContextChild bcc)
Description copied from interface: BeanContext
Get a resource as a stream. The BeanContext will typically call ClassLoader.getResourceAsStream(), but may do it any way it wants to. This allows a BeanContext's children to have their own set of resources separate from the rest of the system.

Beans should call this method on their parent rather than the associated ClassLoader method.

I am assuming, but am not entirely sure, that if a BeanContext cannot find a resource, its responsibility is to call the getResourceAsStream method of its parent BeanContext.

Specified by:
getResourceAsStream in interface BeanContext

initialize

protected void initialize()

instantiateChild

public java.lang.Object instantiateChild(java.lang.String beanName)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException,
                                         gnu.classpath.NotImplementedException
Description copied from interface: BeanContext
Instantiate a Bean using this Bean's ClassLoader and this BeanContext as the parent.

This method exists mainly so that BeanContext implementations can perform extra actions on Beans that are created within them.

Specified by:
instantiateChild in interface BeanContext

isDesignTime

public boolean isDesignTime()
Description copied from interface: java.beans.DesignMode
This method should tell whether it is design time or runtime.

Specified by:
isDesignTime in interface java.beans.DesignMode

isEmpty

public boolean isEmpty()
Description copied from interface: java.util.Collection
Test whether this collection is empty, that is, if size() == 0.

Specified by:
isEmpty in interface java.util.Collection

isSerializing

public boolean isSerializing()
                      throws gnu.classpath.NotImplementedException

iterator

public java.util.Iterator iterator()
Description copied from interface: java.util.Collection
Obtain an Iterator over this collection.

Specified by:
iterator in interface java.util.Collection

needsGui

public boolean needsGui()
                 throws gnu.classpath.NotImplementedException
Description copied from interface: java.beans.Visibility
Tells whether the Bean can run without a GUI or not.

Specified by:
needsGui in interface java.beans.Visibility

okToUseGui

public void okToUseGui()
                throws gnu.classpath.NotImplementedException
Description copied from interface: java.beans.Visibility
Tells the Bean it may use the GUI. The Bean is not required to use the GUI in this case, it is merely being permitted to use it. If needsGui() is false, avoidingGui() may return true or false after this method is called.

Specified by:
okToUseGui in interface java.beans.Visibility

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent pce)
                    throws gnu.classpath.NotImplementedException
Description copied from interface: java.beans.PropertyChangeListener
Fired after a Bean's property has changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

readChildren

public final void readChildren(java.io.ObjectInputStream ois)
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException,
                               gnu.classpath.NotImplementedException

remove

public boolean remove(java.lang.Object targetChild)
Description copied from interface: java.util.Collection
Remove a single occurrence of an object from this collection. That is, remove an element e, if one exists, such that o == null ? e == null : o.equals(e).

Specified by:
remove in interface java.util.Collection

remove

protected boolean remove(java.lang.Object targetChild,
                         boolean callChildSetBC)
                  throws gnu.classpath.NotImplementedException

removeAll

public boolean removeAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Remove all elements of a given collection from this collection. That is, remove every element e such that c.contains(e).

Specified by:
removeAll in interface java.util.Collection

removeBeanContextMembershipListener

public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)
Description copied from interface: BeanContext
Remove a listener on changes to the membership of this BeanContext object.

Specified by:
removeBeanContextMembershipListener in interface BeanContext

retainAll

public boolean retainAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Remove all elements of this collection that are not contained in a given collection. That is, remove every element e such that !c.contains(e).

Specified by:
retainAll in interface java.util.Collection

serialize

protected final void serialize(java.io.ObjectOutputStream oos,
                               java.util.Collection coll)
                        throws java.io.IOException,
                               gnu.classpath.NotImplementedException

setDesignTime

public void setDesignTime(boolean dtime)
Description copied from interface: java.beans.DesignMode
The environment will call this method on your BeanContextChild when it is registered in a parent BeanContext or when behavior needs to switch from design time to runtime behavior (or vice versa).

BeanContexts are required to fire PropertyChangeEvents when properties change. designTime is a property, and therefore when you implement setDesignTime(), you need to fire a PropertyChangeEvent with the old value, the new value and using PROPERTYNAME as the property name.

Specified by:
setDesignTime in interface java.beans.DesignMode

setLocale

public void setLocale(java.util.Locale newLocale)
               throws java.beans.PropertyVetoException

size

public int size()
Description copied from interface: java.util.Collection
Get the number of elements in this collection.

Specified by:
size in interface java.util.Collection

toArray

public java.lang.Object[] toArray()
Description copied from interface: java.util.Collection
Copy the current contents of this collection into an array.

Specified by:
toArray in interface java.util.Collection

toArray

public java.lang.Object[] toArray(java.lang.Object[] array)
                           throws gnu.classpath.NotImplementedException
Description copied from interface: java.util.Collection
Copy the current contents of this collection into an array. If the array passed as an argument has length less than the size of this collection, an array of the same run-time type as a, and length equal to the size of this collection, is allocated using Reflection. Otherwise, a itself is used. The elements of this collection are copied into it, and if there is space in the array, the following element is set to null. The resultant array is returned. Note: The fact that the following element is set to null is only useful if it is known that this collection does not contain any null elements.

Specified by:
toArray in interface java.util.Collection

validatePendingAdd

protected boolean validatePendingAdd(java.lang.Object targetChild)

validatePendingRemove

protected boolean validatePendingRemove(java.lang.Object targetChild)

vetoableChange

public void vetoableChange(java.beans.PropertyChangeEvent pce)
                    throws java.beans.PropertyVetoException,
                           gnu.classpath.NotImplementedException
Description copied from interface: java.beans.VetoableChangeListener
Fired before a Bean's property changes.

Specified by:
vetoableChange in interface java.beans.VetoableChangeListener

writeChildren

public final void writeChildren(java.io.ObjectOutputStream oos)
                         throws java.io.IOException,
                                gnu.classpath.NotImplementedException