Package org.w3c.dom.events

Examples of org.w3c.dom.events.MouseEvent


        // por ello usamos la alternativa initMouseEventNS de DOM 3
        // tambi�n soportada por Batik y que curiosamente funciona bien:
        // http://www.w3.org/TR/DOM-Level-3-Events/#events-event-type-initMouseEventNS
        // Como namespaceURIArg pasaremos null

        MouseEvent mouseEvt = (MouseEvent)evt;

        StringBuilder modifierList = new StringBuilder();
        if (mouseEvt.getCtrlKey())  modifierList.append("Control ");
        if (mouseEvt.getAltKey())   modifierList.append("Alt ");
        if (mouseEvt.getShiftKey()) modifierList.append("Shift ");
        if (mouseEvt.getMetaKey())  modifierList.append("Meta ");

        return evtVarName + ".initMouseEventNS("
                + "null,"
                + "\"" + mouseEvt.getType() + "\","
                + mouseEvt.getBubbles() + ","
                + mouseEvt.getCancelable() + ","
                + getViewPath(mouseEvt.getView(),clientDoc) + ","
                + mouseEvt.getDetail() + ","
                + mouseEvt.getScreenX() + ","
                + mouseEvt.getScreenY() + ","
                + mouseEvt.getClientX() + ","
                + mouseEvt.getClientY() + ","
                + mouseEvt.getButton() + ","
                + clientDoc.getNodeReference((Node)mouseEvt.getRelatedTarget(),true,false) + ","
                + "\"" + modifierList + "\"" + ");\n";
    }
View Full Code Here


    {
    }

    public String getInitEvent(Event evt,String evtVarName,ClientDocumentStfulImpl clientDoc)
    {
        MouseEvent mouseEvt = (MouseEvent)evt;

        StringBuilder code = new StringBuilder();
        code.append( super.getInitEvent(evt,evtVarName,clientDoc) );

        code.append( evtVarName + ".view = " + getViewPath(mouseEvt.getView(),clientDoc) + ";\n" );
        code.append( evtVarName + ".detail = " + mouseEvt.getDetail() + ";\n" );
        code.append( evtVarName + ".screenX = " + mouseEvt.getScreenX() + ";\n" );
        code.append( evtVarName + ".screenY = " + mouseEvt.getScreenY() + ";\n" );
        code.append( evtVarName + ".clientX = " + mouseEvt.getClientX() + ";\n" );
        code.append( evtVarName + ".clientY = " + mouseEvt.getClientY() + ";\n" );
        code.append( evtVarName + ".ctrlKey = " + mouseEvt.getCtrlKey() + ";\n" );
        code.append( evtVarName + ".altKey = " + mouseEvt.getAltKey() + ";\n" );
        code.append( evtVarName + ".shiftKey = " + mouseEvt.getShiftKey() + ";\n" );
        code.append( evtVarName + ".metaKey = " + mouseEvt.getMetaKey() + ";\n" );
        code.append( evtVarName + ".button = " + mouseEvt.getButton() + ";\n" );
        code.append( evtVarName + ".relatedTarget = " + clientDoc.getNodeReference((Node)mouseEvt.getRelatedTarget(),true,false) + ";\n" );

        return code.toString();
    }
View Full Code Here

     * The class that is responsible for tracking 'mouseclick' changes.
     */
    protected class MouseClickTracker implements EventListener {

        public void handleEvent(Event evt) {
            MouseEvent mevt = (MouseEvent)evt;
            fireDOMActivateEvent(evt.getTarget(), mevt.getDetail());
        }
View Full Code Here

     * 'mouseover' event.
     */
    protected class MouseOverTracker implements EventListener {

        public void handleEvent(Event evt) {
            MouseEvent me = (MouseEvent) evt;
            EventTarget target = evt.getTarget();
            EventTarget relatedTarget = me.getRelatedTarget();
            fireDOMFocusInEvent(target, relatedTarget);
        }
View Full Code Here

     * 'mouseout' event.
     */
    protected class MouseOutTracker implements EventListener {

        public void handleEvent(Event evt) {
            MouseEvent me = (MouseEvent) evt;
            EventTarget target = evt.getTarget();
            EventTarget relatedTarget = me.getRelatedTarget();
            fireDOMFocusOutEvent(target, relatedTarget);
        }
View Full Code Here

        /**
         * Handles 'mouseout' MouseEvent event type.
         */
        public void handleEvent(Event evt) {
            MouseEvent me = (MouseEvent)evt;
            Element newTarget = (Element)me.getRelatedTarget();
            Cursor cursor = CursorManager.DEFAULT_CURSOR;
            if (newTarget != null)
                cursor = CSSUtilities.convertCursor
                    (newTarget, BridgeContext.this);
            if (cursor == null)
View Full Code Here

     * The class that is responsible for tracking 'mouseclick' changes.
     */
    protected class MouseClickTacker implements EventListener {

        public void handleEvent(Event evt) {
            MouseEvent mevt = (MouseEvent)evt;
            fireDOMActivateEvent(evt.getTarget(), mevt.getDetail());
        }
View Full Code Here

            */
            short button = getButton(evt);
            Point screenXY = evt.getScreenPoint();
            // create the coresponding DOM MouseEvent
            DocumentEvent d = (DocumentEvent)targetElement.getOwnerDocument();
            MouseEvent mouseEvt = (MouseEvent)d.createEvent("MouseEvents");
            mouseEvt.initMouseEvent(eventType,
                                    true,
                                    cancelable,
                                    null,
                                    evt.getClickCount(),
                                    screenXY.x,
View Full Code Here

            if ((evt.BUTTON1_MASK & evt.getModifiers()) != 0)
                button = 0;
            else
                if ((evt.BUTTON3_MASK & evt.getModifiers()) != 0)
                    button = 2;
            MouseEvent mevent =
                // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
                (MouseEvent)org.apache.batik.dom.events.EventSupport.
                createEvent(org.apache.batik.dom.events.EventSupport.
                            MOUSE_EVENT_TYPE);
            // 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()),
                                  (int)Math.floor(pos.getY()),
                                  evt.isControlDown(), evt.isAltDown(),
View Full Code Here

            this.svgElement = svgElement;
            this.imgElement = imgElement;
        }

        public void handleEvent(Event e) {
            MouseEvent evt = (MouseEvent) e;
            MouseEvent newMouseEvent = (MouseEvent)
                // DOM Level 2 6.5 cast from Document to DocumentEvent is ok
                ((DocumentEvent)imgElement.getOwnerDocument()).createEvent("MouseEvents");

            newMouseEvent.initMouseEvent(evt.getType(),
                                         evt.getBubbles(),
                                         evt.getCancelable(),
                                         evt.getView(),
                                         evt.getDetail(),
                                         evt.getScreenX(),
View Full Code Here

TOP

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

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.