Package org.itsnat.core.event

Examples of org.itsnat.core.event.ItsNatKeyEvent


    {
    }

    public String getInitEvent(Event evt,String evtVarName,ClientDocumentStfulImpl clientDoc)
    {
        ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;

        StringBuilder code = new StringBuilder();
        code.append( evtVarName + ".altKey=" + keyEvt.getAltKey() + ";\n" );
        code.append( evtVarName + ".ctrlKey=" + keyEvt.getCtrlKey() + ";\n" );
        code.append( evtVarName + ".shiftKey=" + keyEvt.getShiftKey() + ";\n" );

        long keyCode;
        String type = keyEvt.getType();
        if (type.equals("keypress"))
            keyCode = keyEvt.getCharCode();
        else
            keyCode = keyEvt.getKeyCode();
        code.append( evtVarName + ".keyCode=" + keyCode + ";\n" );

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


        eventClick.initMouseEvent("click",true,true,((DocumentView)doc).getDefaultView(),
                0,100,200,300,400,false,false,false,false,(short)0,null);
        ((ItsNatNormalEvent)eventClick).setExtraParam("extra","Hello");
        boolean res = ((EventTarget)nodeToClick).dispatchEvent(eventClick);

        ItsNatKeyEvent eventKey = (ItsNatKeyEvent)((DocumentEvent)doc).createEvent("KeyEvents");
        eventKey.initKeyEvent("keypress",true,true,((DocumentView)doc).getDefaultView(),
                false,false,false,false,0,'a'); // 'a' = 97
        ((ItsNatNormalEvent)eventKey).setExtraParam("extra","Bye");
        boolean res2 = ((EventTarget)nodeToClick).dispatchEvent(eventKey);

        ItsNatUserEvent userEvent = (ItsNatUserEvent)((DocumentEvent)doc).createEvent("itsnat:UserEvents");
View Full Code Here

        String type = evt.getType();
        if (type.equals("change"))
            log(evt);
        else
        {
            ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;
            String msg = "";
            msg += evt.getClass() + " " + type + " ";
            msg += ", char code: " + keyEvt.getCharCode();
            msg += ", key code: " + keyEvt.getKeyCode() + " ";
            if (keyEvt.getShiftKey())
                msg += " SHIFT";
            if (keyEvt.getCtrlKey())
                msg += " CTRL";
            if (keyEvt.getAltKey())
                msg += " ALT";

            if (type.equals("keyup"))
                msg += " text: " + inputComp.getText();
View Full Code Here

                }
                eventClick.initMouseEvent("click",true,true,((DocumentView)doc).getDefaultView(),
                        0,100,200,300,400,false,false,false,false,(short)0,null);
                boolean res = ((EventTarget)nodeToClick).dispatchEvent(eventClick);

                ItsNatKeyEvent eventKey;
                synchronized(itsNatDoc) // no hace falta pero por si acaso
                {
                    eventKey = (ItsNatKeyEvent)((DocumentEvent)doc).createEvent("KeyEvents");
                }
                eventKey.initKeyEvent("keypress",true,true,((DocumentView)doc).getDefaultView(),
                        false,false,false,false,0,'a'); // 'a' = 97
                boolean res2 = ((EventTarget)nodeToClick).dispatchEvent(eventKey);

                Event eventChange;
                synchronized(itsNatDoc) // no hace falta pero por si acaso
View Full Code Here

    {
    }

    public String getInitEvent(Event evt,String evtVarName,ClientDocumentStfulImpl clientDoc)
    {
        ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;

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

        // En teor�a los eventos KeyEvent de ASV v6 tienen las propiedades
        // screenX, screenY, clientX y clientY pero estas propiedades
        // no est�n presentes en este evento en ning�n navegador relevante.

        code.append( evtVarName + ".view = " + getViewPath(keyEvt.getView(),clientDoc) + ";\n" );
        code.append( evtVarName + ".ctrlKey = " + keyEvt.getCtrlKey() + ";\n" );
        code.append( evtVarName + ".altKey = " + keyEvt.getAltKey() + ";\n" );
        code.append( evtVarName + ".shiftKey = " + keyEvt.getShiftKey() + ";\n" );
        code.append( evtVarName + ".metaKey = " + keyEvt.getMetaKey() + ";\n" );
        code.append( evtVarName + ".keyCode = " + keyEvt.getKeyCode() + ";\n" );
        code.append( evtVarName + ".charCode = " + keyEvt.getCharCode() + ";\n" );

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

        // public void initKeyEvent(String typeArg,
        //    boolean canBubbleArg,boolean cancelableArg,boolean ctrlKeyArg,
        //    boolean altKeyArg,boolean shiftKeyArg,boolean metaKeyArg,
        //    int keyCodeArg,int charCodeArg,AbstractView viewArg)

         ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;

        return evtVarName + ".initKeyEvent("
                + "\"" + keyEvt.getType() + "\","
                + keyEvt.getBubbles() + ","
                + keyEvt.getCancelable() + ","
                + keyEvt.getCtrlKey() + ","
                + keyEvt.getAltKey() + ","
                + keyEvt.getShiftKey() + ","
                + keyEvt.getMetaKey() + ","
                + keyEvt.getKeyCode() + ","
                + keyEvt.getCharCode() + ","
                + getViewPath(keyEvt.getView(),clientDoc)
                + ");\n";
    }
View Full Code Here

        return keyCode;
    }

    public String getInitEvent(Event evt,String evtVarName,ClientDocumentStfulImpl clientDoc)
    {
        ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;

        StringBuilder code = new StringBuilder();

        String keyIdentifier;
        int keyLocation;
View Full Code Here

        return "KeyEvents";
    }

    public String getInitEvent(Event evt,String evtVarName,ClientDocumentStfulImpl clientDoc)
    {
         ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;

        return evtVarName + ".initKeyEvent("
                + "\"" + keyEvt.getType() + "\","
                + keyEvt.getBubbles() + ","
                + keyEvt.getCancelable() + ","
                + getViewPath(keyEvt.getView(),clientDoc) + ","
                + keyEvt.getCtrlKey() + ","
                + keyEvt.getAltKey() + ","
                + keyEvt.getShiftKey() + ","
                + keyEvt.getMetaKey() + ","
                + keyEvt.getKeyCode() + ","
                + keyEvt.getCharCode()
                + ");\n";
    }
