|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.concurrent.CopyOnWriteArrayList<E> com.bbn.openmap.event.ListenerSupport<MapMouseListener> com.bbn.openmap.event.MapMouseSupport
public class MapMouseSupport
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.
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 |
---|
protected static java.util.logging.Logger logger
protected boolean consumeEvents
protected MapMouseListener priorityListener
protected boolean clickHappened
protected transient MapMouseMode proxy
protected transient int proxyDistributionMask
public static final int PROXY_DISTRIB_MOUSE_PRESSED
public static final int PROXY_ACK_CONSUMED_MOUSE_PRESSED
public static final int PROXY_DISTRIB_MOUSE_RELEASED
public static final int PROXY_ACK_CONSUMED_MOUSE_RELEASED
public static final int PROXY_DISTRIB_MOUSE_CLICKED
public static final int PROXY_ACK_CONSUMED_MOUSE_CLICKED
public static final int PROXY_DISTRIB_MOUSE_MOVED
public static final int PROXY_ACK_CONSUMED_MOUSE_MOVED
public static final int PROXY_DISTRIB_MOUSE_DRAGGED
public static final int PROXY_ACK_CONSUMED_MOUSE_DRAGGED
public static final int PROXY_DISTRIB_MOUSE_ENTERED
public static final int PROXY_DISTRIB_MOUSE_EXITED
protected boolean DEBUG
protected boolean DEBUG_DETAIL
Constructor Detail |
---|
public MapMouseSupport()
public MapMouseSupport(MapMouseMode mode)
mode
- the parent MapMouseMode to use with creating the
MapMouseEvent.public MapMouseSupport(boolean shouldConsumeEvents)
shouldConsumeEvents
- if true, events are propagated to the first
MapMouseListener that successfully processes the event, if false,
events are propagated to all MapMouseListenerspublic MapMouseSupport(MapMouseMode mode, boolean shouldConsumeEvents)
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 MapMouseListenersMethod Detail |
---|
public void setParentMode(MapMouseMode mode)
public MapMouseMode getParentMode()
public void setConsumeEvents(boolean shouldConsumeEvents)
shouldConsumeEvents
- true for limited distribution.public boolean isConsumeEvents()
public boolean fireMapMousePressed(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handledpublic boolean fireMapMouseReleased(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handled.public boolean fireMapMouseClicked(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handled.public boolean fireMapMouseEntered(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handled
public boolean fireMapMouseExited(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handled
public boolean fireMapMouseDragged(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handled
public boolean fireMapMouseMoved(java.awt.event.MouseEvent evt)
evt
- MouseEvent to be handled
protected boolean setProxyFor(MapMouseMode mmm, int pdm)
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.
public boolean isProxyFor(MapMouseMode mmm)
protected void releaseProxy()
public MapMouseMode getProxied()
protected void setProxyDistributionMask(int mask)
protected int getProxyDistributionMask()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |