Package org.w3c.dom.events

Examples of org.w3c.dom.events.EventTarget


        /**
         * Sets the tool tip on the input element.
         */
        public void setToolTip(Element elt, String toolTip){
            EventTarget target = (EventTarget)elt;
            elt.normalize();

            // On mouseover, set the tooltip to the title value
            target.addEventListener(SVGConstants.SVG_EVENT_MOUSEOVER,
                                    new ToolTipModifier(toolTip),
                                    false);

            // On mouseout, remove the tooltip
            target.addEventListener(SVGConstants.SVG_EVENT_MOUSEOUT,
                                    new ToolTipModifier(null),
                                    false);

            if (locationListener == null) {
                locationListener = new LocationListener();
View Full Code Here


        Event ev;
        DocumentEvent de = (DocumentEvent)elt.getOwnerDocument();
        ev = de.createEvent("SVGEvents");
        ev.initEvent("SVGLoad", false, false);
        EventTarget t = (EventTarget)elt;

        final String s =
            elt.getAttributeNS(null, SVGConstants.SVG_ONLOAD_ATTRIBUTE);
        EventListener l = null;
        if (s.length() > 0) {
            l = new EventListener() {
                    public void handleEvent(Event evt) {
                        try {
                            interp.bindObject(EVENT_NAME, evt);
                            interp.bindObject(ALTERNATE_EVENT_NAME, evt);
                            interp.evaluate(new StringReader(s));
                        } catch (IOException io) {
                        } catch (InterpreterException e) {
                            handleInterpreterException(e);
                        }
                    }
                };
            t.addEventListener("SVGLoad", l, false);
        }
        t.dispatchEvent(ev);
        if (s.length() > 0) {
            t.removeEventListener("SVGLoad", l, false);
        }
    }
View Full Code Here

        // add a listener on the outermost svg element of the SVG image.
        // if an event occured inside the SVG image document, send it
        // to the <image> element (inside the original document).
        if (ctx.isDynamic()) {
            EventListener listener = new ForwardEventListener(svgElement, e);
            EventTarget target = (EventTarget)svgElement;
            target.addEventListener(SVG_EVENT_CLICK, listener, false);
            target.addEventListener(SVG_EVENT_MOUSEOVER, listener, false);
            target.addEventListener(SVG_EVENT_MOUSEOUT, listener, false);
        }

        return result;
    }
