org.vectomatic.dom.svg.impl
Class DOMHelperImpl

java.lang.Object
  extended by org.vectomatic.dom.svg.impl.DOMHelperImpl
Direct Known Subclasses:
DOMHelperImplIE

public class DOMHelperImpl
extends Object

Implementation class for low-level GWT integration (mostly event dispatching)

Author:
laaglu

Field Summary
protected  OMSVGElement captureElt
           
protected static boolean eventsInitialized
           
protected static int EVT_ABORT
           
protected static int EVT_ACTIVATE
           
protected static int EVT_BEGIN
           
protected static int EVT_CLICK
           
protected static int EVT_END
           
protected static int EVT_ERROR
           
protected static int EVT_FOCUSIN
           
protected static int EVT_FOCUSOUT
           
protected static int EVT_GESTURECHANGE
           
protected static int EVT_GESTUREEND
           
protected static int EVT_GESTURESTART
           
protected static int EVT_LOAD
           
protected static int EVT_LOOSECAPTURE
           
protected static int EVT_MOUSEDOWN
           
protected static int EVT_MOUSEMOVE
           
protected static int EVT_MOUSEOUT
           
protected static int EVT_MOUSEOVER
           
protected static int EVT_MOUSEUP
           
protected static int EVT_REPEAT
           
protected static int EVT_RESIZE
           
protected static int EVT_SCROLL
           
protected static int EVT_TOUCHCANCEL
           
protected static int EVT_TOUCHEND
           
protected static int EVT_TOUCHMOVE
           
protected static int EVT_TOUCHSTART
           
protected static int EVT_UNLOAD
           
protected static int EVT_ZOOM
           
 
Constructor Summary
DOMHelperImpl()
           
 
Method Summary
 void bindEventListener(com.google.gwt.dom.client.Element elem, String eventName)
          Makes a node sink the events emitted by the specified element
 void dispatch(com.google.gwt.dom.client.NativeEvent event, OMNode node, com.google.gwt.dom.client.Element elem)
          Central dispatching function for events emitted by DOM objects
 void dispatchCapturedEvent(com.google.gwt.dom.client.NativeEvent event, com.google.gwt.dom.client.Element elem)
          Dispatching function for events which result from a call to setCaptureElement(OMSVGElement, LoseCaptureHandler)
 boolean evaluateBooleanXPath_(com.google.gwt.dom.client.Element svgElement, String expr, XPathPrefixResolver resolver)
           
 com.google.gwt.core.client.JavaScriptObject evaluateNodeListXPath_(com.google.gwt.dom.client.Element svgElement, String expr, XPathPrefixResolver resolver)
           
 com.google.gwt.dom.client.Node evaluateNodeXPath_(com.google.gwt.dom.client.Element svgElement, String expr, XPathPrefixResolver resolver)
           
 float evaluateNumberXPath_(com.google.gwt.dom.client.Element svgElement, String expr, XPathPrefixResolver resolver)
           
 String evaluateStringXPath_(com.google.gwt.dom.client.Element svgElement, String expr, XPathPrefixResolver resolver)
           
 int eventGetTypeInt(String eventType)
          Returns the bit mask which corresponds to the specified event type
 OMSVGElement getCaptureElement()
          Returns the element which currently captures all the events after a call to setCaptureElement(OMSVGElement, LoseCaptureHandler) or null if element is set to capture events
 int getEventsSunk(com.google.gwt.dom.client.Element elem)
          Returns the event mask for the specified element
protected  void init()
           
protected  void initEventSystem()
          Initializes the event system.
protected  boolean isChildOf(com.google.gwt.dom.client.Node root, com.google.gwt.dom.client.Node node)
          Tests if a node is part of a DOM subtree.
 void releaseCaptureElement()
          Stops the forwarding of all events to the capturing element specified by setCaptureElement(OMSVGElement, LoseCaptureHandler)
 com.google.gwt.event.shared.HandlerRegistration setCaptureElement(OMSVGElement captureElt, com.google.gwt.event.dom.client.LoseCaptureHandler loseCaptureHandler)
          Makes the specified element capture all the events, until a call to releaseCaptureElement() terminates the capture
protected  void sinkEvents(com.google.gwt.dom.client.Element elem, int bits)
          Changes the event mask and activates the handler for the specified element
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventsInitialized

protected static boolean eventsInitialized

EVT_FOCUSIN

protected static final int EVT_FOCUSIN
See Also:
Constant Field Values

EVT_FOCUSOUT

protected static final int EVT_FOCUSOUT
See Also:
Constant Field Values

EVT_MOUSEDOWN

protected static final int EVT_MOUSEDOWN
See Also:
Constant Field Values

EVT_MOUSEUP

protected static final int EVT_MOUSEUP
See Also:
Constant Field Values

EVT_MOUSEOVER

protected static final int EVT_MOUSEOVER
See Also:
Constant Field Values

EVT_MOUSEOUT

protected static final int EVT_MOUSEOUT
See Also:
Constant Field Values

EVT_MOUSEMOVE

protected static final int EVT_MOUSEMOVE
See Also:
Constant Field Values

EVT_ACTIVATE

protected static final int EVT_ACTIVATE
See Also:
Constant Field Values

EVT_CLICK

protected static final int EVT_CLICK
See Also:
Constant Field Values

EVT_LOAD

protected static final int EVT_LOAD
See Also:
Constant Field Values

EVT_BEGIN

protected static final int EVT_BEGIN
See Also:
Constant Field Values

EVT_END

protected static final int EVT_END
See Also:
Constant Field Values

