Package org.apache.batik.bridge
Class BridgeEventSupport.Listener
java.lang.Object
org.apache.batik.bridge.BridgeEventSupport.Listener
- All Implemented Interfaces:
EventListener
,GraphicsNodeKeyListener
,GraphicsNodeMouseListener
- Direct Known Subclasses:
SVG12BridgeEventSupport.Listener
- Enclosing class:
- BridgeEventSupport
protected static class BridgeEventSupport.Listener
extends Object
implements GraphicsNodeMouseListener, GraphicsNodeKeyListener
A GraphicsNodeMouseListener that dispatch DOM events accordingly.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BridgeContext
protected boolean
protected Element
protected UserAgent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
dispatchKeyEvent
(String eventType, GraphicsNodeKeyEvent evt) Dispatch a DOM 2 Draft Key event.protected void
dispatchMouseEvent
(String eventType, GraphicsNodeMouseEvent evt, boolean cancelable) Dispatches a DOM MouseEvent according to the specified parameters.protected void
dispatchMouseEvent
(String eventType, Element targetElement, Element relatedElement, Point clientXY, GraphicsNodeMouseEvent evt, boolean cancelable) Dispatches a DOM MouseEvent according to the specified parameters.protected Element
getEventTarget
(GraphicsNode node, Point2D pt) Returns the element that is the target of the specified event or null if any.protected Element
Returns the related element according to the specified event.void
Invoked when a key has been pressed.void
Invoked when a key has been released.void
Invoked when a key has been typed.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.void
Invoked when the mouse has been clicked on a graphics node.void
Invoked when a mouse button is pressed on a graphics node and then dragged.void
Invoked when the mouse enters a graphics node.void
Invoked when the mouse exits a graphics node.void
Invoked when the mouse button has been moved on a node.void
Invoked when a mouse button has been pressed on a graphics node.void
Invoked when a mouse button has been released on a graphics node.
-
Field Details
-
context
-
ua
-
lastTargetElement
-
isDown
protected boolean isDown
-
-
Constructor Details
-
Listener
-
-
Method Details
-
keyPressed
Invoked when a key has been pressed.- Specified by:
keyPressed
in interfaceGraphicsNodeKeyListener
- Parameters:
evt
- the graphics node key event
-
keyReleased
Invoked when a key has been released.- Specified by:
keyReleased
in interfaceGraphicsNodeKeyListener
- Parameters:
evt
- the graphics node key event
-
keyTyped
Invoked when a key has been typed.- Specified by:
keyTyped
in interfaceGraphicsNodeKeyListener
- Parameters:
evt
- the graphics node key event
-
dispatchKeyEvent
Dispatch a DOM 2 Draft 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
Description copied from interface:GraphicsNodeMouseListener
Invoked when the mouse has been clicked on a graphics node.- Specified by:
mouseClicked
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
mousePressed
Description copied from interface:GraphicsNodeMouseListener
Invoked when a mouse button has been pressed on a graphics node.- Specified by:
mousePressed
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
mouseReleased
Description copied from interface:GraphicsNodeMouseListener
Invoked when a mouse button has been released on a graphics node.- Specified by:
mouseReleased
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
mouseEntered
Description copied from interface:GraphicsNodeMouseListener
Invoked when the mouse enters a graphics node.- Specified by:
mouseEntered
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
mouseExited
Description copied from interface:GraphicsNodeMouseListener
Invoked when the mouse exits a graphics node.- Specified by:
mouseExited
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
mouseDragged
Description copied from interface:GraphicsNodeMouseListener
Invoked when a mouse button is pressed on a graphics node and then dragged.- Specified by:
mouseDragged
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
mouseMoved
Description copied from interface:GraphicsNodeMouseListener
Invoked when the mouse button has been moved on a node.- Specified by:
mouseMoved
in interfaceGraphicsNodeMouseListener
- Parameters:
evt
- the graphics node mouse event
-
dispatchMouseEvent
Dispatches a DOM MouseEvent according to the specified parameters.- Parameters:
eventType
- the event typeevt
- the GVT GraphicsNodeMouseEventcancelable
- 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 typetargetElement
- the target of the eventrelatedElement
- the related target if anyclientXY
- the mouse coordinates in the client spaceevt
- the GVT GraphicsNodeMouseEventcancelable
- true means the event is cancelable
-
getRelatedElement
Returns the related element according to the specified event.- Parameters:
evt
- the GVT GraphicsNodeMouseEvent
-
getEventTarget
Returns the element that is the target of the specified event or null if any.- Parameters:
node
- the graphics node that received the eventpt
- the mouse coordinates in the GVT tree space
-