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.event
Class MapMouseSupport

    java.lang.Object
      com.bbn.openmap.event.ListenerSupport
          com.bbn.openmap.event.MapMouseSupport

All Implemented Interfaces:
  java.io.Serializable

public class MapMouseSupport
extends ListenerSupport

This is a utility class that can be used by beans that need support for handling MapMouseListeners and firing MapMouseEvents. You can use an instance of this class as a member field of your bean and delegate work to it.

You can set the behavior of how MouseEvents are propagated by setting whether to "consume" events. If the MouseMode is consuming events, then the event is not propagated further than the first listener to successfully process it. Otherwise the event is propagated to all listeners. The default is to consume events.

See Also:
  Serialized Form

Field Summary
`protected boolean` | `clickHappened` Used to determine whether a release should reset the priorityListener on a mouse release.
`protected boolean` | `consumeEvents` The flag that dictates whether the events should be passed to all the listeners or just limited to the first listener that can deal with it.
`protected boolean` | `DEBUG`
`protected boolean` | `DEBUG_DETAIL`
`protected MapMouseListener` | `priorityListener` The priority MapMouseListener will be guaranteed to receive events that go hand in hand (pressed - released, etc.).
`protected MapMouseMode` | `proxy` A MapMouseMode that may be using the parent of this support object as a proxy.
`static int` | `PROXY_ACK_CONSUMED_MOUSE_CLICKED`
`static int` | `PROXY_ACK_CONSUMED_MOUSE_DRAGGED`
`static int` | `PROXY_ACK_CONSUMED_MOUSE_MOVED`
`static int` | `PROXY_ACK_CONSUMED_MOUSE_PRESSED`
`static int` | `PROXY_ACK_CONSUMED_MOUSE_RELEASED`
`static int` | `PROXY_DISTRIB_MOUSE_CLICKED`
`static int` | `PROXY_DISTRIB_MOUSE_DRAGGED`
`static int` | `PROXY_DISTRIB_MOUSE_ENTERED`
`static int` | `PROXY_DISTRIB_MOUSE_EXITED`
`static int` | `PROXY_DISTRIB_MOUSE_MOVED`
`static int` | `PROXY_DISTRIB_MOUSE_PRESSED`
`static int` | `PROXY_DISTRIB_MOUSE_RELEASED`
`protected int` | `proxyDistributionMask`

Fields inherited from class com.bbn.openmap.event.ListenerSupport
`listeners, source`

Constructor Summary
`MapMouseSupport()` Construct a default MapMouseSupport.
`MapMouseSupport(boolean shouldConsumeEvents)` Construct a MapMouseSupport.
`MapMouseSupport(MapMouseMode mode)` Construct a default MapMouseSupport.
`MapMouseSupport(MapMouseMode mode, boolean shouldConsumeEvents)` Construct a MapMouseSupport.

Method Summary
`void` | `addMapMouseListener(MapMouseListener listener)` Add a MapMouseListener to the listener list.
`boolean` | `fireMapMouseClicked(java.awt.event.MouseEvent evt)` Handle a mouseClicked MouseListener event.
`boolean` | `fireMapMouseDragged(java.awt.event.MouseEvent evt)` Handle a mouseDragged MouseListener event.
`boolean` | `fireMapMouseEntered(java.awt.event.MouseEvent evt)` Handle a mouseEntered MouseListener event.
`boolean` | `fireMapMouseExited(java.awt.event.MouseEvent evt)` Handle a mouseExited MouseListener event.
`boolean` | `fireMapMouseMoved(java.awt.event.MouseEvent evt)` Handle a mouseMoved MouseListener event.
`boolean` | `fireMapMousePressed(java.awt.event.MouseEvent evt)` Handle a mousePressed MouseListener event.
`boolean` | `fireMapMouseReleased(java.awt.event.MouseEvent evt)` Handle a mouseReleased MouseListener event.
`MapMouseMode` | `getParentMode()`
`protected int` | `getProxyDistributionMask()` Get the mask that dictates which events get sent to this support object's targets even if the parent mouse mode is acting as a proxy.
`boolean` | `isConsumeEvents()` Returns how the mouse support is set up to distribute events.
`boolean` | `isProxyFor(MapMouseMode mmm)` Can check if the MapMouseMode is acting as a proxy for another MapMouseMode.
`protected void` | `releaseProxy()` Release the proxy lock on the MapMouseMode.
`void` | `removeAllMapMouseListeners()` Remove all MapMouseListeners from the listener list.
`void` | `removeMapMouseListener(MapMouseListener listener)` Remove a MapMouseListener from the listener list.
`void` | `setConsumeEvents(boolean shouldConsumeEvents)` Sets how the mouse support passes out events.
`void` | `setParentMode(MapMouseMode mode)` Set the parent MapMouseMode to use in constructing MapMouseEvents.
`protected void` | `setProxyDistributionMask(int mask)` Set the mask that dictates which events get sent to this support object's targets even if the parent mouse mode is acting as a proxy.
`protected boolean` | `setProxyFor(MapMouseMode mmm, int pdm)` Request to have the parent MapMouseMode act as a proxy for a MapMouseMode that wants to remain hidden.