EVT_REPEAT

protected static final int EVT_REPEAT
See Also:
Constant Field Values

EVT_UNLOAD

protected static final int EVT_UNLOAD
See Also:
Constant Field Values

EVT_ABORT

protected static final int EVT_ABORT
See Also:
Constant Field Values

EVT_ERROR

protected static final int EVT_ERROR
See Also:
Constant Field Values

EVT_RESIZE

protected static final int EVT_RESIZE
See Also:
Constant Field Values

EVT_SCROLL

protected static final int EVT_SCROLL
See Also:
Constant Field Values

EVT_ZOOM

protected static final int EVT_ZOOM
See Also:
Constant Field Values

EVT_LOOSECAPTURE

protected static final int EVT_LOOSECAPTURE
See Also:
Constant Field Values

EVT_TOUCHSTART

protected static final int EVT_TOUCHSTART
See Also:
Constant Field Values

EVT_TOUCHEND

protected static final int EVT_TOUCHEND
See Also:
Constant Field Values

EVT_TOUCHMOVE

protected static final int EVT_TOUCHMOVE
See Also:
Constant Field Values

EVT_TOUCHCANCEL

protected static final int EVT_TOUCHCANCEL
See Also:
Constant Field Values

EVT_GESTURESTART

protected static final int EVT_GESTURESTART
See Also:
Constant Field Values

EVT_GESTURECHANGE

protected static final int EVT_GESTURECHANGE
See Also:
Constant Field Values

EVT_GESTUREEND

protected static final int EVT_GESTUREEND
See Also:
Constant Field Values

captureElt

protected OMSVGElement captureElt
Constructor Detail

DOMHelperImpl

public DOMHelperImpl()
Method Detail

initEventSystem

protected void initEventSystem()
Initializes the event system. Positions event handlers on the window so that they can capture events early if necessary.


eventGetTypeInt

public int eventGetTypeInt(String eventType)
Returns the bit mask which corresponds to the specified event type

Parameters:
eventType - The event type
Returns:
The bit mask associated to this event type

init

protected void init()

bindEventListener

public void bindEventListener(com.google.gwt.dom.client.Element elem,
                              String eventName)
Makes a node sink the events emitted by the specified element

Parameters:
elem - The element emitting the events
eventName - The event name

getCaptureElement

public OMSVGElement getCaptureElement()
Returns the element which currently captures all the events after a call to setCaptureElement(OMSVGElement, LoseCaptureHandler) or null if element is set to capture events

Returns:
The event capturing element

setCaptureElement

public com.google.gwt.event.shared.HandlerRegistration setCaptureElement(OMSVGElement captureElt,
                                                                         com.google.gwt.event.dom.client.LoseCaptureHandler loseCaptureHandler)
Makes the specified element capture all the events, until a call to releaseCaptureElement() terminates the capture

Parameters:
captureElt - The capturing element
loseCaptureHandler - A handler which will be invoked if the element loses capture
Returns:
HandlerRegistration used to remove this handler

releaseCaptureElement

public void releaseCaptureElement()
Stops the forwarding of all events to the capturing element specified by setCaptureElement(OMSVGElement, LoseCaptureHandler)


getEventsSunk

public int getEventsSunk(com.google.gwt.dom.client.Element elem)
Returns the event mask for the specified element

Parameters:
elem - The element
Returns:
The event mask for the specified element

sinkEvents

protected void sinkEvents(com.google.gwt.dom.client.Element elem,
                          int bits)
Changes the event mask and activates the handler for the specified element

Parameters:
elem - The object which emits events
bits - The event mask

dispatch

public void dispatch(com.google.gwt.dom.client.NativeEvent event,
                     OMNode node,
                     com.google.gwt.dom.client.Element elem)
Central dispatching function for events emitted by DOM objects

Parameters:
event - The DOM event
node - The object processing the event
elem - The object emitting the event

dispatchCapturedEvent

public void dispatchCapturedEvent(com.google.gwt.dom.client.NativeEvent event,
                                  com.google.gwt.dom.client.Element elem)
Dispatching function for events which result from a call to setCaptureElement(OMSVGElement, LoseCaptureHandler)

Parameters:
event - The DOM event
elem - The object emitting the event

isChildOf

protected boolean isChildOf(com.google.gwt.dom.client.Node root,
                            com.google.gwt.dom.client.Node node)
Tests if a node is part of a DOM subtree.

Parameters:
root - The subtree root
node - The node to be tested
Returns:
True if the node is part of the subtree, false otherwise

evaluateNodeListXPath_

public com.google.gwt.core.client.JavaScriptObject evaluateNodeListXPath_(com.google.gwt.dom.client.Element svgElement,
                                                                          String expr,
                                                                          XPathPrefixResolver resolver)

evaluateNodeXPath_

public com.google.gwt.dom.client.Node evaluateNodeXPath_(com.google.gwt.dom.client.Element svgElement,
                                                         String expr,
                                                         XPathPrefixResolver resolver)

evaluateStringXPath_

public String evaluateStringXPath_(com.google.gwt.dom.client.Element svgElement,
                                   String expr,
                                   XPathPrefixResolver resolver)

evaluateNumberXPath_

public float evaluateNumberXPath_(com.google.gwt.dom.client.Element svgElement,
                                  String expr,
                                  XPathPrefixResolver resolver)

evaluateBooleanXPath_

public boolean evaluateBooleanXPath_(com.google.gwt.dom.client.Element svgElement,
                                     String expr,
                                     XPathPrefixResolver resolver)


Copyright © 2012. All Rights Reserved.