public class BeanContextSupport extends BeanContextChildSupport implements BeanContext, PropertyChangeListener, VetoableChangeListener, Serializable
BeanContext interface.
This class can be used directly, or be a super class of your class,
or be a delegate of your implementation that needs to support
BeanContext interface.beanContextChildPeerglobalHierarchyLockPROPERTYNAME| Constructor and Description |
|---|
BeanContextSupport()
Constructs a standload
BeanContextSupport. |
BeanContextSupport(BeanContext peer)
Constructs a
BeanContextSupport which is a delegate
of the given peer. |
BeanContextSupport(BeanContext peer,
Locale locale)
Constructs a
BeanContextSupport which is a delegate
of the given peer. |
BeanContextSupport(BeanContext peer,
Locale locale,
boolean designTime)
Constructs a
BeanContextSupport which is a delegate
of the given peer. |
BeanContextSupport(BeanContext peer,
Locale locale,
boolean designTime,
boolean okToUseGui)
Constructs a
BeanContextSupport which is a delegate
of the given peer. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Object child)
Add a child to this context.
|
boolean |
addAll(Collection collection)
This method is unsupported, throws
UnsupportedOperationException. |
void |
addBeanContextMembershipListener(BeanContextMembershipListener listener) |
boolean |
avoidingGui() |
void |
clear()
This method is unsupported, throws
UnsupportedOperationException. |
boolean |
contains(Object child)
Returns true if the given object is a child of this context.
|
boolean |
containsAll(Collection collection)
Returns true if given objects are children of this context.
|
boolean |
containsKey(Object child)
Returns true if the given object is a child of this context.
|
void |
dontUseGui() |
BeanContext |
getBeanContextPeer()
Returns the peer of this context casted as
BeanContext. |
Locale |
getLocale()
Returns the locale of this context.
|
URL |
getResource(String resourceName,
BeanContextChild child) |
InputStream |
getResourceAsStream(String resourceName,
BeanContextChild child) |
Object |
instantiateChild(String beanName) |
boolean |
isDesignTime() |
boolean |
isEmpty() |
boolean |
isSerializing()
Returns true if this context is currently being serialized
(by another thread).
|
Iterator |
iterator()
Returns an iterator of children of this context,
with
remove() disabled. |
boolean |
needsGui()
Returns true if this context or its children needs GUI to work properly.
|
void |
okToUseGui() |
void |
propertyChange(PropertyChangeEvent event) |
void |
readChildren(ObjectInputStream ois)
Deserializes children from the given object input stream.
|
boolean |
remove(Object child)
Removes the given child from this context.
|
boolean |
removeAll(Collection collection)
This method is unsupported, throws
UnsupportedOperationException. |
void |
removeBeanContextMembershipListener(BeanContextMembershipListener listener) |
boolean |
retainAll(Collection collection)
This method is unsupported, throws
UnsupportedOperationException. |
void |
setDesignTime(boolean designTime) |
void |
setLocale(Locale newLocale)
Sets the locale of this context.
|
int |
size()
Returns the number children of this context.
|
Object[] |
toArray()
Returns an array of children of this context.
|
Object[] |
toArray(Object[] array)
Returns an array of children of this context.
|
void |
vetoableChange(PropertyChangeEvent pce) |
void |
writeChildren(ObjectOutputStream oos)
Serializes children to the given object input stream.
|
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContextequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContextequals, hashCode, parallelStream, removeIf, spliterator, streampublic BeanContextSupport()
BeanContextSupport.public BeanContextSupport(BeanContext peer)
BeanContextSupport which is a delegate
of the given peer.peer - the peer of this contextpublic BeanContextSupport(BeanContext peer, Locale locale)
BeanContextSupport which is a delegate
of the given peer.peer - the peer of this contextlocale - the locale of this contextpublic BeanContextSupport(BeanContext peer, Locale locale, boolean designTime)
BeanContextSupport which is a delegate
of the given peer.peer - the peer of this contextlocale - the locale of this contextdesignTime - whether in design mode or notpublic BeanContextSupport(BeanContext peer, Locale locale, boolean designTime, boolean okToUseGui)
BeanContextSupport which is a delegate
of the given peer.peer - the peer of this contextlocale - the locale of this contextdesignTime - whether in design mode or notokToUseGui - whether GUI is usable or notpublic boolean add(Object child)
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 BeanContextMembershipListeners
are notified.
add in interface Collectionchild - the child to addIllegalStateException - if the child is not valid to addCollection.add(java.lang.Object)public boolean addAll(Collection collection)
UnsupportedOperationException.addAll in interface CollectionCollection.addAll(java.util.Collection)public void addBeanContextMembershipListener(BeanContextMembershipListener listener)
addBeanContextMembershipListener in interface BeanContextpublic boolean avoidingGui()
avoidingGui in interface Visibilitypublic void clear()
UnsupportedOperationException.clear in interface CollectionCollection.clear()public boolean contains(Object child)
contains in interface Collectionchild - the object to testCollection.contains(java.lang.Object)public boolean containsAll(Collection collection)
containsAll in interface Collectioncollection - a collection of objectsCollection.containsAll(java.util.Collection)public boolean containsKey(Object child)
child - the object to testpublic void dontUseGui()
dontUseGui in interface Visibilitypublic BeanContext getBeanContextPeer()
BeanContext.BeanContextpublic Locale getLocale()
public URL getResource(String resourceName, BeanContextChild child)
getResource in interface BeanContextpublic InputStream getResourceAsStream(String resourceName, BeanContextChild child) throws IllegalArgumentException
getResourceAsStream in interface BeanContextIllegalArgumentExceptionpublic Object instantiateChild(String beanName) throws IOException, ClassNotFoundException
instantiateChild in interface BeanContextIOExceptionClassNotFoundExceptionpublic boolean isDesignTime()
isDesignTime in interface DesignModepublic boolean isEmpty()
isEmpty in interface Collectionpublic boolean isSerializing()
public Iterator iterator()
remove() disabled.iterator in interface Iterableiterator in interface CollectionCollection.iterator()public boolean needsGui()
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.
needsGui in interface VisibilityVisibility.needsGui()public void okToUseGui()
okToUseGui in interface Visibilitypublic void propertyChange(PropertyChangeEvent event)
propertyChange in interface PropertyChangeListenerpublic final void readChildren(ObjectInputStream ois) throws IOException, ClassNotFoundException
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.
ois - the object input streamIOException - if I/O exception occursClassNotFoundException - if class of read object is not foundpublic boolean remove(Object child)
Delegates to remove(child, true).
remove in interface Collectionchild - a child of this contextIllegalArgumentException - if the child is nullIllegalStateException - if the child is not valid to removeCollection.remove(java.lang.Object)public boolean removeAll(Collection collection)
UnsupportedOperationException.removeAll in interface CollectionCollection.removeAll(java.util.Collection)public void removeBeanContextMembershipListener(BeanContextMembershipListener listener)
removeBeanContextMembershipListener in interface BeanContextpublic boolean retainAll(Collection collection)
UnsupportedOperationException.retainAll in interface CollectionCollection.retainAll(java.util.Collection)public void setDesignTime(boolean designTime)
setDesignTime in interface DesignModepublic void setLocale(Locale newLocale) throws PropertyVetoException
VetoableChangeListeners
and PropertyChangeListeners are notified.newLocale - the new locale to setPropertyVetoException - if any VetoableChangeListener vetos this changepublic int size()
size in interface CollectionCollection.size()public Object[] toArray()
toArray in interface CollectionCollection.toArray()public Object[] toArray(Object[] array)
toArray in interface CollectionCollection.toArray(java.lang.Object[])public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException
vetoableChange in interface VetoableChangeListenerPropertyVetoExceptionpublic final void writeChildren(ObjectOutputStream oos) throws IOException
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.
oos - the stream to writeIOException - if I/O exception occursCopyright © 2015. All Rights Reserved.