Package org.w3c.dom.html

Examples of org.w3c.dom.html.HTMLDocument


        // A PlainDocument has no attributes
    }

    public void log(String msg)
    {
        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        Element noteElem = doc.createElement("p");
        noteElem.appendChild(doc.createTextNode(msg));
        doc.getBody().appendChild(noteElem);
    }
View Full Code Here


        // dichos nodos cacheados pueden tener comentarios que ser�n filtrados
        // en el cliente, sin embargo esos comentarios NO nos interesan pues
        // no se reflejan en el DOM del servidor por tanto no ser�n accedidos ni habr� c�lculo
        // de paths ni path-ids de los mismos
        ItsNatHTMLDocumentImpl itsNatDoc = responseParent.getItsNatHTMLDocument();
        HTMLDocument doc = itsNatDoc.getHTMLDocument();

        replaceComments(doc);
    }
View Full Code Here

        this.itsNatDoc = itsNatDoc;

        if (db.getCityList().size() != 3)
            throw new RuntimeException("Unexpected");

        HTMLDocument doc = itsNatDoc.getHTMLDocument();

        ItsNatComponentManager compMgr = itsNatDoc.getItsNatComponentManager();
        this.textInput = (ItsNatHTMLInputText)compMgr.createItsNatComponentById("inputId");

       EventListener listener = new EventListener()
       {   
            {
                System.out.println("JProxyExampleDocument Anonymous Inner 21 " + this.getClass().getClassLoader().hashCode());
            }
          
            public void handleEvent(Event evt)
            {
                String text = textInput.getText();
                resultsElem.setTextContent(text);
            }
        };
       
        Element buttonElem = doc.getElementById("buttonId");
        ((EventTarget)buttonElem).addEventListener("click",listener,false);

        this.resultsElem = doc.getElementById("resultsId");
       
        System.out.println("JProxyExampleDocument 1 " + this.getClass().getClassLoader().hashCode());       
        new AuxMemberInMethod().log();
        AuxMember.log();
        JProxyExampleAux.log();
View Full Code Here

    public JOOXExampleDocument(ItsNatHTMLDocument itsNatDoc)
    {
        this.itsNatDoc = itsNatDoc;

        HTMLDocument doc = itsNatDoc.getHTMLDocument();
  
        ItsNatComponentManager compMgr = itsNatDoc.getItsNatComponentManager();
       
       
        this.htmlCodeInput = (ItsNatHTMLInputText)compMgr.createItsNatComponentById("htmlCodeId");
        htmlCodeInput.setText("<span style='color:red'>HELLO</span>");       
       
        this.htmlAddElem = doc.getElementById("htmlAddId");
        ((EventTarget)htmlAddElem).addEventListener("click", this, false);       
       
        this.xpathExpressionInput = (ItsNatHTMLInputText)compMgr.createItsNatComponentById("xpathExpressionId");
        xpathExpressionInput.setText("//*[name() = 'div']");
       
        this.xpathEvaluateElem = doc.getElementById("xpathEvaluateId");
        ((EventTarget)xpathEvaluateElem).addEventListener("click", this, false);

        this.xpathResultsElem = doc.getElementById("xpathResultsId");
    }
View Full Code Here

        elem.appendChild(link);
    }

    protected HTMLAnchorElement createLink()
    {
        HTMLDocument doc = itsNatDoc.getHTMLDocument();
        HTMLAnchorElement link = (HTMLAnchorElement)doc.createElement("a");
        link.setHref("javascript:;");
        link.setAttribute("style","text-decoration:none; color:inherit;");
        return link;
    }
