| java.lang.Object java.beans.beancontext.BeanContextChildSupport java.beans.beancontext.BeanContextSupport
All known Subclasses: java.beans.beancontext.BeanContextServicesSupport,
Inner Class :protected class BCSChild implements Serializable | |
Inner Class :final protected static class BCSIterator implements Iterator | |
Field Summary | |
protected transient ArrayList | bcmListeners A list of registered membership listeners. | protected transient HashMap | children A map of children - key is child instance, value is BCSChild instance. | protected boolean | designTime A flag indicating whether this context is in design mode. | protected Locale | locale The locale of this context. | protected boolean | okToUseGui A flag indicating whether this context is allowed to use GUI. | final static long | serialVersionUID |
Method Summary | |
public boolean | add(Object child) Add a child to this context.
If the child already exists in this context, simply returns false.
Otherwise, it is validated by calling validatePendingAdd() .
If the add is valid, the child and its proxy (if the child implements
BeanContextProxy ) is then added, and setBeanContext()
is called on it (if the child implements BeanContextChild
or it has a proxy). | public boolean | addAll(Collection collection) This method is unsupported, throws UnsupportedOperationException . | public void | addBeanContextMembershipListener(BeanContextMembershipListener listener) | public boolean | avoidingGui() | protected Iterator | bcsChildren() Returns an iterator of all BCSChild instances,
with remove() disabled. | protected void | bcsPreDeserializationHook(ObjectInputStream ois) This method is called by readObject() after
defaultReadObject() and before deserializing any
children or listeners. | protected void | bcsPreSerializationHook(ObjectOutputStream oos) This method is called by writeObject() after
defaultWriteObject() and before serializing any
children or listeners. | protected void | childDeserializedHook(Object child, BCSChild bcsChild) This method is called during deserialization everytime a child is read. | protected void | childJustAddedHook(Object child, BCSChild bcsChild) This method is called everytime a child is added to this context. | protected void | childJustRemovedHook(Object child, BCSChild bcsChild) This method is called everytime a child is removed from this context. | final protected static boolean | classEquals(Class clz1, Class clz2) Compares if two classes are equal or their class names are equal. | public void | clear() This method is unsupported, throws UnsupportedOperationException . | public boolean | contains(Object child) Returns true if the given object is a child of this context. | public boolean | containsAll(Collection collection) Returns true if given objects are children of this context. | public boolean | containsKey(Object child) Returns true if the given object is a child of this context. | final protected Object[] | copyChildren() Returns an array containing all children of this context. | protected BCSChild | createBCSChild(Object child, Object proxyPeer) Creates a BCSChild object to company the given child. | final protected void | deserialize(ObjectInputStream ois, Collection collection) Deserialize a collection. | public void | dontUseGui() | final protected void | fireChildrenAdded(BeanContextMembershipEvent event) Notifies registered BeanContextMembershipListener s that
a new child has been added. | final protected void | fireChildrenRemoved(BeanContextMembershipEvent event) Notifies registered BeanContextMembershipListener s that
a child has been removed. | public BeanContext | getBeanContextPeer() Returns the peer of this context casted as BeanContext . | final protected static BeanContextChild | getChildBeanContextChild(Object child) Returns the BeanContextChild related with the given child.
If the child implements BeanContextChild , it is returned. | final protected static BeanContextMembershipListener | getChildBeanContextMembershipListener(Object child) Returns the given child casted to BeanContextMembershipListener ,
or null if it does not implements the interface. | final protected static PropertyChangeListener | getChildPropertyChangeListener(Object child) Returns the given child casted to PropertyChangeListener ,
or null if it does not implements the interface. | final protected static Serializable | getChildSerializable(Object child) Returns the given child casted to Serializable ,
or null if it does not implements the interface. | final protected static VetoableChangeListener | getChildVetoableChangeListener(Object child) Returns the given child casted to VetoableChangeListener ,
or null if it does not implements the interface. | final protected static Visibility | getChildVisibility(Object child) Returns the given child casted to Visibility ,
or null if it does not implements the interface. | public Locale | getLocale() Returns the locale of this context. | public URL | getResource(String resourceName, BeanContextChild child) | public InputStream | getResourceAsStream(String resourceName, BeanContextChild child) | protected void | initialize() Initializes all transient fields of this instance, called by
constructors and readObject() . | public Object | instantiateChild(String beanName) | public boolean | isDesignTime() | public boolean | isEmpty() | public boolean | isSerializing() Returns true if this context is currently being serialized
(by another thread). | public Iterator | iterator() Returns an iterator of children of this context,
with remove() disabled. | public boolean | needsGui() Returns true if this context or its children needs GUI to work properly. | public void | okToUseGui() | public void | propertyChange(PropertyChangeEvent event) | final public void | readChildren(ObjectInputStream ois) Deserializes children from the given object input stream.
The implementation reads pairs of child object and BCSChild
object according to serializable property. | public boolean | remove(Object child) Removes the given child from this context. | protected boolean | remove(Object child, boolean setChildBC) Removes the given child from this context.
If the given child is not a child of this context, simply returns false.
Otherwise, validatePendingRemove() is called. | public boolean | removeAll(Collection collection) This method is unsupported, throws UnsupportedOperationException . | public void | removeBeanContextMembershipListener(BeanContextMembershipListener listener) | public boolean | retainAll(Collection collection) This method is unsupported, throws UnsupportedOperationException . | final protected void | serialize(ObjectOutputStream oos, Collection collection) Serializes the given collection. | public void | setDesignTime(boolean designTime) | public void | setLocale(Locale newLocale) Sets the locale of this context. | public int | size() Returns the number children of this context. | public Object[] | toArray() Returns an array of children of this context. | public Object[] | toArray(Object[] array) Returns an array of children of this context. | protected boolean | validatePendingAdd(Object child) Validates the pending add of child. | protected boolean | validatePendingRemove(Object child) Validates the pending removal of child. | public void | vetoableChange(PropertyChangeEvent pce) | final public void | writeChildren(ObjectOutputStream oos) Serializes children to the given object input stream.
The implementation iterates through all children and writes out pairs
of child object and BCSChild object if the child is
serializable (implements Serialization .
This method is called by writeObject() if the context
works standalone. |
bcmListeners | protected transient ArrayList bcmListeners(Code) | | A list of registered membership listeners.
All access to this object should be synchronized on itself.
|
children | protected transient HashMap children(Code) | | A map of children - key is child instance, value is BCSChild instance.
All access to this object should be synchronized on itself.
|
designTime | protected boolean designTime(Code) | | A flag indicating whether this context is in design mode.
|
locale | protected Locale locale(Code) | | The locale of this context.
|
okToUseGui | protected boolean okToUseGui(Code) | | A flag indicating whether this context is allowed to use GUI.
|
serialVersionUID | final static long serialVersionUID(Code) | | |
BeanContextSupport | public BeanContextSupport()(Code) | | Constructs a standload BeanContextSupport .
|
BeanContextSupport | public BeanContextSupport(BeanContext peer)(Code) | | Constructs a BeanContextSupport which is a delegate
of the given peer.
Parameters: peer - the peer of this context |
BeanContextSupport | public BeanContextSupport(BeanContext peer, Locale locale)(Code) | | Constructs a BeanContextSupport which is a delegate
of the given peer.
Parameters: peer - the peer of this context Parameters: locale - the locale of this context |
BeanContextSupport | public BeanContextSupport(BeanContext peer, Locale locale, boolean designTime)(Code) | | Constructs a BeanContextSupport which is a delegate
of the given peer.
Parameters: peer - the peer of this context Parameters: locale - the locale of this context Parameters: designTime - whether in design mode or not |
BeanContextSupport | public BeanContextSupport(BeanContext peer, Locale locale, boolean designTime, boolean okToUseGui)(Code) | | Constructs a BeanContextSupport which is a delegate
of the given peer.
Parameters: peer - the peer of this context Parameters: locale - the locale of this context Parameters: designTime - whether in design mode or not Parameters: okToUseGui - whether GUI is usable or not |
add | public boolean add(Object child)(Code) | | Add a child to this context.
If the child already exists in this context, simply returns false.
Otherwise, it is validated by calling validatePendingAdd() .
If the add is valid, the child and its proxy (if the child implements
BeanContextProxy ) is then added, and setBeanContext()
is called on it (if the child implements BeanContextChild
or it has a proxy). Last, the childJustAddedHook() is
called and all registered BeanContextMembershipListener s
are notified.
Parameters: child - the child to add true if the child is added to this context; otherwise false throws: IllegalStateException - if the child is not valid to add See Also: java.util.Collection.add(java.lang.Object) |
avoidingGui | public boolean avoidingGui()(Code) | | |
bcsChildren | protected Iterator bcsChildren()(Code) | | Returns an iterator of all BCSChild instances,
with remove() disabled.
an iterator of all BCSChild instances |
bcsPreDeserializationHook | protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException(Code) | | This method is called by readObject() after
defaultReadObject() and before deserializing any
children or listeners. Subclass can insert its specific
deserialization behavior by overrideing this method.
The default implementation does nothing.
Parameters: ois - the object input stream throws: IOException - throws: ClassNotFoundException - |
bcsPreSerializationHook | protected void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException(Code) | | This method is called by writeObject() after
defaultWriteObject() and before serializing any
children or listeners. Subclass can insert its specific
serialization behavior by overrideing this method.
The default implementation does nothing.
Parameters: oos - the object output stream throws: IOException - |
childDeserializedHook | protected void childDeserializedHook(Object child, BCSChild bcsChild)(Code) | | This method is called during deserialization everytime a child is read.
The default implementation does nothing.
Parameters: child - the child just deserialized Parameters: bcsChild - the BCSChild just deserialized |
childJustAddedHook | protected void childJustAddedHook(Object child, BCSChild bcsChild)(Code) | | This method is called everytime a child is added to this context.
This method is called with child synchronized.
The default implementation does nothing.
Parameters: child - the child just added Parameters: bcsChild - the BCSChild just added |
childJustRemovedHook | protected void childJustRemovedHook(Object child, BCSChild bcsChild)(Code) | | This method is called everytime a child is removed from this context.
This method is called with child synchronized.
The default implementation does nothing.
Parameters: child - the child just removed Parameters: bcsChild - the BCSChild just removed |
classEquals | final protected static boolean classEquals(Class clz1, Class clz2)(Code) | | Compares if two classes are equal or their class names are equal.
Parameters: clz1 - a class Parameters: clz2 - another class true if two class objects are equal or their class names are equal. |
containsKey | public boolean containsKey(Object child)(Code) | | Returns true if the given object is a child of this context.
Parameters: child - the object to test true if the given object is a child of this context |
copyChildren | final protected Object[] copyChildren()(Code) | | Returns an array containing all children of this context.
an array containing all children of this context |
createBCSChild | protected BCSChild createBCSChild(Object child, Object proxyPeer)(Code) | | Creates a BCSChild object to company the given child.
Parameters: child - the child Parameters: proxyPeer - the proxy peer of the child if there is one a BCSChild object to company the given child |
dontUseGui | public void dontUseGui()(Code) | | |
fireChildrenAdded | final protected void fireChildrenAdded(BeanContextMembershipEvent event)(Code) | | Notifies registered BeanContextMembershipListener s that
a new child has been added.
Parameters: event - the BeanContextMembershipEvent |
fireChildrenRemoved | final protected void fireChildrenRemoved(BeanContextMembershipEvent event)(Code) | | Notifies registered BeanContextMembershipListener s that
a child has been removed.
Parameters: event - the BeanContextMembershipEvent |
getBeanContextPeer | public BeanContext getBeanContextPeer()(Code) | | Returns the peer of this context casted as BeanContext .
the peer of this context casted as BeanContext |
getChildBeanContextChild | final protected static BeanContextChild getChildBeanContextChild(Object child)(Code) | | Returns the BeanContextChild related with the given child.
If the child implements BeanContextChild , it is returned.
If the child implements BeanContextProxy , the proxy is returned.
Otherwise, null is returned.
Parameters: child - a child the BeanContextChild related with the given child throws: IllegalStateException - if the child implements both BeanContextChild and BeanContextProxy |
getChildBeanContextMembershipListener | final protected static BeanContextMembershipListener getChildBeanContextMembershipListener(Object child)(Code) | | Returns the given child casted to BeanContextMembershipListener ,
or null if it does not implements the interface.
Parameters: child - a child the given child casted to BeanContextMembershipListener ,or null if it does not implements the interface |
getChildPropertyChangeListener | final protected static PropertyChangeListener getChildPropertyChangeListener(Object child)(Code) | | Returns the given child casted to PropertyChangeListener ,
or null if it does not implements the interface.
Parameters: child - a child the given child casted to PropertyChangeListener ,or null if it does not implements the interface |
getChildSerializable | final protected static Serializable getChildSerializable(Object child)(Code) | | Returns the given child casted to Serializable ,
or null if it does not implements the interface.
Parameters: child - a child the given child casted to Serializable ,or null if it does not implements the interface |
getChildVetoableChangeListener | final protected static VetoableChangeListener getChildVetoableChangeListener(Object child)(Code) | | Returns the given child casted to VetoableChangeListener ,
or null if it does not implements the interface.
Parameters: child - a child the given child casted to VetoableChangeListener ,or null if it does not implements the interface |
getChildVisibility | final protected static Visibility getChildVisibility(Object child)(Code) | | Returns the given child casted to Visibility ,
or null if it does not implements the interface.
Parameters: child - a child the given child casted to Visibility ,or null if it does not implements the interface |
getLocale | public Locale getLocale()(Code) | | Returns the locale of this context.
the locale of this context |
initialize | protected void initialize()(Code) | | Initializes all transient fields of this instance, called by
constructors and readObject() .
|
isDesignTime | public boolean isDesignTime()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | |
isSerializing | public boolean isSerializing()(Code) | | Returns true if this context is currently being serialized
(by another thread).
true if this context is currently being serialized (by another thread) |
needsGui | public boolean needsGui()(Code) | | Returns true if this context or its children needs GUI to work properly.
The implementation checks the peer and all the children that implement
Visibility to see if any of their needsGui()
returns true, and if any of the children extends
java.awt.Component .
See Also: java.beans.Visibility.needsGui |
okToUseGui | public void okToUseGui()(Code) | | |
readChildren | final public void readChildren(ObjectInputStream ois) throws IOException, ClassNotFoundException(Code) | | Deserializes children from the given object input stream.
The implementation reads pairs of child object and BCSChild
object according to serializable property. For each pair,
it is added to the children map and the
childDeserializedHook() is called. If the child implements
BeanContextChild , its setBeanContext() is
also called.
This method is called by readObject() if the context works
standalone. Or if this support object is a delegate of another
BeanContext implementation, then this method should be
called by the peer. Doing this means that derialization can proceed
without any circular dependency problems.
Parameters: ois - the object input stream throws: IOException - if I/O exception occurs throws: ClassNotFoundException - if class of read object is not found |
remove | protected boolean remove(Object child, boolean setChildBC)(Code) | | Removes the given child from this context.
If the given child is not a child of this context, simply returns false.
Otherwise, validatePendingRemove() is called. If the
removal is valid, the child's beanContext property is
updated (if required) and the child and its proxy peer (if there is one)
is removed. Last, childJustRemovedHook() is called and
listeners are notified.
Parameters: child - a child of this context Parameters: setChildBC - whether to call setBeanContext() on the child or not true if the child is removed; or false if it is not a child of this context throws: IllegalArgumentException - if the child is null throws: IllegalStateException - if the child is not valid to remove |
serialize | final protected void serialize(ObjectOutputStream oos, Collection collection) throws IOException(Code) | | Serializes the given collection.
First writes a int indicating the number of all
serializable elements (implements Serializable , then
objects are writtern one by one.
Parameters: oos - the stream where the collection is writtern to Parameters: collection - the collection to serialize throws: IOException - if I/O exception occurs |
setDesignTime | public void setDesignTime(boolean designTime)(Code) | | |
setLocale | public void setLocale(Locale newLocale) throws PropertyVetoException(Code) | | Sets the locale of this context. VetoableChangeListener s
and PropertyChangeListener s are notified.
Parameters: newLocale - the new locale to set throws: PropertyVetoException - if any VetoableChangeListener vetos this change |
validatePendingAdd | protected boolean validatePendingAdd(Object child)(Code) | | Validates the pending add of child.
Default implementation always returns true.
Parameters: child - the child to be added true if it is valid to add the child |
validatePendingRemove | protected boolean validatePendingRemove(Object child)(Code) | | Validates the pending removal of child.
Default implementation always returns true.
Parameters: child - the child to be removed true if it is valid to remove the child |
writeChildren | final public void writeChildren(ObjectOutputStream oos) throws IOException(Code) | | Serializes children to the given object input stream.
The implementation iterates through all children and writes out pairs
of child object and BCSChild object if the child is
serializable (implements Serialization .
This method is called by writeObject() if the context
works standalone. Or if this support object is a delegate of another
BeanContext implementation, then this method should be
called by the peer to avoid the 'chicken and egg' problem during
deserialization.
Parameters: oos - the stream to write throws: IOException - if I/O exception occurs |
|
|