com.bbn.openmap.tools.dnd
Class DropListenerSupport

java.lang.Object
  extended by com.bbn.openmap.tools.dnd.DropListenerSupport
All Implemented Interfaces:
SoloMapComponent, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public class DropListenerSupport
extends java.lang.Object
implements java.beans.PropertyChangeListener, java.io.Serializable, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, SoloMapComponent, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

The DropListenerSupport manages the DefaultDnDCatchers that handle Drag and Drop events on the map. There should only be one DropListenerSupport within a MapHandler. DropListenerSupport keeps a list of all DefaultDnDCatcher objects from a MapHandler. It adds itself to the MapBean as MouseListener and MouseMotionListener. On MousePressed, MouseDragged, and MouseReleased events it loops through the DnDCatchers and invokes a consume() method in each of them.

See Also:
DefaultDnDCatcher, Serialized Form

Field Summary
protected  java.beans.beancontext.BeanContextChildSupport beanContextChildSupport
          BeanContextChildSupport object provides helper functions for BeanContextChild interface.
protected  java.util.Vector dndCatchers
          Holds a list of DefaultDndCatchers
protected  MapBean map
          The MapBean.
protected  java.beans.PropertyChangeSupport pcSupport
          PropertyChangeSupport for handling listeners.
 
Constructor Summary
DropListenerSupport()
          Construct a DropListenerSupport without an associated MapBean.
DropListenerSupport(MapBean map)
          Construct a DropListenerSupport with an associated MapBean.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener in_pcl)
          Method for BeanContextChild interface.
 void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
          Method for BeanContextChild interface.
 void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
          BeanContextMembershipListener method.
 void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
          BeanContextMembershipListener method.
 void findAndInit(java.util.Iterator it)
          Eventually gets called when the DropListenerSupport is added to the BeanContext, and when other objects are added to the BeanContext anytime after that.
 void findAndInit(java.lang.Object someObj)
          Called when an object should be evaluated by the DropListenerSupport to see if it is needed.
 void findAndUndo(java.lang.Object someObj)
          Called by childrenRemoved.
 void firePropertyChange(java.lang.String property, java.lang.Object oldObj, java.lang.Object newObj)
           
 void fireVetoableChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
          Report a vetoable property update to any registered listeners.
 java.beans.beancontext.BeanContext getBeanContext()
          Method for BeanContextChild interface.
 MapBean getMap()
          Get the associated MapBean.
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(java.awt.event.MouseEvent e)
          Invoked when a mouse button is pressed on a component and then dragged.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mouseMoved(java.awt.event.MouseEvent e)
          Invoked when the mouse button has been moved on a component (with no buttons no down).
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          PropertyChangeListenter Interface method.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener in_pcl)
          Method for BeanContextChild interface.
 void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
          Method for BeanContextChild interface.
 void setBeanContext(java.beans.beancontext.BeanContext in_bc)
          Method for BeanContextChild interface.
 void setMap(MapBean mapbean)
          Set the associated MapBean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dndCatchers

protected transient java.util.Vector dndCatchers
Holds a list of DefaultDndCatchers


map

protected transient MapBean map
The MapBean.


pcSupport

protected java.beans.PropertyChangeSupport pcSupport
PropertyChangeSupport for handling listeners.


beanContextChildSupport

protected java.beans.beancontext.BeanContextChildSupport beanContextChildSupport
BeanContextChildSupport object provides helper functions for BeanContextChild interface.

Constructor Detail

DropListenerSupport

public DropListenerSupport()
Construct a DropListenerSupport without an associated MapBean. You will need to set the MapBean via setMap().

See Also:
setMap(com.bbn.openmap.MapBean)

DropListenerSupport

public DropListenerSupport(MapBean map)
Construct a DropListenerSupport with an associated MapBean.

Parameters:
map - MapBean
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener in_pcl)
Method for BeanContextChild interface.

Specified by:
addPropertyChangeListener in interface java.beans.beancontext.BeanContextChild

addVetoableChangeListener

public void addVetoableChangeListener(java.lang.String propertyName,
                                      java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface.

Specified by:
addVetoableChangeListener in interface java.beans.beancontext.BeanContextChild

childrenAdded

public void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method. Called when new objects are added to the parent BeanContext.

Specified by:
childrenAdded in interface java.beans.beancontext.BeanContextMembershipListener
Parameters:
bcme - event that contains an iterator that can be used to go through the new objects.

childrenRemoved

public void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method. Called when objects have been removed from the parent BeanContext. The DropListenerSupport looks for the MapBean it is managing MouseEvents for, and any DefaultDndCatchers that may be removed.

Specified by:
childrenRemoved in interface java.beans.beancontext.BeanContextMembershipListener
Parameters:
bcme - event that contains an iterator that can be used to go through the removed objects.

findAndInit

public void findAndInit(java.lang.Object someObj)
Called when an object should be evaluated by the DropListenerSupport to see if it is needed.


findAndInit

public void findAndInit(java.util.Iterator it)
Eventually gets called when the DropListenerSupport is added to the BeanContext, and when other objects are added to the BeanContext anytime after that. The DropListenerSupport looks for a MapBean to manage MouseEvents for, and DefaultDndCatchers to use to manage those events. If a MapBean is added to the BeanContext while another already is in use, the second MapBean will take the place of the first.

Parameters:
it - iterator to use to go through the new objects in the BeanContext.

findAndUndo

public void findAndUndo(java.lang.Object someObj)
Called by childrenRemoved.


firePropertyChange

public void firePropertyChange(java.lang.String property,
                               java.lang.Object oldObj,
                               java.lang.Object newObj)

fireVetoableChange

public void fireVetoableChange(java.lang.String name,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
                        throws java.beans.PropertyVetoException
Report a vetoable property update to any registered listeners. If anyone vetos the change, then fire a new event reverting everyone to the old value and then rethrow the PropertyVetoException.

No event is fired if old and new are equal and non-null.

Parameters:
name - The programmatic name of the property that is about to change
oldValue - The old value of the property
newValue - - The new value of the property
Throws:
java.beans.PropertyVetoException - if the recipient wishes the property change to be rolled back.

getBeanContext

public java.beans.beancontext.BeanContext getBeanContext()
Method for BeanContextChild interface.

Specified by:
getBeanContext in interface java.beans.beancontext.BeanContextChild

getMap

public MapBean getMap()
Get the associated MapBean.

Returns:
MapBean

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons no down).

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
PropertyChangeListenter Interface method.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - PropertyChangeEvent

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener in_pcl)
Method for BeanContextChild interface.

Specified by:
removePropertyChangeListener in interface java.beans.beancontext.BeanContextChild

removeVetoableChangeListener

public void removeVetoableChangeListener(java.lang.String propertyName,
                                         java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface.

Specified by:
removeVetoableChangeListener in interface java.beans.beancontext.BeanContextChild

setBeanContext

public void setBeanContext(java.beans.beancontext.BeanContext in_bc)
                    throws java.beans.PropertyVetoException
Method for BeanContextChild interface.

Specified by:
setBeanContext in interface java.beans.beancontext.BeanContextChild
Throws:
java.beans.PropertyVetoException

setMap

public void setMap(MapBean mapbean)
Set the associated MapBean.

Parameters:
mapbean - MapBean


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details