org.apache.batik.gvt.event
public abstract class AbstractAWTEventDispatcher extends Object implements EventDispatcher, MouseListener, MouseMotionListener, KeyListener
Mouse events are dispatched to their "containing" node (the GraphicsNode corresponding to the mouse event coordinate). Searches for containment are performed from the EventDispatcher's "root" node.
This class is made abstract so that concrete versions can be made for different JDK versions.Field Summary | |
---|---|
protected AffineTransform | baseTransform
The base AffineTransform for InputEvent-to-GraphicsNodeEvent
coordinates as determined by setBaseTransform(). |
protected GraphicsNode | currentKeyEventTarget
The current GraphicsNode targeted by an key events. |
protected boolean | eventDispatchEnabled |
protected List | eventQueue
These are used to queue events while a rendering event
is in progress. |
protected int | eventQueueMaxSize |
protected EventListenerList | glisteners
The global listener list. |
protected GraphicsNode | lastHit
The lastest node which has been targeted by an event. |
protected GraphicsNode | root
The root GraphicsNode as determined by setRootNode(). |
Constructor Summary | |
---|---|
AbstractAWTEventDispatcher()
Constructs a new event dispatcher. |
Method Summary | |
---|---|
void | addGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Adds the specified 'global' GraphicsNodeKeyListener which is
notified of all KeyEvents dispatched. |
void | addGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Adds the specified 'global' GraphicsNodeMouseListener which is
notified of all MouseEvents dispatched. |
void | addGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
Adds the specified 'global' GraphicsNodeMouseWheelListener which is
notified of all MouseWheelEvents dispatched. |
void | dispatchEvent(EventObject evt)
Dispatches the specified AWT event. |
protected abstract void | dispatchKeyEvent(KeyEvent evt)
Dispatches the specified AWT key event.
|
protected void | dispatchMouseEvent(MouseEvent evt)
Dispatches the specified AWT mouse event. |
AffineTransform | getBaseTransform()
Returns the base transform applied to MouseEvent coordinates prior
to dispatch. |
protected abstract int | getButton(MouseEvent evt)
Returns the button whose state changed for the given event. |
protected int | getCurrentLockState()
Returns a bitmask representing the state of the key locks. |
EventListener[] | getListeners(Class listenerType)
Returns an array of listeners that were added to this event
dispatcher and of the specified type. |
protected abstract int | getModifiers(InputEvent evt)
Returns the modifiers mask for this event. |
GraphicsNode | getRootNode()
Returns the root node for MouseEvent dispatch containment
searches and field selections. |
protected boolean | isNodeDecrementEvent(InputEvent e)
Returns true if the input event e is a node decrement event,
false otherwise. |
protected boolean | isNodeIncrementEvent(InputEvent e)
Returns true if the input event e is a node increment event,
false otherwise. |
void | keyPressed(KeyEvent evt)
Dispatches the specified AWT key event down to the GVT tree.
|
void | keyReleased(KeyEvent evt)
Dispatches the specified AWT key event down to the GVT tree.
|
void | keyTyped(KeyEvent evt)
Dispatches the specified AWT key event down to the GVT tree.
|
void | mouseClicked(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | mouseDragged(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | mouseEntered(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | mouseExited(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | mouseMoved(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | mousePressed(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | mouseReleased(MouseEvent evt)
Dispatches the specified AWT mouse event down to the GVT tree.
|
void | processKeyEvent(GraphicsNodeKeyEvent evt)
Dispatches a graphics node key event to by firing the 'global'
listeners attached to this event dispatcher.
|
protected void | processMouseEvent(GraphicsNodeMouseEvent evt)
Processes the specified event by firing the 'global' listeners
attached to this event dispatcher. |
void | removeGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Removes the specified 'global' GraphicsNodeKeyListener which is
notified of all KeyEvents dispatched. |
void | removeGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Removes the specified 'global' GraphicsNodeMouseListener which is
notified of all MouseEvents dispatched. |
void | removeGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
Removes the specified 'global' GraphicsNodeMouseWheelListener which is
notified of all MouseWheelEvents dispatched. |
void | setBaseTransform(AffineTransform t)
Sets the base transform applied to MouseEvent coordinates prior
to dispatch. |
void | setEventDispatchEnabled(boolean b) |
void | setEventQueueMaxSize(int n) |
void | setNodeDecrementEvent(InputEvent e)
Associates all InputEvents of type e.getID()
with "decrementing" of the currently selected GraphicsNode.
|
void | setNodeIncrementEvent(InputEvent e)
Associates all InputEvents of type e.getID()
with "incrementing" of the currently selected GraphicsNode. |
void | setRootNode(GraphicsNode root)
Sets the root node for MouseEvent dispatch containment searches
and field selections. |
Parameters: l the listener to add
Parameters: l the listener to add
Parameters: l the listener to add
Parameters: evt the event to dispatch
Parameters: evt the key event to dispatch
Parameters: evt the mouse event to dispatch
Parameters: listenerType the type of the listeners to return
Parameters: e the input event
Parameters: evt the key event to propagate
Parameters: evt the key event to propagate
Parameters: evt the key event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the mouse event to propagate
Parameters: evt the evt to dispatch
Parameters: evt the event to process
Parameters: l the listener to remove
Parameters: l the listener to remove
Parameters: l the listener to remove
Parameters: t the affine transform
Parameters: root the root node