com.bbn.openmap
Class MapHandler
java.lang.Object
java.beans.beancontext.BeanContextChildSupport
java.beans.beancontext.BeanContextSupport
java.beans.beancontext.BeanContextServicesSupport
com.bbn.openmap.MapHandler
- All Implemented Interfaces:
- java.beans.beancontext.BeanContext, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextServiceRevokedListener, java.beans.beancontext.BeanContextServices, java.beans.beancontext.BeanContextServicesListener, java.beans.DesignMode, java.beans.PropertyChangeListener, java.beans.VetoableChangeListener, java.beans.Visibility, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.EventListener
public class MapHandler
- extends java.beans.beancontext.BeanContextServicesSupport
The MapHandler is an extension of the BeanContextServicesSupport, with the
added capability of being able to set the policy on handling
SoloMapComponents. The MapHandler can be thought of as a generic map
container, that contains the MapBean, all the layers that may be part of the
map, and all the gesture handling components for that map. Given that
definition, there are some OpenMap components that need to have a one-to-one
relationship with a MapHandler. For instance, a MapHandler should only
contain one MapBean, LayerHandler, MouseDelegator and PropertyHandler.
Objects that have this one-to-one relationship with the MapHandler should
implement the SoloMapComponent interface, so the MapHandler can control what
happens when more than one instance of a particular SoloMapComponent type is
added to the MapBean. Other objects that get added to the MapHandler that
hook up with SoloMapComponents should expect that only one version of those
components should be used - if another instance gets added to the MapHandler,
the objects should disconnect from the SoloMapComponent that they are using,
and connect to the new object added. With this behavior, these objects can
gracefully adapt to the SoloMapComponent policies that are set in the
MapHandler:
- You can set the MapHandler with the policy to let duplicate
SoloMapComponents be added to the MapHandler. If a duplicate SoloMapComponent
is added, then all objects using that type of SoloMapComponent should
gracefully use the latest version added.
- The MapHandler can have to policy to limit the addition of duplicate
SoloMapComponents. If a duplicate is added, and exception is thrown. In this
case, the original SoloMapComponent must be removed from the MapHandler
before the second instance is added.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.beans.beancontext.BeanContextServicesSupport |
java.beans.beancontext.BeanContextServicesSupport.BCSSChild, java.beans.beancontext.BeanContextServicesSupport.BCSSProxyServiceProvider, java.beans.beancontext.BeanContextServicesSupport.BCSSServiceProvider |
Nested classes/interfaces inherited from class java.beans.beancontext.BeanContextSupport |
java.beans.beancontext.BeanContextSupport.BCSChild, java.beans.beancontext.BeanContextSupport.BCSIterator |
Fields inherited from class java.beans.beancontext.BeanContextServicesSupport |
bcsListeners, proxy, serializable, services |
Fields inherited from class java.beans.beancontext.BeanContextSupport |
bcmListeners, children, designTime, locale, okToUseGui |
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 |
Method Summary |
boolean |
add(java.lang.Object obj)
Add an object to the MapHandler BeanContextSupport. |
protected void |
addLater(java.lang.Object obj)
Call made from the add() method for objects that added when another
object was being added, setting up a ConcurrentModificationException
condition. |
java.lang.Object |
get(java.lang.Class someClass)
Given a Class, find the object in the MapHandler. |
java.lang.Object |
get(java.lang.String classname)
Given a class name, find the object in the MapHandler. |
java.util.Collection |
getAll(java.lang.Class someClass)
Given a Class, find all the objects in the MapHandler that are
assignment-compatible with that Class. |
java.util.Collection |
getAll(java.lang.String classname)
Given a Class name, find all the objects in the MapHandler that are
assignment-compatible object of that Class. |
SoloMapComponentPolicy |
getPolicy()
Get the policy that sets the behavior of the MapHandler when it
encounters the situation of multiple instances of a particular
SoloMapComponent. |
protected boolean |
isAddInProgress()
|
protected void |
purgeLaterList()
Call to add any objects on the addLaterVector to the MapHandler. |
boolean |
remove(java.lang.Object obj)
Added because apparently, the BeanContext doesn't check to see if the
object is also a membership listener to remove it from that list. |
protected void |
setAddInProgress(boolean value)
|
void |
setPolicy(SoloMapComponentPolicy smcp)
Set the policy of behavior for the MapHandler on how it should act when
multiple instances of a certain SoloMapComponents are added to it. |
java.lang.String |
toString()
|
Methods inherited from class java.beans.beancontext.BeanContextServicesSupport |
addBeanContextServicesListener, addService, addService, bcsPreDeserializationHook, bcsPreSerializationHook, childJustRemovedHook, createBCSChild, createBCSSServiceProvider, fireServiceAdded, fireServiceAdded, fireServiceRevoked, fireServiceRevoked, getBeanContextServicesPeer, getChildBeanContextServicesListener, getCurrentServiceClasses, getCurrentServiceSelectors, getService, hasService, initialize, initializeBeanContextResources, releaseBeanContextResources, releaseService, removeBeanContextServicesListener, revokeService, serviceAvailable, serviceRevoked |
Methods inherited from class java.beans.beancontext.BeanContextSupport |
addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, childDeserializedHook, childJustAddedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildren |
Methods inherited from class java.beans.beancontext.BeanContextChildSupport |
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.beans.beancontext.BeanContext |
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener |
Methods inherited from interface java.beans.beancontext.BeanContextChild |
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext |
Methods inherited from interface java.util.Collection |
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface java.beans.DesignMode |
isDesignTime, setDesignTime |
Methods inherited from interface java.beans.Visibility |
avoidingGui, dontUseGui, needsGui, okToUseGui |
policy
protected SoloMapComponentPolicy policy
DEBUG
protected boolean DEBUG
addInProgress
protected boolean addInProgress
addLaterVector
protected java.util.Vector addLaterVector
MapHandler
public MapHandler()
setPolicy
public void setPolicy(SoloMapComponentPolicy smcp)
- Set the policy of behavior for the MapHandler on how it should act when
multiple instances of a certain SoloMapComponents are added to it.
- See Also:
SoloMapComponentReplacePolicy
,
SoloMapComponentRejectPolicy
getPolicy
public SoloMapComponentPolicy getPolicy()
- Get the policy that sets the behavior of the MapHandler when it
encounters the situation of multiple instances of a particular
SoloMapComponent.
addLater
protected void addLater(java.lang.Object obj)
- Call made from the add() method for objects that added when another
object was being added, setting up a ConcurrentModificationException
condition. This is a coping mechanism.
purgeLaterList
protected void purgeLaterList()
- Call to add any objects on the addLaterVector to the MapHandler. These
are objects that were previously added which another object was being
added, setting up a ConcurrentModificationException condition. Part of
the coping mechanism.
setAddInProgress
protected void setAddInProgress(boolean value)
isAddInProgress
protected boolean isAddInProgress()
add
public boolean add(java.lang.Object obj)
- Add an object to the MapHandler BeanContextSupport. Uses the current
SoloMapComponentPolicy to handle the SoloMapComponents added. May throw
MultipleSoloMapComponentException if the policy is a
SoloMapComponentRejectPolicy and the SoloMapComponent is a duplicate type
of another component already added.
- Specified by:
add
in interface java.util.Collection
- Overrides:
add
in class java.beans.beancontext.BeanContextSupport
- Parameters:
obj
- the map component to nest within this BeanContext.
- Returns:
- true if addition is successful, false if not.
- Throws:
MultipleSoloMapComponentException.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
get
public java.lang.Object get(java.lang.String classname)
- Given a class name, find the object in the MapHandler. If the class is
not a SoloMapComponent and there are more than one of them in the
MapHandler, you will get the first one found.
get
public java.lang.Object get(java.lang.Class someClass)
- Given a Class, find the object in the MapHandler. If the class is not a
SoloMapComponent and there are more than one of them in the MapHandler,
you will get the first one found.
getAll
public java.util.Collection getAll(java.lang.String classname)
- Given a Class name, find all the objects in the MapHandler that are
assignment-compatible object of that Class. A Collection is always
returned, although it may be empty.
getAll
public java.util.Collection getAll(java.lang.Class someClass)
- Given a Class, find all the objects in the MapHandler that are
assignment-compatible with that Class. A Collection is always returned,
although it may be empty.
remove
public boolean remove(java.lang.Object obj)
- Added because apparently, the BeanContext doesn't check to see if the
object is also a membership listener to remove it from that list. This
method removes the object from that list, too, if it is a
BeanContextMembershipListener.
- Specified by:
remove
in interface java.util.Collection
- Overrides:
remove
in class java.beans.beancontext.BeanContextSupport
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details