org.apache.batik.bridge

Class BridgeEventSupport.Listener

protected static class BridgeEventSupport.Listener extends Object implements GraphicsNodeMouseListener, GraphicsNodeKeyListener

A GraphicsNodeMouseListener that dispatch DOM events accordingly.
Field Summary
protected BridgeContextcontext
protected booleanisDown
protected ElementlastTargetElement
protected UserAgentua
Constructor Summary
Listener(BridgeContext ctx, UserAgent u)
Method Summary
protected voiddispatchKeyEvent(String eventType, GraphicsNodeKeyEvent evt)
Dispatch a DOM 2 Draft Key event.
protected voiddispatchMouseEvent(String eventType, GraphicsNodeMouseEvent evt, boolean cancelable)
Dispatches a DOM MouseEvent according to the specified parameters.
protected voiddispatchMouseEvent(String eventType, Element targetElement, Element relatedElement, Point clientXY, GraphicsNodeMouseEvent evt, boolean cancelable)
Dispatches a DOM MouseEvent according to the specified parameters.
protected shortgetButton(GraphicsNodeMouseEvent evt)
Returns the mouse event button.
protected ElementgetEventTarget(GraphicsNode node, Point2D coords)
Returns the element that is the target of the specified event or null if any.
protected ElementgetRelatedElement(GraphicsNodeMouseEvent evt)
Returns the related element according to the specified event.
voidkeyPressed(GraphicsNodeKeyEvent evt)
Invoked when a key has been pressed.
voidkeyReleased(GraphicsNodeKeyEvent evt)
Invoked when a key has been released.
voidkeyTyped(GraphicsNodeKeyEvent evt)
Invoked when a key has been typed.
protected intmapKeyCode(int keyCode)
The java KeyEvent keyCodes and the DOMKeyEvent keyCodes map except for the VK_ENTER code (which has a different value in DOM and the VK_KANA_LOCK and VK_INPUT_METHOD_ON_OFF which have no DOM equivalent.
voidmouseClicked(GraphicsNodeMouseEvent evt)
voidmouseDragged(GraphicsNodeMouseEvent evt)
voidmouseEntered(GraphicsNodeMouseEvent evt)
voidmouseExited(GraphicsNodeMouseEvent evt)
voidmouseMoved(GraphicsNodeMouseEvent evt)
voidmousePressed(GraphicsNodeMouseEvent evt)
voidmouseReleased(GraphicsNodeMouseEvent evt)

Field Detail

context

protected BridgeContext context

isDown

protected boolean isDown

lastTargetElement

protected Element lastTargetElement

ua

protected UserAgent ua

Constructor Detail

Listener

public Listener(BridgeContext ctx, UserAgent u)

Method Detail

dispatchKeyEvent

protected void dispatchKeyEvent(String eventType, GraphicsNodeKeyEvent evt)
Dispatch a DOM 2 Draft Key event.

dispatchMouseEvent

protected void dispatchMouseEvent(String eventType, GraphicsNodeMouseEvent evt, boolean cancelable)
Dispatches a DOM MouseEvent according to the specified parameters.

Parameters: eventType the event type evt the GVT GraphicsNodeMouseEvent cancelable true means the event is cancelable

dispatchMouseEvent

protected void dispatchMouseEvent(String eventType, Element targetElement, Element relatedElement, Point clientXY, GraphicsNodeMouseEvent evt, boolean cancelable)
Dispatches a DOM MouseEvent according to the specified parameters.

Parameters: eventType the event type targetElement the target of the event relatedElement the related target if any clientXY the mouse coordinates in the client space evt the GVT GraphicsNodeMouseEvent cancelable true means the event is cancelable

getButton

protected short getButton(GraphicsNodeMouseEvent evt)
Returns the mouse event button.

Parameters: evt the GVT GraphicsNodeMouseEvent

getEventTarget

protected Element getEventTarget(GraphicsNode node, Point2D coords)
Returns the element that is the target of the specified event or null if any.

Parameters: node the graphics node that received the event coords the mouse coordinates in the GVT tree space

getRelatedElement

protected Element getRelatedElement(GraphicsNodeMouseEvent evt)
Returns the related element according to the specified event.

Parameters: evt the GVT GraphicsNodeMouseEvent

keyPressed

public void keyPressed(GraphicsNodeKeyEvent evt)
Invoked when a key has been pressed.

Parameters: evt the graphics node key event

keyReleased

public void keyReleased(GraphicsNodeKeyEvent evt)
Invoked when a key has been released.

Parameters: evt the graphics node key event

keyTyped

public void keyTyped(GraphicsNodeKeyEvent evt)
Invoked when a key has been typed.

Parameters: evt the graphics node key event

mapKeyCode

protected final int mapKeyCode(int keyCode)
The java KeyEvent keyCodes and the DOMKeyEvent keyCodes map except for the VK_ENTER code (which has a different value in DOM and the VK_KANA_LOCK and VK_INPUT_METHOD_ON_OFF which have no DOM equivalent.

mouseClicked

public void mouseClicked(GraphicsNodeMouseEvent evt)

mouseDragged

public void mouseDragged(GraphicsNodeMouseEvent evt)

mouseEntered

public void mouseEntered(GraphicsNodeMouseEvent evt)

mouseExited

public void mouseExited(GraphicsNodeMouseEvent evt)

mouseMoved

public void mouseMoved(GraphicsNodeMouseEvent evt)

mousePressed

public void mousePressed(GraphicsNodeMouseEvent evt)

mouseReleased

public void mouseReleased(GraphicsNodeMouseEvent evt)
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.