MouseDelegator (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap
Class MouseDelegator

    java.lang.Object
      com.bbn.openmap.MouseDelegator

All Implemented Interfaces:
  SoloMapComponent, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

    public class MouseDelegator

extends java.lang.Object
implements java.beans.PropertyChangeListener, java.io.Serializable, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, SoloMapComponent

The MouseDelegator manages the MapMouseModes that handle MouseEvents on the map. There should only be one MouseDelegator within a MapHandler.

See Also:
  `MapMouseMode`, `AbstractMouseMode`, `NavMouseMode`, `SelectMouseMode`, Serialized Form

Field Summary
`static java.lang.String` | `ActiveModeProperty`
`protected MapMouseMode` | `activeMouseMode` The active MapMouseMode.
`protected java.beans.beancontext.BeanContextChildSupport` | `beanContextChildSupport` BeanContextChildSupport object provides helper functions for BeanContextChild interface.
`protected Layer[]` | `currentLayers` Need to keep a safe copy of the current layers that are part of the MapBean in case a MouseMode gets added before the MapBean is set in the MouseDelegator.
`protected MapBean` | `map` The MapBean.
`protected java.util.Vector<MapMouseMode>` | `mouseModes` The registered MapMouseModes.
`static java.lang.String` | `MouseModesProperty`
`protected java.beans.PropertyChangeSupport` | `pcSupport` PropertyChangeSupport for handling listeners.
`static java.lang.String` | `ProxyMouseModeProperty` A property string used when firing PropertyChangeSupport notifications when the mouse mode is acting as proxy for another mouse mode.

Constructor Summary
`MouseDelegator()` Construct a MouseDelegator without an associated MapBean.
`MouseDelegator(MapBean map)` Construct a MouseDelegator with an associated MapBean.

Method Summary
`void` | `addMouseMode(MapMouseMode med)` Adds a MapMouseMode to the MouseMode list.
`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` | `dispose()`
`void` | `findAndInit(java.util.Iterator<?> it)` Eventually gets called when the MouseDelegator 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 MouseDelegator 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.
`MapMouseMode` | `getActiveMouseMode()` Returns the mouse mode delegate that is active at the moment.
`java.lang.String` | `getActiveMouseModeID()` Returns the ID string for the active Mouse Mode.
`java.beans.beancontext.BeanContext` | `getBeanContext()` Method for BeanContextChild interface.
`MapBean` | `getMap()` Get the associated MapBean.
`MapMouseMode[]` | `getMouseModes()` Returns an array of MapMouseModes that are available to the MapBean.
`void` | `propertyChange(java.beans.PropertyChangeEvent evt)` PropertyChangeListenter Interface method.
`void` | `removeMouseMode(MapMouseMode med)` Removes a particular MapMouseMode from the MouseMode list.
`void` | `removeMouseMode(java.lang.String id)` Removes a particular MapMouseMode from the MouseMode list, with the ID given.
`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` | `setActive(MapMouseMode mm)` Set the active MapMouseMode.
`void` | `setActiveMouseMode(MapMouseMode aMed)` Sets the active mouse mode.
`void` | `setActiveMouseModeWithID(java.lang.String MouseModeID)` Sets the mouse mode to the mode with the same ID string.
`void` | `setBeanContext(java.beans.beancontext.BeanContext in_bc)` Method for BeanContextChild interface.
`void` | `setDefaultMouseModes()` Sets the three default OpenMap mouse modes.
`void` | `setInactive(MapMouseMode mm)` Deactivate the MapMouseMode.
`void` | `setMap(MapBean mapbean)` Set the associated MapBean.
`void` | `setMouseModes(MapMouseMode[] meds)` Used to set the mouseModes available to the MapBean.
`void` | `setMouseModes(MapMouseMode[] meds, int activeIndex)` Used to set the mouseModes available to the MapBean.
`void` | `setupMouseModesWithLayers(Layer[] layers)` Does the work putting the layers given on each mouse mode's list of layers to notify if it becomes active.
`void` | `setupMouseModeWithLayers(MapMouseMode mmm, Layer[] layers)` Gives a MapMouseMode access to a Layer[], and it will find the layers that want to listen to it and will forward events to them if it is added to the MapBean as a MouseListener or a MouseMotionListener.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ActiveModeProperty

    public static final transient java.lang.String ActiveModeProperty

See Also:
  Constant Field Values

### MouseModesProperty

    public static final transient java.lang.String MouseModesProperty

See Also:
  Constant Field Values

### ProxyMouseModeProperty

    public static final java.lang.String ProxyMouseModeProperty

  A property string used when firing PropertyChangeSupport notifications when the mouse mode is acting as proxy for another mouse mode.

  See Also:
    Constant Field Values

### activeMouseMode

    protected transient MapMouseMode activeMouseMode

  The active MapMouseMode.

### mouseModes

    protected transient java.util.Vector<MapMouseMode> mouseModes

  The registered MapMouseModes.

### map

    protected transient MapBean map

  The MapBean.

### currentLayers

    protected Layer[] currentLayers

  Need to keep a safe copy of the current layers that are part of the MapBean in case a MouseMode gets added before the MapBean is set in the MouseDelegator. Without this, you can get into a situation where new MapMouseModes don't know about layers until the MouseDelegator receives a property change event from 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

### MouseDelegator

    public MouseDelegator(MapBean map)

  Construct a MouseDelegator with an associated MapBean.

  Parameters:
    `map` - MapBean

### MouseDelegator

    public MouseDelegator()

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

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

Method Detail

### setMap

    public void setMap(MapBean mapbean)

  Set the associated MapBean.

  Parameters:
    `mapbean` - MapBean

### getMap

    public MapBean getMap()

  Get the associated MapBean.

  Returns:
    MapBean

### getActiveMouseModeID

    public java.lang.String getActiveMouseModeID()

  Returns the ID string for the active Mouse Mode.

  Returns:
    String ID of the active mouse mode.

### setActiveMouseModeWithID

    public void setActiveMouseModeWithID(java.lang.String MouseModeID)

  Sets the mouse mode to the mode with the same ID string. If none of the MouseEventDelagates have a matching ID string, the mode is not changed.
  The map mouse cursor is set to the recommended cursor retrieved from the active mouseMode.

  Parameters:
    `MouseModeID` - the string ID of the mode to set active.

### getActiveMouseMode

    public MapMouseMode getActiveMouseMode()

  Returns the mouse mode delegate that is active at the moment.

  Returns:
    MapMouseMode the active mouse mode

### setActiveMouseMode

    public void setActiveMouseMode(MapMouseMode aMed)

  Sets the active mouse mode. If the MapMouseMode is not a member of the current mouse modes, it is added to the list.
  The map mouse cursor is set to the recommended cursor retrieved from the active mouseMode.

  Parameters:
    `aMed` - a MapMouseMode to make active.

### getMouseModes

    public MapMouseMode[] getMouseModes()

  Returns an array of MapMouseModes that are available to the MapBean.

  Returns:
    an array of MapMouseModes.

### setMouseModes

    public void setMouseModes(MapMouseMode[] meds,
                              int activeIndex)

  Used to set the mouseModes available to the MapBean. The Delegator drops all references to any mouseModes it knew about previously. It also sets the index of the array to be the active mouse mode.
  The map mouse cursor is set to the recommended cursor retrieved from the active mouseMode.

  Parameters:
    `meds` - an array of MapMouseModes
    `activeIndex` - which mouse mode to make active

### setMouseModes

    public void setMouseModes(MapMouseMode[] meds)

  Used to set the mouseModes available to the MapBean. The MapBean drops all references to any mouseModes it knew about previously. The meds[0] mode is made active, by default.

  Parameters:
    `meds` - an array of MapMouseModes

### addMouseMode

    public void addMouseMode(MapMouseMode med)

  Adds a MapMouseMode to the MouseMode list. Does not make it the active mode.

  Parameters:
    `med` - the MouseEvent Delegate to add.

### removeMouseMode

    public void removeMouseMode(MapMouseMode med)

  Removes a particular MapMouseMode from the MouseMode list.

  Parameters:
    `med` - the MapMouseMode that should be removed.

### removeMouseMode

    public void removeMouseMode(java.lang.String id)

  Removes a particular MapMouseMode from the MouseMode list, with the ID given.

  Parameters:
    `id` - the ID of the MapMouseMode that should be removed

### setDefaultMouseModes

    public void setDefaultMouseModes()

  Sets the three default OpenMap mouse modes. These modes are: NavMouseMode (Map Navigation), the SelectMouseMode (MouseEvents go to Layers), and NullMouseMode (MouseEvents are ignored).

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent evt)

  PropertyChangeListenter Interface method.

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