View Full Code Here

        ((EventTarget)root).addEventListener("keydown",this,false);
    }

    public void handleEvent(Event evt)
    {
        ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;
        String code;
        if (keyEvt.getType().equals("keypress"))
            code = keyEvt.getType() + ": charCode " + keyEvt.getCharCode();
        else // keydown/up
            code = keyEvt.getType() + ": keyCode " + keyEvt.getKeyCode();

        Text text = (Text)elem.getFirstChild();
        if (!cleared) { text.setData(""); cleared = true; }
        text.setData(text.getData() + code + ", ");
    }
View Full Code Here

        /* Lo he deducido generando eventos key normales usando por ej. onkeydown="analizar(event)" etc
         * y viendo que el objeto tiene el m�todo initEvent, pero no initUIEvent, initKeyEvent,
         * o initKeyboardEvent y sabiendo que Opera en su momento imitaba mucho
         * el funcionamiento del MSIE por lo que tiene sus mismas propiedades.
         */
        ItsNatKeyEvent keyEvt = (ItsNatKeyEvent)evt;

        StringBuilder code = new StringBuilder();

        code.append( getInitEventDefault(evt,evtVarName,clientDoc) );

        code.append( evtVarName + ".altKey=" + keyEvt.getAltKey() + ";\n" );
        code.append( evtVarName + ".ctrlKey=" + keyEvt.getCtrlKey() + ";\n" );
        code.append( evtVarName + ".shiftKey=" + keyEvt.getShiftKey() + ";\n" );
        code.append( evtVarName + ".metaKey=" + keyEvt.getMetaKey() + ";\n" );

        long keyCode;
        String type = keyEvt.getType();
        if (type.equals("keypress"))
            keyCode = keyEvt.getCharCode();
        else
            keyCode = keyEvt.getKeyCode();
        code.append( evtVarName + ".keyCode=" + keyCode + ";\n" );

        // Opera no tiene charCode

        return code.toString();
View Full Code Here

TOP

Related Classes of org.itsnat.core.event.ItsNatKeyEvent

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.