Package org.apache.flex.forks.batik.dom.events

Examples of org.apache.flex.forks.batik.dom.events.NodeEventTarget


        boolean preventDefault = false;
        // CAPTURING_PHASE : fire event listeners from top to EventTarget
        HashSet stoppedGroups = new HashSet();
        HashSet toBeStoppedGroups = new HashSet();
        for (int i = 0; i < minAncestor; i++) {
            NodeEventTarget node = ancestors[i];
//             System.err.println("\t--   CAPTURING " + e.getType() + "  " + ((Node) node).getNodeName());
            setCurrentTarget(es[i], node);
            setEventPhase(es[i], Event.CAPTURING_PHASE);
            fireImplementationEventListeners(node, es[i], true);
        }
        for (int i = minAncestor; i < ancestors.length; i++) {
            NodeEventTarget node = ancestors[i];
//             System.err.println("\t-- * CAPTURING " + e.getType() + "  " + ((Node) node).getNodeName());
            setCurrentTarget(es[i], node);
            setEventPhase(es[i], Event.CAPTURING_PHASE);
            fireImplementationEventListeners(node, es[i], true);
            fireEventListeners(node, es[i], true, stoppedGroups,
                               toBeStoppedGroups);
            fireHandlerGroupEventListeners(node, es[i], true, stoppedGroups,
                                           toBeStoppedGroups);
            preventDefault = preventDefault || es[i].getDefaultPrevented();
            stoppedGroups.addAll(toBeStoppedGroups);
            toBeStoppedGroups.clear();
        }
        // AT_TARGET : fire local event listeners
//         System.err.println("\t-- * AT_TARGET " + e.getType() + "  " + ((Node) target).getNodeName());
        setEventPhase(e, Event.AT_TARGET);
        setCurrentTarget(e, target);
        fireImplementationEventListeners(target, e, false);
        fireEventListeners(target, e, false, stoppedGroups,
                           toBeStoppedGroups);
        fireHandlerGroupEventListeners(node, e, false, stoppedGroups,
                                       toBeStoppedGroups);
        stoppedGroups.addAll(toBeStoppedGroups);
        toBeStoppedGroups.clear();
        preventDefault = preventDefault || e.getDefaultPrevented();
        // BUBBLING_PHASE : fire event listeners from target to top
        if (e.getBubbles()) {
            for (int i = ancestors.length - 1; i >= minAncestor; i--) {
                NodeEventTarget node = ancestors[i];
//                 System.err.println("\t-- * BUBBLING  " + e.getType() + "  " + ((Node) node).getNodeName());
                setCurrentTarget(es[i], node);
                setEventPhase(es[i], Event.BUBBLING_PHASE);
                fireImplementationEventListeners(node, es[i], false);
                fireEventListeners(node, es[i], false, stoppedGroups,
                                   toBeStoppedGroups);
                fireHandlerGroupEventListeners
                    (node, es[i], false, stoppedGroups, toBeStoppedGroups);
                preventDefault =
                    preventDefault || es[i].getDefaultPrevented();
                stoppedGroups.addAll(toBeStoppedGroups);
                toBeStoppedGroups.clear();
            }
            for (int i = minAncestor - 1; i >= 0; i--) {
                NodeEventTarget node = ancestors[i];
//                 System.err.println("\t--   BUBBLING  " + e.getType() + "  " + ((Node) node).getNodeName());
                setCurrentTarget(es[i], node);
                setEventPhase(es[i], Event.BUBBLING_PHASE);
                fireImplementationEventListeners(node, es[i], false);
                preventDefault =
View Full Code Here


    /**
     * Adds the event listeners to the document.
     */
    protected void addEventListeners(Document doc) {
        NodeEventTarget target = (NodeEventTarget) doc;

        mouseclickListener = new MouseClickTracker();
        target.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             "click",
             mouseclickListener, true, null);

        mouseoverListener = new MouseOverTracker();
        target.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             "mouseover",
             mouseoverListener, true, null);

        mouseoutListener = new MouseOutTracker();
        target.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             "mouseout",
             mouseoutListener, true, null);

        domFocusInListener = new DOMFocusInTracker();
        target.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             "DOMFocusIn",
             domFocusInListener, true, null);

        domFocusOutListener = new DOMFocusOutTracker();
        target.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             "DOMFocusOut",
             domFocusOutListener, true, null);
    }
