public class

Document

extends Node
java.lang.Object
   ↳ com.google.gwt.core.client.JavaScriptObject
     ↳ com.google.gwt.dom.client.Node
       ↳ com.google.gwt.dom.client.Document

Class Overview

A Document is the root of the HTML hierarchy and holds the entire content. Besides providing access to the hierarchy, it also provides some convenience methods for accessing certain sets of information from the document.

Summary

[Expand]
Inherited Constants
From class com.google.gwt.dom.client.Node
Protected Constructors
Document()
Public Methods
final AnchorElement createAnchorElement()
Creates an <a> element.
final AreaElement createAreaElement()
Creates an <area> element.
final AudioElement createAudioElement()
Creates an <audio> element.
final BRElement createBRElement()
Creates a <br> element.
final BaseElement createBaseElement()
Creates a <base> element.
final QuoteElement createBlockQuoteElement()
Creates a <blockquote> element.
final NativeEvent createBlurEvent()
Creates a 'blur' event.
final ButtonElement createButtonElement()
final InputElement createButtonInputElement()
Creates an <input type='button'> element.
final CanvasElement createCanvasElement()
Creates a <canvas> element.
final TableCaptionElement createCaptionElement()
Creates a <caption> element.
final NativeEvent createChangeEvent()
Creates a 'change' event.
final InputElement createCheckInputElement()
Creates an <input type='checkbox'> element.
final NativeEvent createClickEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey)
Creates a 'click' event.
final TableColElement createColElement()
Creates a <col> element.
final TableColElement createColGroupElement()
Creates a <colgroup> element.
final NativeEvent createContextMenuEvent()
Creates a 'contextmenu' event.
final DListElement createDLElement()
Creates a <dl> element.
final NativeEvent createDblClickEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey)
Creates a 'dblclick' event.
final ModElement createDelElement()
Creates a <del> element.
final DivElement createDivElement()
Creates a <div> element.
final Element createElement(String tagName)
Creates a new element.
final NativeEvent createErrorEvent()
Creates an 'error' event.
final FieldSetElement createFieldSetElement()
Creates a <fieldset> element.
final InputElement createFileInputElement()
Creates an <input type='file'> element.
final NativeEvent createFocusEvent()
Creates a 'focus' event.
final FormElement createFormElement()
Creates a <form> element.
final FrameElement createFrameElement()
Creates a <frame> element.
final FrameSetElement createFrameSetElement()
Creates a <frameset> element.
final HeadingElement createHElement(int n)
Creates an <h(n)> element.
final HRElement createHRElement()
Creates an <hr> element.
final HeadElement createHeadElement()
Creates a <head> element.
final InputElement createHiddenInputElement()
Creates an <input type='hidden'> element.
final NativeEvent createHtmlEvent(String type, boolean canBubble, boolean cancelable)
Creates an event.
final IFrameElement createIFrameElement()
Creates an <iframe> element.
final ImageElement createImageElement()
Creates an <img> element.
final InputElement createImageInputElement()
Creates an <input type='image'> element.
final ModElement createInsElement()
Creates an <ins> element.
final NativeEvent createKeyCodeEvent(String type, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode)
Creates a key-code event ('keydown' or 'keyup').
final NativeEvent createKeyDownEvent(boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode)
Creates a 'keydown' event.
final NativeEvent createKeyDownEvent(boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)
This method is deprecated. as of GWT2.1 (keydown events don't have a charCode), use createKeyDownEvent(boolean, boolean, boolean, boolean, int)
final NativeEvent createKeyEvent(String type, boolean canBubble, boolean cancelable, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)
final NativeEvent createKeyPressEvent(boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)
This method is deprecated. as of GWT 2.1 (keypress events don't have a keyCode), use createKeyPressEvent(boolean, boolean, boolean, boolean, int)
final NativeEvent createKeyPressEvent(boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int charCode)
Creates a 'keypress' event.
final NativeEvent createKeyUpEvent(boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)
This method is deprecated. as of GWT 2.1 (keyup events don't have a charCode), use createKeyUpEvent(boolean, boolean, boolean, boolean, int)
final NativeEvent createKeyUpEvent(boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode)
Creates a 'keyup' event.
final LIElement createLIElement()
Creates a <li> element.
final LabelElement createLabelElement()
Creates a <label> element.
final LegendElement createLegendElement()
Creates a <legend> element.
final LinkElement createLinkElement()
Creates a <link> element.
final NativeEvent createLoadEvent()
Creates a 'load' event.
final MapElement createMapElement()
Creates a <map> element.
final MetaElement createMetaElement()
Creates a <meta> element.
final NativeEvent createMouseDownEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button)
Creates a 'mousedown' event.
final NativeEvent createMouseEvent(String type, boolean canBubble, boolean cancelable, int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget)
Creates an mouse event.
final NativeEvent createMouseMoveEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button)
Creates a 'mousemove' event.
final NativeEvent createMouseOutEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget)
Creates a 'mouseout' event.
final NativeEvent createMouseOverEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget)
Creates a 'mouseover' event.
final NativeEvent createMouseUpEvent(int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button)
Creates a 'mouseup' event.
final OListElement createOLElement()
Creates an <ol> element.
final ObjectElement createObjectElement()
Creates a <object> element.
final OptGroupElement createOptGroupElement()
Creates an <optgroup> element.
final OptionElement createOptionElement()
Creates an <option> element.
final ParagraphElement createPElement()
Creates a <p> element.
final ParamElement createParamElement()
Creates a <param> element.
final InputElement createPasswordInputElement()
Creates an <input type='password'> element.
final PreElement createPreElement()
Creates a <pre> element.
final ButtonElement createPushButtonElement()
Creates a <button type='button'> element.
final QuoteElement createQElement()
Creates a <q> element.
final InputElement createRadioInputElement(String name)
Creates an <input type='radio'> element.
final ButtonElement createResetButtonElement()
Creates a <button type='reset'> element.
final InputElement createResetInputElement()
Creates an <input type='reset'> element.
final ScriptElement createScriptElement(String source)
Creates a <script> element.
final ScriptElement createScriptElement()
Creates a <script> element.
final NativeEvent createScrollEvent()
Creates a 'scroll' event.
final SelectElement createSelectElement()
Creates a <select> element.
final SelectElement createSelectElement(boolean multiple)
Creates a <select> element.
final SpanElement createSpanElement()
Creates a <span> element.
final StyleElement createStyleElement()
Creates a <style> element.
final ButtonElement createSubmitButtonElement()
Creates a <button type='submit'> element.
final InputElement createSubmitInputElement()
Creates an <input type='submit'> element.
final TableSectionElement createTBodyElement()
Creates a <tbody> element.
final TableCellElement createTDElement()
Creates a <td> element.
final TableSectionElement createTFootElement()
Creates a <tfoot> element.
final TableCellElement createTHElement()
Creates a <th> element.
final TableSectionElement createTHeadElement()
Creates a <thead> element.
final TableRowElement createTRElement()
Creates a <tr> element.
final TableElement createTableElement()
Creates a <table> element.
final TextAreaElement createTextAreaElement()
Creates a <textarea> element.
final InputElement createTextInputElement()
Creates an <input type='text'> element.
final Text createTextNode(String data)
Creates a text node.
final TitleElement createTitleElement()
Creates a <title> element.
final UListElement createULElement()
Creates a <ul> element.
final String createUniqueId()
Creates an identifier guaranteed to be unique within this document.
final VideoElement createVideoElement()
Creates a <video> element.
final void enableScrolling(boolean enable)
Enables or disables scrolling of the document.
static Document get()
Gets the default document.
final BodyElement getBody()
The element that contains the content for the document.
final int getBodyOffsetLeft()
Returns the left offset between the absolute coordinate system and the body's positioning context.
final int getBodyOffsetTop()
Returns the top offset between the absolute coordinate system and the body's positioning context.
final int getClientHeight()
The height of the document's client area.
final int getClientWidth()
The width of the document's client area.
final String getCompatMode()
Gets the document's "compatibility mode", typically used for determining whether the document is in "quirks" or "strict" mode.
final Element getDocumentElement()
Gets the document's element.
final String getDomain()
The domain name of the server that served the document, or null if the server cannot be identified by a domain name.
final Element getElementById(String elementId)
Returns the Element whose id is given by elementId.
final NodeList<Element> getElementsByTagName(String tagName)
Returns a NodeList of all the Elements with a given tag name in the order in which they are encountered in a preorder traversal of the document tree.
final String getReferrer()
Returns the URI of the page that linked to this page.
final int getScrollHeight()
The height of the scrollable area of the document.
final int getScrollLeft()
The number of pixels that the document's content is scrolled from the left.
final int getScrollTop()
The number of pixels that the document's content is scrolled from the top.
final int getScrollWidth()
The width of the scrollable area of the document.
final String getTitle()
Gets the title of a document as specified by the TITLE element in the head of the document.
final String getURL()
Gets the absolute URI of this document.
final void importNode(Node node, boolean deep)
Imports a node from another document to this document.
final boolean isCSS1Compat()
Determines whether the document's "compatMode" is "CSS1Compat".
final void setScrollLeft(int left)
Sets the number of pixels that the document's content is scrolled from the left.
final void setScrollTop(int top)
Sets the number of pixels that the document's content is scrolled from the top.
final void setTitle(String title)
Sets the title of a document as specified by the TITLE element in the head of the document.
[Expand]
Inherited Methods
From class com.google.gwt.dom.client.Node
From class com.google.gwt.core.client.JavaScriptObject
From class java.lang.Object

