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

    java.lang.Object
      java.util.concurrent.CopyOnWriteArrayList<E>
          com.bbn.openmap.event.ListenerSupport<MapMouseListener>
              com.bbn.openmap.event.MapMouseSupport

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<MapMouseListener>, java.util.Collection<MapMouseListener>, java.util.List<MapMouseListener>, java.util.RandomAccess

    public class MapMouseSupport

extends ListenerSupport<MapMouseListener>

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 static java.util.logging.Logger` | `logger`
`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
`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
`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()`
`MapMouseMode` | `getProxied()`
`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` | `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
`add, add, addAll, clear, getSource, iterator, listIterator, remove, remove, set, setSource, size`

Methods inherited from class java.util.concurrent.CopyOnWriteArrayList
`addAll, addAllAbsent, addIfAbsent, clone, contains, containsAll, equals, get, hashCode, indexOf, indexOf, isEmpty, lastIndexOf, lastIndexOf, listIterator, removeAll, retainAll, subList, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### logger

    protected static java.util.logging.Logger logger

### 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 listener gets to act on an event.

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

### getProxied

    public MapMouseMode getProxied()

  Returns:
    MapMouseMode being proxied (the hidden MapMouseMode that the parent mode is providing events to).

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