Search in sources :

Example 1 with HTMLDocument

use of org.w3c.dom.html.HTMLDocument in project Gargoyle by callakrsos.

the class WebViewConsole method exec.

private void exec() {
    try {
        WebEngine engine = wb.getEngine();
        Object obj = engine.executeScript(txtCommand.getText());
        //			 JSObject obj = (JSObject)
        if (obj instanceof String) {
            txtResult.appendText(obj.toString());
        } else if (obj instanceof HTMLDocument) {
            txtResult.appendText(toHtmlElement((HTMLDocument) obj));
        } else if (obj instanceof Node) {
            Node n = (Node) obj;
            txtResult.appendText(toNodeInfo(n));
        } else {
            txtResult.appendText(obj.toString());
        }
        txtResult.appendText("\n");
    } catch (NullPointerException e) {
        txtResult.appendText("undefinded");
        txtResult.appendText("\n");
    } catch (Exception e) {
        txtResult.appendText(e.getMessage());
        txtResult.appendText("\n");
    }
}
Also used : HTMLDocument(org.w3c.dom.html.HTMLDocument) Node(org.w3c.dom.Node) WebEngine(javafx.scene.web.WebEngine)

Aggregations

WebEngine (javafx.scene.web.WebEngine)1 Node (org.w3c.dom.Node)1 HTMLDocument (org.w3c.dom.html.HTMLDocument)1