/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * 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); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * 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); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * 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); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * 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); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * 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); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> * 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); }
/** * Returns the element with the specified ID, as long as it is an HTML element; <tt>null</tt> otherwise. * @param id the ID to search for * @return the element with the specified ID, as long as it is an HTML element; <tt>null</tt> otherwise */ public Object jsxFunction_getElementById(final String id) { final XmlPage xmlPage = (XmlPage) getDomNodeOrDie(); final Object domElement = xmlPage.getFirstByXPath("//*[@id = \"" + id + "\"]"); if (domElement == null) { return null; } if (domElement instanceof HtmlElement) { return ((HtmlElement) domElement).getScriptObject(); } LOG.debug("getElementById(" + id + "): no HTML DOM node found with this ID"); return null; }
/** * Returns the element with the specified ID, as long as it is an HTML element; <tt>null</tt> otherwise. * @param id the ID to search for * @return the element with the specified ID, as long as it is an HTML element; <tt>null</tt> otherwise */ public Object jsxFunction_getElementById(final String id) { final XmlPage xmlPage = (XmlPage) getDomNodeOrDie(); final Object domElement = xmlPage.getFirstByXPath("//*[@id = \"" + id + "\"]"); if (domElement == null) { return null; } if (domElement instanceof HtmlElement) { return ((HtmlElement) domElement).getScriptObject(); } LOG.debug("getElementById(" + id + "): no HTML DOM node found with this ID"); return null; }
/** * Returns the element with the specified ID, as long as it is an HTML element; <tt>null</tt> otherwise. * @param id the ID to search for * @return the element with the specified ID, as long as it is an HTML element; <tt>null</tt> otherwise */ public Object jsxFunction_getElementById(final String id) { final XmlPage xmlPage = (XmlPage) getDomNodeOrDie(); final Object domElement = xmlPage.getFirstByXPath("//*[@id = \"" + id + "\"]"); if (domElement == null) { return null; } if (domElement instanceof HtmlElement) { return ((HtmlElement) domElement).getScriptObject(); } LOG.debug("getElementById(" + id + "): no HTML DOM node found with this ID"); return null; }
/** * Sets the value of the <tt>bgColor</tt> attribute. * @param bgColor the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public void jsxSet_bgColor(final String bgColor) { final HTMLBodyElement body = (HTMLBodyElement) getHtmlPage().getBody().getScriptObject(); body.jsxSet_bgColor(bgColor); }
/** * Sets the value of the <tt>bgColor</tt> attribute. * @param bgColor the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public void jsxSet_bgColor(final String bgColor) { final HTMLBodyElement body = (HTMLBodyElement) getHtmlPage().getBody().getScriptObject(); body.jsxSet_bgColor(bgColor); }
/** * Sets the value of the <tt>bgColor</tt> attribute. * @param bgColor the value of the <tt>bgColor</tt> attribute * @see <a href="http://msdn.microsoft.com/en-us/library/ms533505.aspx">MSDN Documentation</a> */ public void jsxSet_bgColor(final String bgColor) { final HTMLBodyElement body = (HTMLBodyElement) getHtmlPage().getBody().getScriptObject(); body.jsxSet_bgColor(bgColor); }
/** * {@inheritDoc} */ public void ignoredStartElement(final QName elem, final XMLAttributes attrs, final Augmentations augs) { // when multiple body elements are encountered, the attributes of the discarded // elements are used when not previously defined if (body_ != null && "body".equalsIgnoreCase(elem.localpart) && attrs != null) { // add the attributes that don't already exist final int length = attrs.getLength(); for (int i = 0; i < length; ++i) { final String attrName = attrs.getLocalName(i).toLowerCase(); if (body_.getAttributes().getNamedItem(attrName) == null) { body_.setAttribute(attrName, attrs.getValue(i)); if (attrName.startsWith("on") && body_.getScriptObject() != null) { final HTMLBodyElement jsBody = (HTMLBodyElement) body_.getScriptObject(); jsBody.createEventHandlerFromAttribute(attrName, attrs.getValue(i)); } } } } } /**
/** * {@inheritDoc} */ public void ignoredStartElement(final QName elem, final XMLAttributes attrs, final Augmentations augs) { // when multiple body elements are encountered, the attributes of the discarded // elements are used when not previously defined if (body_ != null && "body".equalsIgnoreCase(elem.localpart) && attrs != null) { // add the attributes that don't already exist final int length = attrs.getLength(); for (int i = 0; i < length; ++i) { final String attrName = attrs.getLocalName(i).toLowerCase(); if (body_.getAttributes().getNamedItem(attrName) == null) { body_.setAttribute(attrName, attrs.getValue(i)); if (attrName.startsWith("on") && body_.getScriptObject() != null) { final HTMLBodyElement jsBody = (HTMLBodyElement) body_.getScriptObject(); jsBody.createEventHandlerFromAttribute(attrName, attrs.getValue(i)); } } } } } /**
/** * Sets the focus on this element. */ public void focus() { ((HtmlPage) getPage()).setFocusedElement(this); final WebClient webClient = getPage().getWebClient(); if (webClient.getBrowserVersion().isIE()) { final HTMLElement jsElt = (HTMLElement) getScriptObject(); jsElt.jsxFunction_setActive(); } }
/** * Sets the focus on this element. */ public void focus() { ((HtmlPage) getPage()).setFocusedElement(this); final WebClient webClient = getPage().getWebClient(); if (webClient.getBrowserVersion().isIE()) { final HTMLElement jsElt = (HTMLElement) getScriptObject(); jsElt.jsxFunction_setActive(); } }
/** * Sets the focus on this element. */ public void focus() { ((HtmlPage) getPage()).setFocusedElement(this); final WebClient webClient = getPage().getWebClient(); if (webClient.getBrowserVersion().isIE()) { final HTMLElement jsElt = (HTMLElement) getScriptObject(); jsElt.jsxFunction_setActive(); } }
/** * Returns this document's <tt>body</tt> element. * @return this document's <tt>body</tt> element */ public Object jsxGet_body() { final HtmlPage page = getHtmlPage(); // for IE, the body of a not yet loaded page is null whereas it already exists for FF if (getBrowserVersion().isIE() && (page.getEnclosingWindow() instanceof FrameWindow)) { final HtmlPage enclosingPage = (HtmlPage) page.getEnclosingWindow().getParentWindow().getEnclosedPage(); if (WebClient.URL_ABOUT_BLANK.equals(page.getWebResponse().getRequestSettings().getUrl()) && enclosingPage.getReadyState() != DomNode.READY_STATE_COMPLETE) { return null; } } final HtmlElement body = getHtmlPage().getBody(); if (body != null) { return body.getScriptObject(); } return null; }
/** * Returns this document's <tt>body</tt> element. * @return this document's <tt>body</tt> element */ public Object jsxGet_body() { final HtmlPage page = getHtmlPage(); // for IE, the body of a not yet loaded page is null whereas it already exists for FF if (getBrowserVersion().isIE() && (page.getEnclosingWindow() instanceof FrameWindow)) { final HtmlPage enclosingPage = (HtmlPage) page.getEnclosingWindow().getParentWindow().getEnclosedPage(); if (WebClient.URL_ABOUT_BLANK.equals(page.getWebResponse().getRequestSettings().getUrl()) && enclosingPage.getReadyState() != DomNode.READY_STATE_COMPLETE) { return null; } } final HtmlElement body = getHtmlPage().getBody(); if (body != null) { return body.getScriptObject(); } return null; }
/** * Returns this document's <tt>body</tt> element. * @return this document's <tt>body</tt> element */ public Object jsxGet_body() { final HtmlPage page = getHtmlPage(); // for IE, the body of a not yet loaded page is null whereas it already exists for FF if (getBrowserVersion().isIE() && (page.getEnclosingWindow() instanceof FrameWindow)) { final HtmlPage enclosingPage = (HtmlPage) page.getEnclosingWindow().getParentWindow().getEnclosedPage(); if (WebClient.URL_ABOUT_BLANK.equals(page.getWebResponse().getRequestSettings().getUrl()) && enclosingPage.getReadyState() != DomNode.READY_STATE_COMPLETE) { return null; } } final HtmlElement body = getHtmlPage().getBody(); if (body != null) { return body.getScriptObject(); } return null; }