Example usage for com.google.gwt.dom.client NativeEvent getRelatedEventTarget

List of usage examples for com.google.gwt.dom.client NativeEvent getRelatedEventTarget

Introduction

In this page you can find the example usage for com.google.gwt.dom.client NativeEvent getRelatedEventTarget.

Prototype

public final EventTarget getRelatedEventTarget() 

Source Link

Document

Gets the related target for this event.

Usage

From source file:org.vectomatic.dnd.DropPanel.java

License:Open Source License

/**
 * Dispatches the specified event to this node
 * event handlers//  ww  w .java  2 s  .c  om
 * @param event The event to dispatch
 */
public void dispatch(NativeEvent event) {
    // dragenter and dragleave deserve special treatment
    // to solve issues described in:
    // http://www.quirksmode.org/js/events_mouse.html
    if ("dragenter".equals(event.getType()) || "dragleave".equals(event.getType())) {
        if (isChildOf((Node) event.getCurrentEventTarget().cast(),
                (Node) event.getRelatedEventTarget().cast())) {
            return;
        }
    }
    // This call wraps the native event into a DomEvent
    // and invokes fireEvent
    DomEvent.fireNativeEvent(event, this, (Element) event.getCurrentEventTarget().cast());
}

From source file:org.vectomatic.dom.svg.impl.DOMHelperImpl.java

License:Open Source License

/**
 * Central dispatching function for events emitted by DOM objects
 * @param event The DOM event/*ww w .j a va2s .c o m*/
 * @param node The object processing the event
 * @param elem The object emitting the event
 */
public void dispatch(NativeEvent event, OMNode node, Element elem) {
    //Window.alert("type=" + event.getType());
    switch (eventGetTypeInt(event.getType())) {
    // Mouseover and mouseout deserve special treatment
    // to solve issues described in:
    // http://www.quirksmode.org/js/events_mouse.html
    // For SVG, it seems better to test against the tree rooted at
    // evt.currentTarget than againt the subtree rooted at evt.target
    case EVT_MOUSEOVER:
    case EVT_MOUSEOUT:
        if (isChildOf((Node) event.getCurrentEventTarget().cast(),
                (Node) event.getRelatedEventTarget().cast())) {
            return;
        }
        break;
    }
    node.dispatch(event);
}