Search in sources :

Example 1 with Document

use of org.loboevolution.html.node.Document in project LoboEvolution by LoboEvolution.

the class HTMLTableRowElementImpl method insertCell.

/**
 * {@inheritDoc}
 */
@Override
public HTMLTableCellElement insertCell() {
    final Document doc = this.document;
    if (doc == null) {
        throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "Orphan element");
    }
    HTMLTableCellElementImpl cellElement = (HTMLTableCellElementImpl) doc.createElement("TD");
    appendChild(cellElement);
    return cellElement;
}
Also used : DOMException(com.gargoylesoftware.css.dom.DOMException) Document(org.loboevolution.html.node.Document)

Example 2 with Document

use of org.loboevolution.html.node.Document in project LoboEvolution by LoboEvolution.

the class HTMLTableElementImpl method createTFoot.

/**
 * {@inheritDoc}
 */
@Override
public HTMLElement createTFoot() {
    final Document doc = this.document;
    if (doc == null)
        return null;
    HTMLElement newChild = (HTMLElement) doc.createElement("tfoot");
    appendChild(newChild);
    return newChild;
}
Also used : Document(org.loboevolution.html.node.Document)

Example 3 with Document

use of org.loboevolution.html.node.Document in project LoboEvolution by LoboEvolution.

the class HTMLTableElementImpl method insertRow.

/**
 * {@inheritDoc}
 */
@Override
public HTMLTableRowElement insertRow() {
    final Document doc = this.document;
    if (doc == null) {
        throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "Orphan element");
    }
    final HTMLTableRowElement rowElement = (HTMLTableRowElement) doc.createElement("TR");
    appendChild(rowElement);
    return rowElement;
}
Also used : DOMException(com.gargoylesoftware.css.dom.DOMException) Document(org.loboevolution.html.node.Document)

Example 4 with Document

use of org.loboevolution.html.node.Document in project LoboEvolution by LoboEvolution.

the class LocationImpl method setHref.

/**
 * {@inheritDoc}
 *
 * <p>
 * setHref.
 * </p>
 */
public void setHref(String uri) {
    final HtmlRendererContext rcontext = this.window.getHtmlRendererContext();
    if (rcontext != null) {
        try {
            URL url;
            final Document document = this.window.getDocumentNode();
            if (document instanceof HTMLDocumentImpl) {
                final HTMLDocumentImpl docImpl = (HTMLDocumentImpl) document;
                url = docImpl.getFullURL(uri);
            } else {
                url = new URL(uri);
            }
            rcontext.navigate(url, this.target);
        } catch (final java.net.MalformedURLException mfu) {
            logger.log(Level.WARNING, "setHref(): Malformed location: [" + uri + "].", mfu);
        }
    }
}
Also used : HtmlRendererContext(org.loboevolution.http.HtmlRendererContext) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) Document(org.loboevolution.html.node.Document) URL(java.net.URL)

Example 5 with Document

use of org.loboevolution.html.node.Document in project LoboEvolution by LoboEvolution.

the class LocationImpl method reload.

/**
 * <p>
 * reload.
 * </p>
 */
public void reload() {
    // TODO: This is not really reload.
    final Document document = this.window.getDocumentNode();
    if (document instanceof HTMLDocumentImpl) {
        final HTMLDocumentImpl docImpl = (HTMLDocumentImpl) document;
        final HtmlRendererContext rcontext = docImpl.getHtmlRendererContext();
        if (rcontext != null) {
            rcontext.reload();
        } else {
            docImpl.warn("reload(): No renderer context in Location's document.");
        }
    }
}
Also used : HtmlRendererContext(org.loboevolution.http.HtmlRendererContext) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) Document(org.loboevolution.html.node.Document)

Aggregations

Document (org.loboevolution.html.node.Document)26 DOMException (com.gargoylesoftware.css.dom.DOMException)7 Node (org.loboevolution.html.node.Node)5 UserAgentContext (org.loboevolution.http.UserAgentContext)5 Element (org.loboevolution.html.node.Element)4 HtmlRendererContext (org.loboevolution.http.HtmlRendererContext)4 URL (java.net.URL)3 HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)3 Context (org.mozilla.javascript.Context)3 Scriptable (org.mozilla.javascript.Scriptable)3 SocketTimeoutException (java.net.SocketTimeoutException)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Test (org.junit.Test)2 LoboUnitTest (org.loboevolution.driver.LoboUnitTest)2 NodeListImpl (org.loboevolution.html.dom.nodeimpl.NodeListImpl)2 DocumentType (org.loboevolution.html.node.DocumentType)2 Function (org.mozilla.javascript.Function)2 RhinoException (org.mozilla.javascript.RhinoException)2 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1