|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.batik.gvt.event.AbstractAWTEventDispatcher
public abstract class AbstractAWTEventDispatcher
An EventDispatcher implementation based on AWT events.
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GraphicsNode root
protected AffineTransform baseTransform
protected EventListenerList glisteners
protected GraphicsNode lastHit
protected GraphicsNode currentKeyEventTarget
protected List eventQueue
protected boolean eventDispatchEnabled
protected int eventQueueMaxSize
| Constructor Detail |
|---|
public AbstractAWTEventDispatcher()
| Method Detail |
|---|
public void setRootNode(GraphicsNode root)
setRootNode in interface EventDispatcherroot - the root nodepublic GraphicsNode getRootNode()
getRootNode in interface EventDispatcherpublic void setBaseTransform(AffineTransform t)
setBaseTransform in interface EventDispatchert - the affine transformpublic AffineTransform getBaseTransform()
getBaseTransform in interface EventDispatcherpublic void mousePressed(MouseEvent evt)
mousePressed in interface MouseListenerevt - the mouse event to propagatepublic void mouseReleased(MouseEvent evt)
mouseReleased in interface MouseListenerevt - the mouse event to propagatepublic void mouseEntered(MouseEvent evt)
mouseEntered in interface MouseListenerevt - the mouse event to propagatepublic void mouseExited(MouseEvent evt)
mouseExited in interface MouseListenerevt - the mouse event to propagatepublic void mouseClicked(MouseEvent evt)
mouseClicked in interface MouseListenerevt - the mouse event to propagatepublic void mouseMoved(MouseEvent evt)
mouseMoved in interface MouseMotionListenerevt - the mouse event to propagatepublic void mouseDragged(MouseEvent evt)
mouseDragged in interface MouseMotionListenerevt - the mouse event to propagatepublic void keyPressed(KeyEvent evt)
keyPressed in interface KeyListenerevt - the key event to propagatepublic void keyReleased(KeyEvent evt)
keyReleased in interface KeyListenerevt - the key event to propagatepublic void keyTyped(KeyEvent evt)
keyTyped in interface KeyListenerevt - the key event to propagatepublic void addGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
addGraphicsNodeMouseListener in interface EventDispatcherl - the listener to addpublic void removeGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
removeGraphicsNodeMouseListener in interface EventDispatcherl - the listener to removepublic void addGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
addGraphicsNodeMouseWheelListener in interface EventDispatcherl - the listener to addpublic void removeGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
removeGraphicsNodeMouseWheelListener in interface EventDispatcherl - the listener to removepublic void addGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
addGraphicsNodeKeyListener in interface EventDispatcherl - the listener to addpublic void removeGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
removeGraphicsNodeKeyListener in interface EventDispatcherl - the listener to removepublic EventListener[] getListeners(Class listenerType)
getListeners in interface EventDispatcherlistenerType - the type of the listeners to returnpublic void setEventDispatchEnabled(boolean b)
public void setEventQueueMaxSize(int n)
public void dispatchEvent(EventObject evt)
dispatchEvent in interface EventDispatcherevt - the event to dispatchprotected int getCurrentLockState()
protected abstract void dispatchKeyEvent(KeyEvent evt)
evt - the key event to dispatchprotected abstract int getModifiers(InputEvent evt)
InputEvent.getModifiers() in JRE 1.3 or
InputEvent.getModifiersEx() in JREs >= 1.4.
protected abstract int getButton(MouseEvent evt)
InputEvent.getModifiers() in JRE
1.3 or MouseEvent.getButton() in JREs >= 1.4.
protected void dispatchMouseEvent(MouseEvent evt)
evt - the mouse event to dispatchprotected void processMouseEvent(GraphicsNodeMouseEvent evt)
evt - the event to processpublic void processKeyEvent(GraphicsNodeKeyEvent evt)
evt - the evt to dispatchpublic void setNodeIncrementEvent(InputEvent e)
setNodeIncrementEvent in interface EventDispatcherpublic void setNodeDecrementEvent(InputEvent e)
setNodeDecrementEvent in interface EventDispatcherprotected boolean isNodeIncrementEvent(InputEvent e)
e - the input eventprotected boolean isNodeDecrementEvent(InputEvent e)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||