### setupMouseModesWithLayers

    public void setupMouseModesWithLayers(Layer[] layers)

  Does the work putting the layers given on each mouse mode's list of layers to notify if it becomes active.

### setupMouseModeWithLayers

    public void setupMouseModeWithLayers(MapMouseMode mmm,
                                         Layer[] layers)

  Gives a MapMouseMode access to a Layer[], and it will find the layers that want to listen to it and will forward events to them if it is added to the MapBean as a MouseListener or a MouseMotionListener.

  Parameters:
    `mmm` - MapMouseMode
    `layers` - Layer[]

### setActive

    public void setActive(MapMouseMode mm)

  Set the active MapMouseMode. This sets the MapMouseMode of the associated MapBean.

  Parameters:
    `mm` - MapMouseMode

### setInactive

    public void setInactive(MapMouseMode mm)

  Deactivate the MapMouseMode.

  Parameters:
    `mm` - MapMouseMode.

### findAndInit

    public void findAndInit(java.util.Iterator<?> it)

  Eventually gets called when the MouseDelegator is added to the BeanContext, and when other objects are added to the BeanContext anytime after that. The MouseDelegator looks for a MapBean to manage MouseEvents for, and MouseModes 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.

### findAndInit

    public void findAndInit(java.lang.Object someObj)

  Called when an object should be evaluated by the MouseDelegator to see if it is needed.

### 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 MouseDelegator looks for the MapBean it is managing MouseEvents for, and any MouseModes 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.

### findAndUndo

    public void findAndUndo(java.lang.Object someObj)

  Called by childrenRemoved.

### dispose

    public void dispose()

### getBeanContext

    public java.beans.beancontext.BeanContext getBeanContext()

  Method for BeanContextChild interface.

  Specified by:
    `getBeanContext` 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`

### 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`

### 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`

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

### firePropertyChange

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

### 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`

### 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`

### 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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