View Full Code Here

     * will be added.
     * @param node the <code>GraphicsNode</code>.
     */
    public static void addDOMListener(BridgeContext ctx, Element eee) {
        SVGElement element = null;
        EventTarget target = null;
        try {
            element = (SVGElement)eee;
            // ability for scripts to be called
            target = (EventTarget)element;
        } catch (ClassCastException e) {
View Full Code Here

                                  Element e,
                                  GraphicsNode node) {

        super.buildGraphicsNode(ctx, e, node);

        EventTarget target = (EventTarget)e;

        target.addEventListener(SVG_EVENT_CLICK,
                                new AnchorListener(ctx.getUserAgent()),
                                false);

        target.addEventListener(SVG_EVENT_MOUSEOVER,
                                new CursorMouseOverListener(ctx.getUserAgent()),
                                false);

        target.addEventListener(SVG_EVENT_MOUSEOUT,
                                new CursorMouseOutListener(ctx.getUserAgent()),
                                false);
    }
View Full Code Here

            // compute screen coordinates
            GraphicsNode node = evt.getGraphicsNode();
            Element elmt = context.getElement(node);
            if (elmt == null) // should not appeared if binding on
                return;
            EventTarget target = (EventTarget)elmt;
            // <!> TODO dispatch it only if pointers-event property ask for
            short button = 1;
            if ((evt.BUTTON1_MASK & evt.getModifiers()) != 0)
                button = 0;
            else
                if ((evt.BUTTON3_MASK & evt.getModifiers()) != 0)
                    button = 2;
            MouseEvent mevent = (MouseEvent)
                // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
                ((DocumentEvent)elmt.getOwnerDocument()).createEvent("MouseEvents");
            // deal with the related node/target
            node = evt.getRelatedNode();
            EventTarget relatedTarget =
                (EventTarget)context.getElement(node);
            mevent.initMouseEvent(eventType, true, cancelok, null,
                                  evt.getClickCount(),
                                  screen.x, screen.y,
                                  (int)Math.floor(pos.getX()),
View Full Code Here

        Event ev;
        DocumentEvent de = (DocumentEvent)elt.getOwnerDocument();
        ev = de.createEvent("SVGEvents");
        ev.initEvent("SVGLoad", false, false);
        EventTarget t = (EventTarget)elt;

        final String s =
            elt.getAttributeNS(null, SVGConstants.SVG_ONLOAD_ATTRIBUTE);
        EventListener l = null;
        if (s.length() > 0) {
            if (checkCanRun) {
                // Check that it is ok to run embeded scripts
                checkCompatibleScriptURL(lang, docPURL);
                checkCanRun = false; // we only check once for onload handlers
            }

            l = new EventListener() {
                    public void handleEvent(Event evt) {
                        try {
                            interp.bindObject(EVENT_NAME, evt);
                            interp.bindObject(ALTERNATE_EVENT_NAME, evt);
                            interp.evaluate(new StringReader(s));
                        } catch (IOException io) {
                        } catch (InterpreterException e) {
                            handleInterpreterException(e);
                        }
                    }
                };
            t.addEventListener("SVGLoad", l, false);
        }
        t.dispatchEvent(ev);
        if (s.length() > 0) {
            t.removeEventListener("SVGLoad", l, false);
        }
    }
View Full Code Here

    protected void initializeDynamicSupport(BridgeContext ctx,
                                            Element e,
                                            GraphicsNode node) {
        super.initializeDynamicSupport(ctx,e,node);

        EventTarget evtTarget = (EventTarget)e;

        //to be notified when a child is removed from the
        //<text> element.
        evtTarget.addEventListener("DOMNodeRemoved",
                                   childNodeRemovedEventListener,
                                   true);
        //to be notified when the modification of the subtree
        //of the <text> element is done
        evtTarget.addEventListener("DOMSubtreeModified",
                                   subtreeModifiedEventListener,
                                   false);
    }
View Full Code Here

    /**
     * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired.
     */
    public void handleDOMNodeRemovedEvent(MutationEvent evt){

        EventTarget evtTarget = (EventTarget)evt.getTarget();

        evtTarget.removeEventListener("DOMNodeRemoved",
                                   childNodeRemovedEventListener,
                                   true);
        evtTarget.removeEventListener("DOMSubtreeModified",
                                   subtreeModifiedEventListener,
                                   false);

        super.handleDOMNodeRemovedEvent(evt);
    }
View Full Code Here

                        }
                        Map m = getAttributeMap(ctx, nodeElement, textPath);
                        asb.append(s, m);
                    }
                } else if (ln.equals(SVG_A_TAG)) {
                    EventTarget target = (EventTarget)nodeElement;
                    UserAgent ua = ctx.getUserAgent();
                    target.addEventListener
                        (SVG_EVENT_CLICK,
                         new SVGAElementBridge.AnchorListener(ua),
                         false);
                   
                    target.addEventListener
                        (SVG_EVENT_MOUSEOVER,
                         new SVGAElementBridge.CursorMouseOverListener(ua),
                         false);
                   
                    target.addEventListener
                        (SVG_EVENT_MOUSEOUT,
                         new SVGAElementBridge.CursorMouseOutListener(ua),
                         false);
                    fillAttributedStringBuffer(ctx,
                                               nodeElement,
View Full Code Here

TOP

Related Classes of org.w3c.dom.events.EventTarget

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.