View Full Code Here

    /**
     * Removes the event listeners from the document.
     */
    protected void removeEventListeners(Document doc) {
        NodeEventTarget target = (NodeEventTarget) doc;

        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "click",
             mouseclickListener, true);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseover",
             mouseoverListener, true);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseout",
             mouseoutListener, true);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusIn",
             domFocusInListener, true);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusOut",
             domFocusOutListener, true);
    }
View Full Code Here

     * Initializes this timing specifier by adding the initial instance time
     * to the owner's instance time list or setting up any event listeners.
     */
    public void initialize() {
        if (isSVG12AccessKey) {
            NodeEventTarget eventTarget =
                (NodeEventTarget) owner.getRootEventTarget();
            eventTarget.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keydown",
                 this, false, null);
        } else {
            EventTarget eventTarget = owner.getRootEventTarget();
            eventTarget.addEventListener("keypress", this, false);
        }
    }
View Full Code Here

    /**
     * Deinitializes this timing specifier by removing any event listeners.
     */
    public void deinitialize() {
        if (isSVG12AccessKey) {
            NodeEventTarget eventTarget =
                (NodeEventTarget) owner.getRootEventTarget();
            eventTarget.removeEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keydown",
                 this, false);
        } else {
            EventTarget eventTarget = owner.getRootEventTarget();
            eventTarget.removeEventListener("keypress", this, false);
        }
    }
View Full Code Here

        String domEvt = (String) attrToDOMEvent.get(attr);
        if (domEvt == null) {
            return// Not an event attr.
        }
        EventListener listener = (EventListener) attrToListener.get(attr);
        NodeEventTarget target = (NodeEventTarget) elt;
        if (elt.hasAttributeNS(null, attr)) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, domEvt,
                 listener, false, null);
        } else {
            target.removeEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, domEvt,
                 listener, false);
        }
    }
View Full Code Here

     */
    protected void addDocumentListeners() {
        domNodeInsertedListener = new DOMNodeInsertedListener();
        domNodeRemovedListener = new DOMNodeRemovedListener();
        domAttrModifiedListener = new DOMAttrModifiedListener();
        NodeEventTarget et = (NodeEventTarget) document;
        et.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted",
             domNodeInsertedListener, false, null);
        et.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
             domNodeRemovedListener, false, null);
        et.addEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified",
             domAttrModifiedListener, false, null);
    }
View Full Code Here

    /**
     * Removes DOM listeners from the document.
     */
    protected void removeDocumentListeners() {
        NodeEventTarget et = (NodeEventTarget) document;
        et.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeInserted",
             domNodeInsertedListener, false);
        et.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMNodeRemoved",
             domNodeRemovedListener, false);
        et.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified",
             domAttrModifiedListener, false);
    }
