org.apache.batik.bridge
Class BridgeEventSupport.Listener

java.lang.Object
  extended by 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
protected  BridgeContext context
           
protected  boolean isDown
           
protected  Element lastTargetElement
           
protected  UserAgent ua
           
 
Constructor Summary
BridgeEventSupport.Listener(BridgeContext ctx, UserAgent u)
           
 
Method Summary
protected  void dispatchKeyEvent(String eventType, GraphicsNodeKeyEvent evt)
          Dispatch a DOM 2 Draft Key event.
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  void dispatchMouseEvent(String eventType, GraphicsNodeMouseEvent evt, boolean cancelable)
          Dispatches a DOM MouseEvent according to the specified parameters.
protected  Element getEventTarget(GraphicsNode node, Point2D coords)
          Returns the element that is the target of the specified event or null if any.
protected  Element getRelatedElement(GraphicsNodeMouseEvent evt)
          Returns the related element according to the specified event.
 void keyPressed(GraphicsNodeKeyEvent evt)
          Invoked when a key has been pressed.
 void keyReleased(GraphicsNodeKeyEvent evt)
          Invoked when a key has been released.
 void keyTyped(GraphicsNodeKeyEvent evt)
          Invoked when a key has been typed.
protected  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 mouseClicked(GraphicsNodeMouseEvent evt)
          Invoked when the mouse has been clicked on a graphics node.
 void mouseDragged(GraphicsNodeMouseEvent evt)
          Invoked when a mouse button is pressed on a graphics node and then dragged.
 void mouseEntered(GraphicsNodeMouseEvent evt)
          Invoked when the mouse enters a graphics node.
 void mouseExited(GraphicsNodeMouseEvent evt)
          Invoked when the mouse exits a graphics node.
 void mouseMoved(GraphicsNodeMouseEvent evt)
          Invoked when the mouse button has been moved on a node.
 void mousePressed(GraphicsNodeMouseEvent evt)
          Invoked when a mouse button has been pressed on a graphics node.
 void mouseReleased(GraphicsNodeMouseEvent evt)
          Invoked when a mouse button has been released on a graphics node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected BridgeContext context

ua

protected UserAgent ua

lastTargetElement

protected Element lastTargetElement

isDown

protected boolean isDown
Constructor Detail

BridgeEventSupport.Listener

public BridgeEventSupport.Listener(BridgeContext ctx,
                                   UserAgent u)
Method Detail

keyPressed

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

Specified by:
keyPressed in interface GraphicsNodeKeyListener
Parameters:
evt - the graphics node key event

keyReleased

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

Specified by:
keyReleased in interface GraphicsNodeKeyListener
Parameters:
evt - the graphics node key event

keyTyped

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

Specified by:
keyTyped in interface GraphicsNodeKeyListener
Parameters:
evt - the graphics node key event

dispatchKeyEvent

protected void dispatchKeyEvent(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: GraphicsNodeMouseListener
Invoked when the mouse has been clicked on a graphics node.

Specified by:
mouseClicked in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse event

mousePressed

public void mousePressed(GraphicsNodeMouseEvent evt)
Description copied from interface: GraphicsNodeMouseListener
Invoked when a mouse button has been pressed on a graphics node.

Specified by:
mousePressed in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse event

mouseReleased

public void mouseReleased(GraphicsNodeMouseEvent evt)
Description copied from interface: GraphicsNodeMouseListener
Invoked when a mouse button has been released on a graphics node.

Specified by:
mouseReleased in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse event

mouseEntered

public void mouseEntered(GraphicsNodeMouseEvent evt)
Description copied from interface: GraphicsNodeMouseListener
Invoked when the mouse enters a graphics node.

Specified by:
mouseEntered in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse event

mouseExited

public void mouseExited(GraphicsNodeMouseEvent evt)
Description copied from interface: GraphicsNodeMouseListener
Invoked when the mouse exits a graphics node.

Specified by:
mouseExited in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse event

mouseDragged

public void mouseDragged(GraphicsNodeMouseEvent evt)
Description copied from interface: GraphicsNodeMouseListener
Invoked when a mouse button is pressed on a graphics node and then dragged.

Specified by:
mouseDragged in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse event

mouseMoved

public void mouseMoved(GraphicsNodeMouseEvent evt)
Description copied from interface: GraphicsNodeMouseListener
Invoked when the mouse button has been moved on a node.

Specified by:
mouseMoved in interface GraphicsNodeMouseListener
Parameters:
evt - the graphics node mouse 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

getRelatedElement

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

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


Copyright © 2008 Apache Software Foundation. All Rights Reserved.