Package com.gargoylesoftware.htmlunit.javascript.host.html

Examples of com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement$ProxyDomNode


        final Page enclosedPage = currentWindow_.getEnclosedPage();
        if (enclosedPage instanceof HtmlPage) {
            final Window jsWindow = (Window) currentWindow_.getScriptObject();
            if (jsWindow != null) {
                if (getBrowserVersion().isIE()) {
                    final HTMLElement activeElement = (HTMLElement) jsWindow.jsxGet_document().jsxGet_activeElement();
                    if (activeElement != null) {
                        ((HtmlPage) enclosedPage).setFocusedElement(activeElement.getDomNodeOrDie(), true);
                    }
                }
                else {
                    final HtmlElement focusedElement = ((HtmlPage) enclosedPage).getFocusedElement();
                    if (focusedElement != null) {
View Full Code Here


        }

        final SimpleScriptable scriptable;
        if (javaScriptClass == null) {
            // We don't have a specific subclass for this element so create something generic.
            scriptable = new HTMLElement();
            LOG.debug("No JavaScript class found for element <" + domNode.getNodeName() + ">. Using HTMLElement");
        }
        else {
            try {
                scriptable = javaScriptClass.newInstance();
View Full Code Here

     * Retrieves the HTML fragment contained within the range.
     * @return the HTML fragment contained within the range
     */
    public String jsxGet_htmlText() {
        final org.w3c.dom.Node node = range_.getCommonAncestorContainer();
        final HTMLElement element = (HTMLElement) getScriptableFor(node);
        return element.jsxGet_outerHTML(); // TODO: not quite right, but good enough for now
    }
View Full Code Here

     *
     * @return the horizontal coordinate
     */
    public int jsxGet_screenX() {
        if (screenX_ == null) {
            final HTMLElement target = (HTMLElement) jsxGet_target();
            screenX_ = target.getPosX() + 10;
        }
        return screenX_;
    }
View Full Code Here

     *
     * @return the vertical coordinate
     */
    public int jsxGet_screenY() {
        if (screenY_ == null) {
            final HTMLElement target = (HTMLElement) jsxGet_target();
            screenY_ = target.getPosY() + 10;
        }
        return screenY_;
    }
View Full Code Here

     * Return a Function to be executed when a given event occurs.
     * @param eventName Name of event such as "onclick" or "onblur", etc
     * @return a Rhino JavaScript executable Function, or <tt>null</tt> if no event handler has been defined
     */
    public final Function getEventHandler(final String eventName) {
        final HTMLElement jsObj = (HTMLElement) getScriptObject();
        return jsObj.getEventHandler(eventName);
    }
View Full Code Here

     * Register a Function as an event handler.
     * @param eventName Name of event such as "onclick" or "onblur", etc
     * @param eventHandler a Rhino JavaScript executable Function
     */
    public final void setEventHandler(final String eventName, final Function eventHandler) {
        final HTMLElement jsObj = (HTMLElement) getScriptObject();
        jsObj.setEventHandler(eventName, eventHandler);
    }
View Full Code Here

        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Firing " + event);
        }
        final HTMLElement jsElt = (HTMLElement) getScriptObject();
        final ContextAction action = new ContextAction() {
            public Object run(final Context cx) {
                return jsElt.fireEvent(event);
            }
        };

        final ContextFactory cf = client.getJavaScriptEngine().getContextFactory();
        final ScriptResult result = (ScriptResult) cf.call(action);
View Full Code Here

    public void focus() {
        final HtmlPage page = (HtmlPage) getPage();
        page.setFocusedElement(this);
        final WebClient webClient = page.getWebClient();
        if (webClient.getBrowserVersion().isIE()) {
            final HTMLElement jsElt = (HTMLElement) getScriptObject();
            jsElt.jsxFunction_setActive();
        }
    }
View Full Code Here

     * @return the style sheet referred to by this rule
     */
    public Stylesheet jsxGet_styleSheet() {
        if (importedStylesheet_ == null) {
            final Stylesheet owningSheet = this.jsxGet_parentStyleSheet();
            final HTMLElement ownerNode = owningSheet.jsxGet_ownerNode();
            final CSSStyleSheet importedStylesheet = getImportRule().getStyleSheet();
            importedStylesheet_ = new Stylesheet(ownerNode, importedStylesheet, owningSheet.getUri());
        }
        return importedStylesheet_;
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement$ProxyDomNode

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.