Package test.anything

Source Code of test.anything.TestAnythingDocument

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package test.anything;

import java.io.Serializable;
import org.itsnat.core.ItsNatServletRequest;
import org.itsnat.core.html.ItsNatHTMLDocument;
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.html.HTMLDocument;

public class TestAnythingDocument implements EventListener,Serializable
{
    protected ItsNatHTMLDocument itsNatDoc;
    protected Element elem;
    protected Element logElem;

    public TestAnythingDocument(ItsNatHTMLDocument itsNatDoc,ItsNatServletRequest request)
    {
        this.itsNatDoc = itsNatDoc;

        this.elem = itsNatDoc.getDocument().getElementById("elemId");
        ((EventTarget)elem).addEventListener("click", this,false);

        this.logElem = itsNatDoc.getDocument().getElementById("logId");
    }

    public void handleEvent(Event evt)
    {
        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        Element infoElem = doc.createElement("div");
        infoElem.appendChild(doc.createTextNode("clicked"));
        logElem.appendChild(infoElem);
    }
}
TOP

Related Classes of test.anything.TestAnythingDocument

TOP
Copyright © 2018 www.massapi.com. 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.