View Full Code Here

    /**
     * Adds the scripting listeners to the given element.
     */
    protected void addScriptingListenersOn(Element elt) {
        // Attach the listeners
        NodeEventTarget target = (NodeEventTarget)elt;
        if (SVGConstants.SVG_NAMESPACE_URI.equals(elt.getNamespaceURI())) {
            if (SVGConstants.SVG_SVG_TAG.equals(elt.getLocalName())) {
                // <svg> listeners
                if (elt.hasAttributeNS(null, "onabort")) {
                    target.addEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGAbort",
                         svgAbortListener, false, null);
                }
                if (elt.hasAttributeNS(null, "onerror")) {
                    target.addEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGError",
                         svgErrorListener, false, null);
                }
                if (elt.hasAttributeNS(null, "onresize")) {
                    target.addEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGResize",
                         svgResizeListener, false, null);
                }
                if (elt.hasAttributeNS(null, "onscroll")) {
                    target.addEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGScroll",
                         svgScrollListener, false, null);
                }
                if (elt.hasAttributeNS(null, "onunload")) {
                    target.addEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGUnload",
                         svgUnloadListener, false, null);
                }
                if (elt.hasAttributeNS(null, "onzoom")) {
                    target.addEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGZoom",
                         svgZoomListener, false, null);
                }
            } else {
                String name = elt.getLocalName();
                if (name.equals(SVGConstants.SVG_SET_TAG) ||
                    name.startsWith("animate")) {
                    // animation listeners
                    if (elt.hasAttributeNS(null, "onbegin")) {
                        target.addEventListenerNS
                            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "beginEvent",
                             beginListener, false, null);
                    }
                    if (elt.hasAttributeNS(null, "onend")) {
                        target.addEventListenerNS
                            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "endEvent",
                             endListener, false, null);
                    }
                    if (elt.hasAttributeNS(null, "onrepeat")) {
                        target.addEventListenerNS
                            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "repeatEvent",
                             repeatListener, false, null);
                    }
                    return;
                }
            }
        }

        // UI listeners
        if (elt.hasAttributeNS(null, "onfocusin")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusIn",
                 focusinListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onfocusout")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusOut",
                 focusoutListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onactivate")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMActivate",
                 activateListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onclick")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "click",
                 clickListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onmousedown")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mousedown",
                 mousedownListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onmouseup")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseup",
                 mouseupListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onmouseover")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseover",
                 mouseoverListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onmouseout")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseout",
                 mouseoutListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onmousemove")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mousemove",
                 mousemoveListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onkeypress")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keypress",
                 keypressListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onkeydown")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keydown",
                 keydownListener, false, null);
        }
        if (elt.hasAttributeNS(null, "onkeyup")) {
            target.addEventListenerNS
                (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keyup",
                 keyupListener, false, null);
        }
    }
View Full Code Here

    /**
     * Removes the scripting listeners from the given element.
     */
    protected void removeScriptingListenersOn(Element elt) {
        NodeEventTarget target = (NodeEventTarget)elt;
        if (SVGConstants.SVG_NAMESPACE_URI.equals(elt.getNamespaceURI())) {
            if (SVGConstants.SVG_SVG_TAG.equals(elt.getLocalName())) {
                // <svg> listeners
                target.removeEventListenerNS
                    (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGAbort",
                     svgAbortListener, false);
                target.removeEventListenerNS
                    (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGError",
                     svgErrorListener, false);
                target.removeEventListenerNS
                    (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGResize",
                     svgResizeListener, false);
                target.removeEventListenerNS
                    (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGScroll",
                     svgScrollListener, false);
                target.removeEventListenerNS
                    (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGUnload",
                     svgUnloadListener, false);
                target.removeEventListenerNS
                    (XMLConstants.XML_EVENTS_NAMESPACE_URI, "SVGZoom",
                     svgZoomListener, false);
            } else {
                String name = elt.getLocalName();
                if (name.equals(SVGConstants.SVG_SET_TAG) ||
                    name.startsWith("animate")) {
                    // animation listeners
                    target.removeEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "beginEvent",
                         beginListener, false);
                    target.removeEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "endEvent",
                         endListener, false);
                    target.removeEventListenerNS
                        (XMLConstants.XML_EVENTS_NAMESPACE_URI, "repeatEvent",
                         repeatListener , false);
                    return;
                }
            }
        }

        // UI listeners
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusIn",
             focusinListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMFocusOut",
             focusoutListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMActivate",
             activateListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "click",
             clickListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mousedown",
             mousedownListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseup",
             mouseupListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseover",
             mouseoverListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mouseout",
             mouseoutListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "mousemove",
             mousemoveListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keypress",
             keypressListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keydown",
             keydownListener, false);
        target.removeEventListenerNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI, "keyup",
             keyupListener, false);
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.forks.batik.dom.events.NodeEventTarget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.