Protected Constructors

protected Document ()

Public Methods

public final AnchorElement createAnchorElement ()

Creates an <a> element.

Returns
  • the newly created element

public final AreaElement createAreaElement ()

Creates an <area> element.

Returns
  • the newly created element

public final AudioElement createAudioElement ()

Creates an <audio> element.

Returns
  • the newly created element

public final BRElement createBRElement ()

Creates a <br> element.

Returns
  • the newly created element

public final BaseElement createBaseElement ()

Creates a <base> element.

Returns
  • the newly created element

public final QuoteElement createBlockQuoteElement ()

Creates a <blockquote> element.

Returns
  • the newly created element

public final NativeEvent createBlurEvent ()

Creates a 'blur' event.

public final ButtonElement createButtonElement ()

This method is deprecated.
use createPushButtonElement(), createResetButtonElement() or createSubmitButtonElement() instead.

Creates a <button> element.

Warning! The button type is actually implementation-dependent and is read-only.

Returns
  • the newly created element

public final InputElement createButtonInputElement ()

Creates an <input type='button'> element.

Returns
  • the newly created element

public final CanvasElement createCanvasElement ()

Creates a <canvas> element.

Returns
  • the newly created element

public final TableCaptionElement createCaptionElement ()

Creates a <caption> element.