Methods inherited from class com.bbn.openmap.event.ListenerSupport
`addListener, getListeners, getSource, iterator, readObject, removeAll, removeListener, setSource, size, writeObject`

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

Field Detail

### consumeEvents

    protected boolean consumeEvents

  The flag that dictates whether the events should be passed to all the listeners or just limited to the first listener that can deal with it. The default value is set to true, which means the event will be consumed by the first layer that can handle it.

### priorityListener

    protected MapMouseListener priorityListener

  The priority MapMouseListener will be guaranteed to receive events that go hand in hand (pressed - released, etc.).

### clickHappened

    protected boolean clickHappened

  Used to determine whether a release should reset the priorityListener on a mouse release.

### proxy

    protected transient MapMouseMode proxy

  A MapMouseMode that may be using the parent of this support object as a proxy.

### proxyDistributionMask

    protected transient int proxyDistributionMask

### PROXY_DISTRIB_MOUSE_PRESSED

    public static final int PROXY_DISTRIB_MOUSE_PRESSED

See Also:
  Constant Field Values

### PROXY_ACK_CONSUMED_MOUSE_PRESSED

    public static final int PROXY_ACK_CONSUMED_MOUSE_PRESSED

See Also:
  Constant Field Values

### PROXY_DISTRIB_MOUSE_RELEASED

    public static final int PROXY_DISTRIB_MOUSE_RELEASED

See Also:
  Constant Field Values

### PROXY_ACK_CONSUMED_MOUSE_RELEASED

    public static final int PROXY_ACK_CONSUMED_MOUSE_RELEASED

See Also:
  Constant Field Values

### PROXY_DISTRIB_MOUSE_CLICKED

    public static final int PROXY_DISTRIB_MOUSE_CLICKED

See Also:
  Constant Field Values

### PROXY_ACK_CONSUMED_MOUSE_CLICKED

    public static final int PROXY_ACK_CONSUMED_MOUSE_CLICKED

See Also:
  Constant Field Values

### PROXY_DISTRIB_MOUSE_MOVED

    public static final int PROXY_DISTRIB_MOUSE_MOVED

See Also:
  Constant Field Values

### PROXY_ACK_CONSUMED_MOUSE_MOVED

    public static final int PROXY_ACK_CONSUMED_MOUSE_MOVED

See Also:
  Constant Field Values

### PROXY_DISTRIB_MOUSE_DRAGGED

    public static final int PROXY_DISTRIB_MOUSE_DRAGGED

See Also:
  Constant Field Values

### PROXY_ACK_CONSUMED_MOUSE_DRAGGED

    public static final int PROXY_ACK_CONSUMED_MOUSE_DRAGGED

See Also:
  Constant Field Values

### PROXY_DISTRIB_MOUSE_ENTERED

    public static final int PROXY_DISTRIB_MOUSE_ENTERED

See Also:
  Constant Field Values

### PROXY_DISTRIB_MOUSE_EXITED

    public static final int PROXY_DISTRIB_MOUSE_EXITED

See Also:
  Constant Field Values

### DEBUG

    protected boolean DEBUG

### DEBUG_DETAIL

    protected boolean DEBUG_DETAIL

Constructor Detail

### MapMouseSupport

    public MapMouseSupport()

  Construct a default MapMouseSupport. The default value of consumeEvents is set to true.

### MapMouseSupport

    public MapMouseSupport(MapMouseMode mode)

  Construct a default MapMouseSupport. The default value of consumeEvents is set to true.

Parameters:
  `mode` - the parent MapMouseMode to use with creating the MapMouseEvent.

### MapMouseSupport

    public MapMouseSupport(boolean shouldConsumeEvents)

  Construct a MapMouseSupport.

Parameters:
  `shouldConsumeEvents` - if true, events are propagated to the first MapMouseListener that successfully processes the event, if false, events are propagated to all MapMouseListeners

### MapMouseSupport

    public MapMouseSupport(MapMouseMode mode,
                           boolean shouldConsumeEvents)

  Construct a MapMouseSupport.

Parameters:
  `mode` - the parent MapMouseMode to use with creating the MapMouseEvent.
  `shouldConsumeEvents` - if true, events are propagated to the first MapMouseListener that successfully processes the event, if false, events are propagated to all MapMouseListeners

