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

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


            throw createEventException
                (DOMException.NOT_SUPPORTED_ERR,
                 "unsupported.event",
                 new Object[] {});
        }
        AbstractEvent e = (AbstractEvent) evt;
        String type = e.getType();
        if (type == null || type.length() == 0) {
            throw createEventException
                (EventException.UNSPECIFIED_EVENT_TYPE_ERR,
                 "unspecified.event",
                 new Object[] {});
        }
        // fix event status
        setTarget(e, target);
        stopPropagation(e, false);
        stopImmediatePropagation(e, false);
        preventDefault(e, false);
        // dump the tree hierarchy from top to the target
        NodeEventTarget[] ancestors = getAncestors(target);
        int bubbleLimit = e.getBubbleLimit();
        int minAncestor = 0;
        if (isSingleScopeEvent(e)) {
            // DOM Mutation events are dispatched only within the
            // one shadow scope
            AbstractNode targetNode = (AbstractNode) target;
            Node boundElement = targetNode.getXblBoundElement();
            if (boundElement != null) {
                minAncestor = ancestors.length;
                while (minAncestor > 0) {
                    AbstractNode ancestorNode =
                        (AbstractNode) ancestors[minAncestor - 1];
                    if (ancestorNode.getXblBoundElement() != boundElement) {
                        break;
                    }
                    minAncestor--;
                }
            }
        } else if (bubbleLimit != 0) {
            // Other events may have a bubble limit (such as UI events)
            minAncestor = ancestors.length - bubbleLimit + 1;
            if (minAncestor < 0) {
                minAncestor = 0;
            }
        }
//         System.err.println("\t== ancestors:");
//         for (int i = 0; i < ancestors.length; i++) {
//             if (i < minAncestor) {
//                 System.err.print("\t     ");
//             } else {
//                 System.err.print("\t   * ");
//             }
//             System.err.println(((Node) ancestors[i]).getNodeName());
//         }
        AbstractEvent[] es = getRetargettedEvents(target, ancestors, e);
        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);
View Full Code Here


    /**
     * Clones and retargets the given event.
     */
    protected AbstractEvent retargetEvent(AbstractEvent e,
                                          NodeEventTarget target) {
        AbstractEvent clonedEvent = e.cloneEvent();
        setTarget(clonedEvent, target);
        return clonedEvent;
    }
View Full Code Here

            holder    = ch;
        }

        public void handleEvent(Event evt) {
            if (!(evt instanceof AbstractEvent)) return;
            final AbstractEvent ae = (AbstractEvent)evt;

            List l = ae.getDefaultActions();
            if (l != null) {
                Iterator i = l.iterator();
                while (i.hasNext()) {
                    Object o = i.next();
                    if (o instanceof AnchorDefaultActionable)
                        return; // only one anchor in default list...
                }
            }


            SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
            ae.addDefaultAction(new AnchorDefaultActionable
                                (elt, userAgent, holder));
        }
View Full Code Here

            holder    = ch;
        }

        public void handleEvent(Event evt) {
            if (!(evt instanceof AbstractEvent)) return;
            final AbstractEvent ae = (AbstractEvent)evt;

            List l = ae.getDefaultActions();
            if (l != null) {
                Iterator i = l.iterator();
                while (i.hasNext()) {
                    Object o = i.next();
                    if (o instanceof MouseOverDefaultActionable)
                        return; // only one anchor in default list...
                }
            }

            Element     target     = (Element)ae.getTarget();
            SVGAElement elt        = (SVGAElement)ae.getCurrentTarget();
           
            ae.addDefaultAction(new MouseOverDefaultActionable
                                (target, elt, userAgent, holder));
        }
View Full Code Here

            holder    = ch;
        }

        public void handleEvent(Event evt) {
            if (!(evt instanceof AbstractEvent)) return;
            final AbstractEvent ae = (AbstractEvent)evt;
           
            List l = ae.getDefaultActions();
            if (l != null) {
                Iterator i = l.iterator();
                while (i.hasNext()) {
                    Object o = i.next();
                    if (o instanceof MouseOutDefaultActionable)
                        return; // only one anchor in default list...
                }
            }

            SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
            ae.addDefaultAction(new MouseOutDefaultActionable
                                (elt, userAgent, holder));
        }
View Full Code Here

        // Invoke first to cancel the pending tasks
        updateRunnableQueue.preemptLater(new Runnable() {
                public void run() {
                    synchronized (UpdateManager.this) {
                        AbstractEvent evt = (AbstractEvent)
                            ((DocumentEvent)document).createEvent("SVGEvents");
                        String type;
                        if (bridgeContext.isSVG12()) {
                            type = "unload";
                        } else {
                            type = "SVGUnload";
                        }
                        evt.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                                        type,
                                        false,    // canBubbleArg
                                        false);   // cancelableArg
                        ((EventTarget)(document.getDocumentElement())).
                            dispatchEvent(evt);
View Full Code Here

                dispatchSVGLoad((Element)n, checkCanRun, lang);
            }
        }

        DocumentEvent de = (DocumentEvent)elt.getOwnerDocument();
        AbstractEvent ev = (AbstractEvent) de.createEvent("SVGEvents");
        String type;
        if (bridgeContext.isSVG12()) {
            type = "load";
        } else {
            type = "SVGLoad";
        }
        ev.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                       type,
                       false,
                       false);
        NodeEventTarget t = (NodeEventTarget)elt;
View Full Code Here

            (SVGSVGElement)document.getDocumentElement();
        // Event is dispatched on outermost SVG element.
        EventTarget t = root;

        DocumentEvent de = (DocumentEvent)document;
        AbstractEvent ev = (AbstractEvent) de.createEvent("SVGEvents");
        ev.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI,
                       eventType,
                       false,
                       false);
        t.dispatchEvent(ev);
    }
View Full Code Here

    /**
     * Fires a ShapeChange event on the element this bridge is managing.
     */
    protected void fireShapeChangeEvent() {
        DocumentEvent d = (DocumentEvent) e.getOwnerDocument();
        AbstractEvent evt = (AbstractEvent) d.createEvent("SVGEvents");
        evt.initEventNS(SVG_NAMESPACE_URI,
                        "shapechange",
                        true,
                        false);
        try {
            ((EventTarget) e).dispatchEvent(evt);
View Full Code Here

    /**
     * Fires an svg:bboxchange event on the element.
     */
    protected void fireBBoxChangeEvent() {
        DocumentEvent d = (DocumentEvent) e.getOwnerDocument();
        AbstractEvent evt = (AbstractEvent) d.createEvent("SVGEvents");
        evt.initEventNS(SVG_NAMESPACE_URI,
                        "RenderedBBoxChange",
                        true,
                        false);
        try {
            ((EventTarget) e).dispatchEvent(evt);
View Full Code Here

TOP

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

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.