Package org.apache.batik.bridge
Class BridgeEventSupport.Listener
- java.lang.Object
-
- org.apache.batik.bridge.BridgeEventSupport.Listener
-
- All Implemented Interfaces:
java.util.EventListener,GraphicsNodeKeyListener,GraphicsNodeMouseListener
- Direct Known Subclasses:
SVG12BridgeEventSupport.Listener
- Enclosing class:
- BridgeEventSupport
protected static class BridgeEventSupport.Listener extends java.lang.Object implements GraphicsNodeMouseListener, GraphicsNodeKeyListener
A GraphicsNodeMouseListener that dispatch DOM events accordingly.
-
-
Field Summary
Fields Modifier and Type Field Description protected BridgeContextcontextprotected booleanisDownprotected org.w3c.dom.ElementlastTargetElementprotected UserAgentua
-
Constructor Summary
Constructors Constructor Description Listener(BridgeContext ctx, UserAgent u)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddispatchKeyEvent(java.lang.String eventType, GraphicsNodeKeyEvent evt)Dispatch a DOM 2 Draft Key event.protected voiddispatchMouseEvent(java.lang.String eventType, GraphicsNodeMouseEvent evt, boolean cancelable)Dispatches a DOM MouseEvent according to the specified parameters.protected voiddispatchMouseEvent(java.lang.String eventType, org.w3c.dom.Element targetElement, org.w3c.dom.Element relatedElement, java.awt.Point clientXY, GraphicsNodeMouseEvent evt, boolean cancelable)Dispatches a DOM MouseEvent according to the specified parameters.protected org.w3c.dom.ElementgetEventTarget(GraphicsNode node, java.awt.geom.Point2D pt)Returns the element that is the target of the specified event or null if any.protected org.w3c.dom.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)Invoked when the mouse has been clicked on a graphics node.voidmouseDragged(GraphicsNodeMouseEvent evt)Invoked when a mouse button is pressed on a graphics node and then dragged.voidmouseEntered(GraphicsNodeMouseEvent evt)Invoked when the mouse enters a graphics node.voidmouseExited(GraphicsNodeMouseEvent evt)Invoked when the mouse exits a graphics node.voidmouseMoved(GraphicsNodeMouseEvent evt)Invoked when the mouse button has been moved on a node.voidmousePressed(GraphicsNodeMouseEvent evt)Invoked when a mouse button has been pressed on a graphics node.voidmouseReleased(GraphicsNodeMouseEvent evt)Invoked when a mouse button has been released on a graphics node.
-
-
-
Field Detail
-
context
protected BridgeContext context
-
ua
protected UserAgent ua
-
lastTargetElement
protected org.w3c.dom.Element lastTargetElement
-
isDown
protected boolean isDown
-
-
Constructor Detail
-
Listener
public Listener(BridgeContext ctx, UserAgent u)
-
-
Method Detail
-
keyPressed
public void keyPressed(GraphicsNodeKeyEvent evt)
Invoked when a key has been pressed.- Specified by:
keyPressedin interfaceGraphicsNodeKeyListener- Parameters:
evt- the graphics node key event
-
keyReleased
public void keyReleased(GraphicsNodeKeyEvent evt)
Invoked when a key has been released.- Specified by:
keyReleasedin interfaceGraphicsNodeKeyListener- Parameters:
evt- the graphics node key event
-
keyTyped
public void keyTyped(GraphicsNodeKeyEvent evt)
Invoked when a key has been typed.- Specified by:
keyTypedin interfaceGraphicsNodeKeyListener- Parameters:
evt- the graphics node key event
-
dispatchKeyEvent
protected void dispatchKeyEvent(java.lang.String eventType, GraphicsNodeKeyEvent evt)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
public void mouseClicked(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when the mouse has been clicked on a graphics node.- Specified by:
mouseClickedin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
mousePressed
public void mousePressed(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when a mouse button has been pressed on a graphics node.- Specified by:
mousePressedin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
mouseReleased
public void mouseReleased(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when a mouse button has been released on a graphics node.- Specified by:
mouseReleasedin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
mouseEntered
public void mouseEntered(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when the mouse enters a graphics node.- Specified by:
mouseEnteredin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
mouseExited
public void mouseExited(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when the mouse exits a graphics node.- Specified by:
mouseExitedin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
mouseDragged
public void mouseDragged(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when a mouse button is pressed on a graphics node and then dragged.- Specified by:
mouseDraggedin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
mouseMoved
public void mouseMoved(GraphicsNodeMouseEvent evt)
Description copied from interface:GraphicsNodeMouseListenerInvoked when the mouse button has been moved on a node.- Specified by:
mouseMovedin interfaceGraphicsNodeMouseListener- Parameters:
evt- the graphics node mouse event
-
dispatchMouseEvent
protected void dispatchMouseEvent(java.lang.String eventType, GraphicsNodeMouseEvent evt, boolean cancelable)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(java.lang.String eventType, org.w3c.dom.Element targetElement, org.w3c.dom.Element relatedElement, java.awt.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
protected org.w3c.dom.Element getRelatedElement(GraphicsNodeMouseEvent evt)
Returns the related element according to the specified event.- Parameters:
evt- the GVT GraphicsNodeMouseEvent
-
getEventTarget
protected org.w3c.dom.Element getEventTarget(GraphicsNode node, java.awt.geom.Point2D pt)
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
-
-