Method Detail

### setParentMode

    public void setParentMode(MapMouseMode mode)

  Set the parent MapMouseMode to use in constructing MapMouseEvents.

### getParentMode

    public MapMouseMode getParentMode()

### setConsumeEvents

    public void setConsumeEvents(boolean shouldConsumeEvents)

  Sets how the mouse support passes out events. If the value passed in is true, the mouse support will only pass the event to the first listener that can respond to the event. If false, the mouse support will pass the event on to all its listeners.

  Parameters:
    `shouldConsumeEvents` - true for limited distribution.

### isConsumeEvents

    public boolean isConsumeEvents()

  Returns how the mouse support is set up to distribute events.

  Returns:
    true if only one listner gets to act on an event.

### addMapMouseListener

    public void addMapMouseListener(MapMouseListener listener)

  Add a MapMouseListener to the listener list.

  Parameters:
    `listener` - The MapMouseListener to be added

### removeMapMouseListener

    public void removeMapMouseListener(MapMouseListener listener)

  Remove a MapMouseListener from the listener list.

  Parameters:
    `listener` - The MapMouseListener to be removed

### removeAllMapMouseListeners

    public void removeAllMapMouseListeners()

  Remove all MapMouseListeners from the listener list.

### fireMapMousePressed

    public boolean fireMapMousePressed(java.awt.event.MouseEvent evt)

  Handle a mousePressed MouseListener event.

  Parameters:
    `evt` - MouseEvent to be handled

### fireMapMouseReleased

    public boolean fireMapMouseReleased(java.awt.event.MouseEvent evt)

  Handle a mouseReleased MouseListener event. Checks to see if there is a priorityListener, and will direct the event to that listener. The priorityListener variable will be reset to null. If there is not a priorityListener, the event is passed through the listeners, subject to the consumeEvents mode.

  Parameters:
    `evt` - MouseEvent to be handled.

### fireMapMouseClicked

    public boolean fireMapMouseClicked(java.awt.event.MouseEvent evt)

  Handle a mouseClicked MouseListener event. If the priorityListener is set, it automatically gets the clicked event. If it is not set, the other listeners get a shot at the event according to the consumeEvent mode.

  Parameters:
    `evt` - MouseEvent to be handled.

### fireMapMouseEntered

    public boolean fireMapMouseEntered(java.awt.event.MouseEvent evt)

  Handle a mouseEntered MouseListener event.

  Parameters:
    `evt` - MouseEvent to be handled
  Returns:
    true if there was a target to send the event to.

### fireMapMouseExited

    public boolean fireMapMouseExited(java.awt.event.MouseEvent evt)

  Handle a mouseExited MouseListener event.

  Parameters:
    `evt` - MouseEvent to be handled
  Returns:
    true if there was a target to send the event to.

### fireMapMouseDragged

    public boolean fireMapMouseDragged(java.awt.event.MouseEvent evt)

  Handle a mouseDragged MouseListener event.

  Parameters:
    `evt` - MouseEvent to be handled
  Returns:
    false.

### fireMapMouseMoved

    public boolean fireMapMouseMoved(java.awt.event.MouseEvent evt)

  Handle a mouseMoved MouseListener event. If the moved event is consumed, the rest of the listeners that didn't have a chance to respond get called in the mouse moved method without arguments.

  Parameters:
    `evt` - MouseEvent to be handled
  Returns:
    true if the event was consumed.

### setProxyFor

    protected boolean setProxyFor(MapMouseMode mmm,
                                  int pdm)

  Request to have the parent MapMouseMode act as a proxy for a MapMouseMode that wants to remain hidden. Can be useful for directing events to one object.

  Parameters:
    `mmm` - the hidden MapMouseMode for this MapMouseMode to send events to.
    `pdm` - the proxy distribution mask to use, which lets this support object notify its targets of events if the parent is acting as a proxy.
  Returns:
    true if the proxy setup (essentially a lock) is successful, false if the proxy is already set up for another listener.

### isProxyFor

    public boolean isProxyFor(MapMouseMode mmm)

  Can check if the MapMouseMode is acting as a proxy for another MapMouseMode.

### releaseProxy

    protected void releaseProxy()

  Release the proxy lock on the MapMouseMode. Resets the proxy distribution mask.

### setProxyDistributionMask

    protected void setProxyDistributionMask(int mask)

  Set the mask that dictates which events get sent to this support object's targets even if the parent mouse mode is acting as a proxy.

### getProxyDistributionMask

    protected int getProxyDistributionMask()

  Get the mask that dictates which events get sent to this support object's targets even if the parent mouse mode is acting as a proxy.

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