View Full Code Here

        this.xpathResultsElem = doc.getElementById("xpathResultsId");
    }

    public void handleEvent(Event evt)
    {
        HTMLDocument doc = itsNatDoc.getHTMLDocument();       

        if (evt.getCurrentTarget() == htmlAddElem )
        {
            $(doc).find(":ul#someULId").children() // <li> items
                    .eq(2// <li> item 2
                    .children() // content of <li>
                    .eq(0) // <span>
                    .children().remove();
           
           
            String htmlCode = htmlCodeInput.getText();           
           
            if (htmlCode.length() > 10 * 1024) return;
           
            $(doc).find(":ul#someULId").children() // <li> items
                    .eq(2// <li> item 2
                    .children() // content of <li>
                    .eq(0) // <span>
                    .append(htmlCode);           

        }
        else if (evt.getCurrentTarget() == xpathEvaluateElem)
        {
            $(xpathResultsElem).children().remove();
           
            String expression = xpathExpressionInput.getText();

            try
            {
                List<Element> elemList = $(doc).xpath(expression).get();    

                for(Element elem : elemList)
                {
                    Element child = doc.createElement("div");
                    String value = "Element: " + elem.getNodeName();

                    child.appendChild(doc.createTextNode(value));
                    xpathResultsElem.appendChild(child);
                }  
            }
            catch(Exception ex)
            {
                //ex.printStackTrace();

                String exMsg = ex.toString();

                Throwable cause = ex.getCause();
                if (cause != null) exMsg = exMsg + "\n" + cause.toString();

                Text text = doc.createTextNode("ERROR: " + exMsg);
                xpathResultsElem.appendChild(text);           
            }       
       }
    }
View Full Code Here

    public HybridCSDocument(ItsNatHTMLDocument itsNatDoc)
    {
        this.itsNatDoc = itsNatDoc;

        HTMLDocument doc = itsNatDoc.getHTMLDocument();
          
        this.carouselContainerElem = doc.getElementById("carouselContainerId");
        this.carouselElem = doc.getElementById("carouselId");
        this.itemPatternElem = ItsNatTreeWalker.getFirstChildElement(carouselElem);
        this.content = (DocumentFragment)itsNatDoc.disconnectChildNodesFromClient(carouselContainerElem);

        ItsNatComponentManager compMgr = itsNatDoc.getItsNatComponentManager();
        this.imgURLComp = (ItsNatHTMLInputText)compMgr.createItsNatComponentById("imgURLId");
        HTMLImageElement firstImgElem = (HTMLImageElement)itemPatternElem.getFirstChild();
        imgURLComp.setText(firstImgElem.getSrc());

        this.addImageFirstElem = doc.getElementById("addImageFirstId");
        ((EventTarget)addImageFirstElem).addEventListener("click", this, false);
        this.addImageLastElem = doc.getElementById("addImageLastId");
        ((EventTarget)addImageLastElem).addEventListener("click", this, false);

        ElementList list = itsNatDoc.getElementGroupManager().createElementList(carouselElem,false);
        this.size = list.getLength();
View Full Code Here

    public XPathExampleDocument(ItsNatHTMLDocument itsNatDoc)
    {
        this.itsNatDoc = itsNatDoc;

        HTMLDocument doc = itsNatDoc.getHTMLDocument();
  
        ItsNatComponentManager compMgr = itsNatDoc.getItsNatComponentManager();
        this.expressionInput = (ItsNatHTMLInputText)compMgr.createItsNatComponentById("expressionId");
        expressionInput.setText("//*[name() = 'div']");

       
        Element evaluateElem = doc.getElementById("evaluateId");
        ((EventTarget)evaluateElem).addEventListener("click", this, false);

        this.resultsElem = doc.getElementById("resultsId");
    }
View Full Code Here

        this.resultsElem = doc.getElementById("resultsId");
    }

    public void handleEvent(Event evt)
    {
        HTMLDocument doc = itsNatDoc.getHTMLDocument();       
       
        while (resultsElem.getFirstChild() != null)
            resultsElem.removeChild(resultsElem.getFirstChild());       
       
        String expression = expressionInput.getText();
        try
        {

            XPathFactory factory = XPathFactory.newInstance();
            XPath xpath = factory.newXPath()
            xpath.setNamespaceContext(new UniversalNamespaceResolver(doc));   
            XPathExpression exp = xpath.compile(expression); //   "//*[name()='h1' or name()='h2']"
            NodeList nodeList = (NodeList) exp.evaluate(doc, XPathConstants.NODESET);
           

            for(int i = 0; i < nodeList.getLength(); i++)
            {
                Node node = nodeList.item(i);
               
                Element child = doc.createElement("div");
                String value;
                if (node.getNodeType() == Node.TEXT_NODE) value = "Text node: " + ((Text)node).getData();
                else if (node.getNodeType() == Node.ELEMENT_NODE) value = "Element: " + node.getNodeName();
                else
                    value = node.getNodeName();
               
                child.appendChild(doc.createTextNode(value));
                resultsElem.appendChild(child);
            }       
        }
        catch(XPathExpressionException ex)
        {
            //ex.printStackTrace();
           
            String exMsg = ex.toString();

            Throwable cause = ex.getCause(); // javax.xml.transform.TransformerException
            if (cause != null) exMsg = exMsg + "\n" + cause.toString();
           
            Text text = doc.createTextNode("ERROR: " + exMsg);
            resultsElem.appendChild(text);           
        }       
    }
View Full Code Here

        this.itsNatDoc = itsNatDoc;
    }

    public void outText(String msg)
    {
        HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
        Element parent = doc.getElementById("logId");
        parent.appendChild(doc.createTextNode(msg + ".")); // Para que se vea
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.html.HTMLDocument

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.