Returns
  • the newly created element

public final NativeEvent createChangeEvent ()

Creates a 'change' event.

public final InputElement createCheckInputElement ()

Creates an <input type='checkbox'> element.

Returns
  • the newly created element

public final NativeEvent createClickEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey)

Creates a 'click' event.

Note that this method does not allow the event's 'button' field to be specified, because not all browsers support it reliably for click events.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
Returns
  • the event object

public final TableColElement createColElement ()

Creates a <col> element.

Returns
  • the newly created element

public final TableColElement createColGroupElement ()

Creates a <colgroup> element.

Returns
  • the newly created element

public final NativeEvent createContextMenuEvent ()

Creates a 'contextmenu' event. Note: Contextmenu events will not dispatch properly on Firefox 2 and earlier.

Returns
  • the event object

public final DListElement createDLElement ()

Creates a <dl> element.

Returns
  • the newly created element

public final NativeEvent createDblClickEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey)

Creates a 'dblclick' event.

Note that this method does not allow the event's 'button' field to be specified, because not all browsers support it reliably for click events.

Note that on some browsers, this may cause 'click' events to be synthesized as well.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
Returns
  • the event object

public final ModElement createDelElement ()

Creates a <del> element.

Returns
  • the newly created element

public final DivElement createDivElement ()

