org.apache.batik.gvt.event

Interface EventDispatcher

public interface EventDispatcher

Interface for receiving and dispatching events down to a GVT tree.

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.

Method Summary
voidaddGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Adds the specified 'global' GraphicsNodeKeyListener which is notified of all KeyEvents dispatched.
voidaddGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Adds the specified 'global' GraphicsNodeMouseListener which is notified of all MouseEvents dispatched.
voidaddGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
Adds the specified 'global' GraphicsNodeMouseWheelListener which is notified of all MouseWheelEvents dispatched.
voiddispatchEvent(EventObject e)
Dispatched the specified event object.
AffineTransformgetBaseTransform()
Returns the base transform applied to MouseEvent coordinates prior to dispatch.
EventListener[]getListeners(Class listenerType)
Returns an array of listeners that were added to this event dispatcher and of the specified type.
GraphicsNodegetRootNode()
Returns the root node for MouseEvent dispatch containment searches and field selections.
voidremoveGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Removes the specified 'global' GraphicsNodeKeyListener which is notified of all KeyEvents dispatched.
voidremoveGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Removes the specified 'global' GraphicsNodeMouseListener which is notified of all MouseEvents dispatched.
voidremoveGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
Removes the specified 'global' GraphicsNodeMouseWheelListener which is notified of all MouseWheelEvents dispatched.
voidsetBaseTransform(AffineTransform t)
Sets the base transform applied to MouseEvent coordinates prior to dispatch.
voidsetNodeDecrementEvent(InputEvent e)
Associates all InputEvents of type e.getID() with "decrementing" of the currently selected GraphicsNode.
voidsetNodeIncrementEvent(InputEvent e)
Associates all InputEvents of type e.getID() with "incrementing" of the currently selected GraphicsNode.
voidsetRootNode(GraphicsNode root)
Sets the root node for MouseEvent dispatch containment searches and field selections.

Method Detail

addGraphicsNodeKeyListener

public void addGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Adds the specified 'global' GraphicsNodeKeyListener which is notified of all KeyEvents dispatched.

Parameters: l the listener to add

addGraphicsNodeMouseListener

public void addGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Adds the specified 'global' GraphicsNodeMouseListener which is notified of all MouseEvents dispatched.

Parameters: l the listener to add

addGraphicsNodeMouseWheelListener

public void addGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
Adds the specified 'global' GraphicsNodeMouseWheelListener which is notified of all MouseWheelEvents dispatched.

Parameters: l the listener to add

dispatchEvent

public void dispatchEvent(EventObject e)
Dispatched the specified event object.

Converts the EventObject to a corresponding GraphicsNodeEvent and dispatch it to the appropriate GraphicsNode(s). If the event is a MouseEvent the dispatch is performed to each GraphicsNode which contains the MouseEvent coordinate, until the event is consumed. If the event is a KeyEvent, it is dispatched to the currently selected GraphicsNode.

Parameters: e the event to dispatch

getBaseTransform

public AffineTransform getBaseTransform()
Returns the base transform applied to MouseEvent coordinates prior to dispatch.

getListeners

public EventListener[] getListeners(Class listenerType)
Returns an array of listeners that were added to this event dispatcher and of the specified type.

Parameters: listenerType the type of the listeners to return

getRootNode

public GraphicsNode getRootNode()
Returns the root node for MouseEvent dispatch containment searches and field selections.

removeGraphicsNodeKeyListener

public void removeGraphicsNodeKeyListener(GraphicsNodeKeyListener l)
Removes the specified 'global' GraphicsNodeKeyListener which is notified of all KeyEvents dispatched.

Parameters: l the listener to remove

removeGraphicsNodeMouseListener

public void removeGraphicsNodeMouseListener(GraphicsNodeMouseListener l)
Removes the specified 'global' GraphicsNodeMouseListener which is notified of all MouseEvents dispatched.

Parameters: l the listener to remove

removeGraphicsNodeMouseWheelListener

public void removeGraphicsNodeMouseWheelListener(GraphicsNodeMouseWheelListener l)
Removes the specified 'global' GraphicsNodeMouseWheelListener which is notified of all MouseWheelEvents dispatched.

Parameters: l the listener to remove

setBaseTransform

public void setBaseTransform(AffineTransform t)
Sets the base transform applied to MouseEvent coordinates prior to dispatch.

Parameters: t the affine transform

setNodeDecrementEvent

public void setNodeDecrementEvent(InputEvent e)
Associates all InputEvents of type e.getID() with "decrementing" of the currently selected GraphicsNode. The notion of "currently selected" GraphicsNode is used for dispatching KeyEvents.

setNodeIncrementEvent

public void setNodeIncrementEvent(InputEvent e)
Associates all InputEvents of type e.getID() with "incrementing" of the currently selected GraphicsNode.

setRootNode

public void setRootNode(GraphicsNode root)
Sets the root node for MouseEvent dispatch containment searches and field selections.

Parameters: root the root node

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.