Creates a <div> element.

Returns
  • the newly created element

public final Element createElement (String tagName)

Creates a new element.

Parameters
tagName the tag name of the element to be created
Returns
  • the newly created element

public final NativeEvent createErrorEvent ()

Creates an 'error' event.

Returns
  • the event object

public final FieldSetElement createFieldSetElement ()

Creates a <fieldset> element.

Returns
  • the newly created element

public final InputElement createFileInputElement ()

Creates an <input type='file'> element.

Returns
  • the newly created element

public final NativeEvent createFocusEvent ()

Creates a 'focus' event.

Returns
  • the event object

public final FormElement createFormElement ()

Creates a <form> element.

Returns
  • the newly created element

public final FrameElement createFrameElement ()

Creates a <frame> element.

Returns
  • the newly created element

public final FrameSetElement createFrameSetElement ()

Creates a <frameset> element.

Returns
  • the newly created element

public final HeadingElement createHElement (int n)

Creates an <h(n)> element.

Parameters
n the type of heading, from 1 to 6 inclusive
Returns
  • the newly created element

public final HRElement createHRElement ()

Creates an <hr> element.

Returns
  • the newly created element

public final HeadElement createHeadElement ()

Creates a <head> element.

Returns
  • the newly created element

public final InputElement createHiddenInputElement ()

Creates an <input type='hidden'> element.

Returns
  • the newly created element

public final NativeEvent createHtmlEvent (String type, boolean canBubble, boolean cancelable)

Creates an event.

While this method may be used to create events directly, it is generally preferable to use existing helper methods such as createFocusEvent().

Also, note that on Internet Explorer the 'canBubble' and 'cancelable' arguments will be ignored (the event's behavior is inferred by the browser based upon its type).

Parameters
type the type of event (e.g., "focus", "load", etc)
canBubble true if the event should bubble
cancelable true if the event should be cancelable
Returns
  • the event object

public final IFrameElement createIFrameElement ()

Creates an <iframe> element.

Returns
  • the newly created element

public final ImageElement createImageElement ()

Creates an <img> element.

Returns
  • the newly created element

public final InputElement createImageInputElement ()

Creates an <input type='image'> element.

Returns
  • the newly created element

public final ModElement createInsElement ()

Creates an <ins> element.

Returns
  • the newly created element

public final NativeEvent createKeyCodeEvent (String type, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode)

Creates a key-code event ('keydown' or 'keyup').

While this method may be used to create events directly, it is generally preferable to use existing helper methods such as createKeyDownEvent(boolean, boolean, boolean, boolean, int) or createKeyUpEvent(boolean, boolean, boolean, boolean, int).

Parameters
type the type of event (e.g., "keydown", "keypress", etc)
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyDownEvent (boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode)

Creates a 'keydown' event.

Parameters
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyDownEvent (boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)

This method is deprecated.
as of GWT2.1 (keydown events don't have a charCode), use createKeyDownEvent(boolean, boolean, boolean, boolean, int)

Creates a 'keydown' event.

Parameters
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
charCode the char-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyEvent (String type, boolean canBubble, boolean cancelable, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)

This method is deprecated.
use createKeyCodeEvent(String, boolean, boolean, boolean, boolean, int) or createKeyPressEvent(boolean, boolean, boolean, boolean, int)

Creates a key event.

While this method may be used to create events directly, it is generally preferable to use existing helper methods such as createKeyPressEvent(boolean, boolean, boolean, boolean, int, int) .

Also, note that on Internet Explorer the 'canBubble' and 'cancelable' arguments will be ignored (the event's behavior is inferred by the browser based upon its type).

Parameters
type the type of event (e.g., "keydown", "keypress", etc)
canBubble true if the event should bubble
cancelable true if the event should be cancelable
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
charCode the char-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyPressEvent (boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)

This method is deprecated.
as of GWT 2.1 (keypress events don't have a keyCode), use createKeyPressEvent(boolean, boolean, boolean, boolean, int)

Creates a 'keypress' event.

Parameters
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
charCode the char-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyPressEvent (boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int charCode)

Creates a 'keypress' event.

Parameters
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
charCode the char-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyUpEvent (boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode, int charCode)

This method is deprecated.
as of GWT 2.1 (keyup events don't have a charCode), use createKeyUpEvent(boolean, boolean, boolean, boolean, int)

Creates a 'keyup' event.

Parameters
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
charCode the char-code to be set on the event
Returns
  • the event object

public final NativeEvent createKeyUpEvent (boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int keyCode)

Creates a 'keyup' event.

Parameters
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
keyCode the key-code to be set on the event
Returns
  • the event object

public final LIElement createLIElement ()

Creates a <li> element.

Returns
  • the newly created element

public final LabelElement createLabelElement ()

Creates a <label> element.

Returns
  • the newly created element

public final LegendElement createLegendElement ()

Creates a <legend> element.

Returns
  • the newly created element

public final LinkElement createLinkElement ()

Creates a <link> element.

Returns
  • the newly created element

public final NativeEvent createLoadEvent ()

Creates a 'load' event.

Returns
  • the event object

public final MapElement createMapElement ()

Creates a <map> element.

Returns
  • the newly created element

public final MetaElement createMetaElement ()

Creates a <meta> element.

Returns
  • the newly created element

public final NativeEvent createMouseDownEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button)

Creates a 'mousedown' event.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
button the event's button property (values from BUTTON_LEFT et al)
Returns
  • the event object

public final NativeEvent createMouseEvent (String type, boolean canBubble, boolean cancelable, int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget)

Creates an mouse event.

While this method may be used to create events directly, it is generally preferable to use existing helper methods such as createClickEvent(int, int, int, int, int, boolean, boolean, boolean, boolean) .

Also, note that on Internet Explorer the 'canBubble' and 'cancelable' arguments will be ignored (the event's behavior is inferred by the browser based upon its type).

Parameters
type the type of event (e.g., "focus", "load", etc)
canBubble true if the event should bubble
cancelable true if the event should be cancelable
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
button the event's button property (values from BUTTON_LEFT et al)
relatedTarget the event's related target (only relevant for mouseover and mouseout events)
Returns
  • the event object

public final NativeEvent createMouseMoveEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button)

Creates a 'mousemove' event.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
button the event's button property (values from BUTTON_LEFT et al)
Returns
  • the event object

public final NativeEvent createMouseOutEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget)

Creates a 'mouseout' event. Note: The 'relatedTarget' parameter will be ignored on Firefox 2 and earlier.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
button the event's button property (values from BUTTON_LEFT et al)
relatedTarget the event's related target
Returns
  • the event object

public final NativeEvent createMouseOverEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button, Element relatedTarget)

Creates a 'mouseover' event. Note: The 'relatedTarget' parameter will be ignored on Firefox 2 and earlier.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
button the event's button property (values from BUTTON_LEFT et al)
relatedTarget the event's related target
Returns
  • the event object

public final NativeEvent createMouseUpEvent (int detail, int screenX, int screenY, int clientX, int clientY, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, int button)

Creates a 'mouseup' event.

Parameters
detail the event's detail property
screenX the event's screen-relative x-position
screenY the event's screen-relative y-position
clientX the event's client-relative x-position
clientY the event's client-relative y-position
ctrlKey true if the ctrl key is depressed
altKey true if the alt key is depressed
shiftKey true if the shift key is depressed
metaKey true if the meta key is depressed
button the event's button property (values from BUTTON_LEFT et al)
Returns
  • the event object

public final OListElement createOLElement ()

Creates an <ol> element.

Returns
  • the newly created element

public final ObjectElement createObjectElement ()

Creates a <object> element.

Returns
  • the newly created element

public final OptGroupElement createOptGroupElement ()

Creates an <optgroup> element.

Returns
  • the newly created element

public final OptionElement createOptionElement ()

Creates an <option> element.

Returns
  • the newly created element

public final ParagraphElement createPElement ()

Creates a <p> element.

Returns
  • the newly created element

public final ParamElement createParamElement ()

Creates a <param> element.

Returns
  • the newly created element

public final InputElement createPasswordInputElement ()

Creates an <input type='password'> element.

Returns
  • the newly created element

public final PreElement createPreElement ()

Creates a <pre> element.

Returns
  • the newly created element

public final ButtonElement createPushButtonElement ()

Creates a <button type='button'> element.

Returns
  • the newly created element

public final QuoteElement createQElement ()

Creates a <q> element.

Returns
  • the newly created element

public final InputElement createRadioInputElement (String name)

Creates an <input type='radio'> element.

Parameters
name the name of the radio input (used for grouping)
Returns
  • the newly created element

public final ButtonElement createResetButtonElement ()

Creates a <button type='reset'> element.

Returns
  • the newly created element

public final InputElement createResetInputElement ()

Creates an <input type='reset'> element.

Returns
  • the newly created element

public final ScriptElement createScriptElement (String source)

Creates a <script> element.

Parameters
source the source code to set inside the element
Returns
  • the newly created element

public final ScriptElement createScriptElement ()

Creates a <script> element.

Returns
  • the newly created element

public final NativeEvent createScrollEvent ()

Creates a 'scroll' event. Note: Contextmenu events will not dispatch properly on Firefox 2 and earlier.

Returns
  • the event object

public final SelectElement createSelectElement ()

Creates a <select> element.

Returns
  • the newly created element

public final SelectElement createSelectElement (boolean multiple)

Creates a <select> element.

Parameters
multiple true to allow multiple-selection
Returns
  • the newly created element

public final SpanElement createSpanElement ()

Creates a <span> element.

Returns
  • the newly created element

public final StyleElement createStyleElement ()

Creates a <style> element.

Returns
  • the newly created element

public final ButtonElement createSubmitButtonElement ()

Creates a <button type='submit'> element.

Returns
  • the newly created element

public final InputElement createSubmitInputElement ()

Creates an <input type='submit'> element.

Returns
  • the newly created element

public final TableSectionElement createTBodyElement ()

Creates a <tbody> element.

Returns
  • the newly created element

public final TableCellElement createTDElement ()

Creates a <td> element.

Returns
  • the newly created element

public final TableSectionElement createTFootElement ()

Creates a <tfoot> element.

Returns
  • the newly created element

public final TableCellElement createTHElement ()

Creates a <th> element.

Returns
  • the newly created element

public final TableSectionElement createTHeadElement ()

Creates a <thead> element.

Returns
  • the newly created element

public final TableRowElement createTRElement ()

Creates a <tr> element.

Returns
  • the newly created element

public final TableElement createTableElement ()

Creates a <table> element.

Returns
  • the newly created element

public final TextAreaElement createTextAreaElement ()

Creates a <textarea> element.

Returns
  • the newly created element

public final InputElement createTextInputElement ()

Creates an <input type='text'> element.

Returns
  • the newly created element

public final Text createTextNode (String data)

Creates a text node.

Parameters
data the text node's initial text
Returns
  • the newly created element

public final TitleElement createTitleElement ()

Creates a <title> element.

Returns
  • the newly created element

public final UListElement createULElement ()

Creates a <ul> element.

Returns
  • the newly created element

public final String createUniqueId ()

Creates an identifier guaranteed to be unique within this document. This is useful for allocating element id's.

Returns
  • a unique identifier

public final VideoElement createVideoElement ()

Creates a <video> element.

Returns
  • the newly created element

public final void enableScrolling (boolean enable)

Enables or disables scrolling of the document.

Parameters
enable whether scrolling should be enabled or disabled

public static Document get ()

Gets the default document. This is the document in which the module is running.

Returns
  • the default document

public final BodyElement getBody ()

The element that contains the content for the document. In documents with BODY contents, returns the BODY element.

Returns
  • the document's body

public final int getBodyOffsetLeft ()

Returns the left offset between the absolute coordinate system and the body's positioning context. This method is useful for positioning children of the body element in absolute coordinates.

For example, to position an element directly under the mouse cursor (assuming you are handling a mouse event), do the following:

 Event event;
 Document doc;
 DivElement child;  // assume absolutely-positioned child of the body
 
 // Get the event location in absolute coordinates.
 int absX = event.getClientX() + Window.getScrollLeft();
 int absY = event.getClientY() + Window.getScrollTop();
 
 // Position the child element, adjusting for the difference between the
 // absolute coordinate system and the body's positioning coordinates.
 child.getStyle().setPropertyPx("left", absX - doc.getBodyOffsetLeft());
 child.getStyle().setPropertyPx("top", absY - doc.getBodyOffsetTop());
 

Returns
  • the left offset of the body's positioning coordinate system

public final int getBodyOffsetTop ()

Returns the top offset between the absolute coordinate system and the body's positioning context. This method is useful for positioning children of the body element in absolute coordinates.

Returns
  • the top offset of the body's positioning coordinate system

public final int getClientHeight ()

The height of the document's client area.

Returns
  • the document's client height

public final int getClientWidth ()

The width of the document's client area.

Returns
  • the document's client width

public final String getCompatMode ()

Gets the document's "compatibility mode", typically used for determining whether the document is in "quirks" or "strict" mode.

Returns
  • one of "BackCompat" or "CSS1Compat"

public final Element getDocumentElement ()

Gets the document's element. This is typically the <html> element.

Returns
  • the document element

public final String getDomain ()

The domain name of the server that served the document, or null if the server cannot be identified by a domain name.

Returns
  • the document's domain, or null if none exists

public final Element getElementById (String elementId)

Returns the Element whose id is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this id.

Parameters
elementId the unique id value for an element
Returns
  • the matching element

public final NodeList<Element> getElementsByTagName (String tagName)

Returns a NodeList of all the Elements with a given tag name in the order in which they are encountered in a preorder traversal of the document tree.

Parameters
tagName the name of the tag to match on (the special value "*" matches all tags)
Returns
  • a list containing all the matched elements

public final String getReferrer ()

Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).

Returns
  • the referrer URI

public final int getScrollHeight ()

The height of the scrollable area of the document.

Returns
  • the height of the document's scrollable area

public final int getScrollLeft ()

The number of pixels that the document's content is scrolled from the left.

If the document is in RTL mode, this method will return a negative value of the number of pixels scrolled from the right.

Returns
  • the document's left scroll position

public final int getScrollTop ()

The number of pixels that the document's content is scrolled from the top.

Returns
  • the document's top scroll position

public final int getScrollWidth ()

The width of the scrollable area of the document.

Returns
  • the width of the document's scrollable area

public final String getTitle ()

Gets the title of a document as specified by the TITLE element in the head of the document.

Returns
  • the document's title

public final String getURL ()

Gets the absolute URI of this document.

Returns
  • the document URI

public final void importNode (Node node, boolean deep)

Imports a node from another document to this document. The returned node has no parent; (getParentNode() is null). The source node is not altered or removed from the original document; this method creates a new copy of the source node. For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and namespaceURI). As in the cloneNode operation on a Node, the source node is not altered. Additional information is copied as appropriate to the nodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case.

Parameters
node the node to import
deep If true, recursively import the subtree under the specified node; if false, import only the node itself, as explained above

public final boolean isCSS1Compat ()

Determines whether the document's "compatMode" is "CSS1Compat". This is normally described as "strict" mode.

Returns
  • true if the document is in CSS1Compat mode

public final void setScrollLeft (int left)

Sets the number of pixels that the document's content is scrolled from the left.

Parameters
left the document's left scroll position

public final void setScrollTop (int top)

Sets the number of pixels that the document's content is scrolled from the top.

Parameters
top the document's top scroll position

public final void setTitle (String title)

Sets the title of a document as specified by the TITLE element in the head of the document.

Parameters
title the document's new title