java.lang.Object | |||
↳ | com.google.gwt.core.client.JavaScriptObject | ||
↳ | com.google.gwt.dom.client.Node | ||
↳ | com.google.gwt.dom.client.Document |
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.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.dom.client.Node
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an <a> element.
| |||||||||||
Creates an <area> element.
| |||||||||||
Creates an <audio> element.
| |||||||||||
Creates a <br> element.
| |||||||||||
Creates a <base> element.
| |||||||||||
Creates a <blockquote> element.
| |||||||||||
Creates a 'blur' event.
| |||||||||||
This method is deprecated.
use
createPushButtonElement() ,
createResetButtonElement() or
createSubmitButtonElement() instead.
| |||||||||||
Creates an <input type='button'> element.
| |||||||||||
Creates a <canvas> element.
| |||||||||||
Creates a <caption> element.
| |||||||||||
Creates a 'change' event.
| |||||||||||
Creates an <input type='checkbox'> element.
| |||||||||||
Creates a 'click' event.
| |||||||||||
Creates a <col> element.
| |||||||||||
Creates a <colgroup> element.
| |||||||||||
Creates a 'contextmenu' event.
| |||||||||||
Creates a <dl> element.
| |||||||||||
Creates a 'dblclick' event.
| |||||||||||
Creates a <del> element.
| |||||||||||
Creates a <div> element.
| |||||||||||
Creates a new element.
| |||||||||||
Creates an 'error' event.
| |||||||||||
Creates a <fieldset> element.
| |||||||||||
Creates an <input type='file'> element.
| |||||||||||
Creates a 'focus' event.
| |||||||||||
Creates a <form> element.
| |||||||||||
Creates a <frame> element.
| |||||||||||
Creates a <frameset> element.
| |||||||||||
Creates an <h(n)> element.
| |||||||||||
Creates an <hr> element.
| |||||||||||
Creates a <head> element.
| |||||||||||
Creates an <input type='hidden'> element.
| |||||||||||
Creates an event.
| |||||||||||
Creates an <iframe> element.
| |||||||||||
Creates an <img> element.
| |||||||||||
Creates an <input type='image'> element.
| |||||||||||
Creates an <ins> element.
| |||||||||||
Creates a key-code event ('keydown' or 'keyup').
| |||||||||||
Creates a 'keydown' event.
| |||||||||||
This method is deprecated.
as of GWT2.1 (keydown events don't have a charCode), use
createKeyDownEvent(boolean, boolean, boolean, boolean, int)
| |||||||||||
This method is deprecated.
use
createKeyCodeEvent(String, boolean, boolean, boolean, boolean, int)
or
createKeyPressEvent(boolean, boolean, boolean, boolean, int)
| |||||||||||
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.
| |||||||||||
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.
| |||||||||||
Creates a <li> element.
| |||||||||||
Creates a <label> element.
| |||||||||||
Creates a <legend> element.
| |||||||||||
Creates a <link> element.
| |||||||||||
Creates a 'load' event.
| |||||||||||
Creates a <map> element.
| |||||||||||
Creates a <meta> element.
| |||||||||||
Creates a 'mousedown' event.
| |||||||||||
Creates an mouse event.
| |||||||||||
Creates a 'mousemove' event.
| |||||||||||
Creates a 'mouseout' event.
| |||||||||||
Creates a 'mouseover' event.
| |||||||||||
Creates a 'mouseup' event.
| |||||||||||
Creates an <ol> element.
| |||||||||||
Creates a <object> element.
| |||||||||||
Creates an <optgroup> element.
| |||||||||||
Creates an <option> element.
| |||||||||||
Creates a <p> element.
| |||||||||||
Creates a <param> element.
| |||||||||||
Creates an <input type='password'> element.
| |||||||||||
Creates a <pre> element.
| |||||||||||
Creates a <button type='button'> element.
| |||||||||||
Creates a <q> element.
| |||||||||||
Creates an <input type='radio'> element.
| |||||||||||
Creates a <button type='reset'> element.
| |||||||||||
Creates an <input type='reset'> element.
| |||||||||||
Creates a <script> element.
| |||||||||||
Creates a <script> element.
| |||||||||||
Creates a 'scroll' event.
| |||||||||||
Creates a <select> element.
| |||||||||||
Creates a <select> element.
| |||||||||||
Creates a <span> element.
| |||||||||||
Creates a <style> element.
| |||||||||||
Creates a <button type='submit'> element.
| |||||||||||
Creates an <input type='submit'> element.
| |||||||||||
Creates a <tbody> element.
| |||||||||||
Creates a <td> element.
| |||||||||||
Creates a <tfoot> element.
| |||||||||||
Creates a <th> element.
| |||||||||||
Creates a <thead> element.
| |||||||||||
Creates a <tr> element.
| |||||||||||
Creates a <table> element.
| |||||||||||
Creates a <textarea> element.
| |||||||||||
Creates an <input type='text'> element.
| |||||||||||
Creates a text node.
| |||||||||||
Creates a <title> element.
| |||||||||||
Creates a <ul> element.
| |||||||||||
Creates an identifier guaranteed to be unique within this document.
| |||||||||||
Creates a <video> element.
| |||||||||||
Enables or disables scrolling of the document.
| |||||||||||
Gets the default document.
| |||||||||||
The element that contains the content for the document.
| |||||||||||
Returns the left offset between the absolute coordinate system and the
body's positioning context.
| |||||||||||
Returns the top offset between the absolute coordinate system and the
body's positioning context.
| |||||||||||
The height of the document's client area.
| |||||||||||
The width of the document's client area.
| |||||||||||
Gets the document's "compatibility mode", typically used for determining
whether the document is in "quirks" or "strict" mode.
| |||||||||||
Gets the document's element.
| |||||||||||
The domain name of the server that served the document, or null if the
server cannot be identified by a domain name.
| |||||||||||
Returns the
Element whose id is given by elementId. | |||||||||||
Returns the URI of the page that linked to this page.
| |||||||||||
The height of the scrollable area of the document.
| |||||||||||
The number of pixels that the document's content is scrolled from the left.
| |||||||||||
The number of pixels that the document's content is scrolled from the top.
| |||||||||||
The width of the scrollable area of the document.
| |||||||||||
Gets the title of a document as specified by the TITLE element in the head
of the document.
| |||||||||||
Gets the absolute URI of this document.
| |||||||||||
Imports a node from another document to this document.
| |||||||||||
Determines whether the document's "compatMode" is "CSS1Compat".
| |||||||||||
Sets the number of pixels that the document's content is scrolled from the
left.
| |||||||||||
Sets the number of pixels that the document's content is scrolled from the
top.
| |||||||||||
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
|
Creates an <a> element.
Creates an <area> element.
Creates an <audio> element.
Creates a <base> element.
Creates a <blockquote> element.
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.
Creates an <input type='button'> element.
Creates a <canvas> element.
Creates a <caption> element.
Creates an <input type='checkbox'> element.
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.
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 |
Creates a <col> element.
Creates a <colgroup> element.
Creates a 'contextmenu' event. Note: Contextmenu events will not dispatch properly on Firefox 2 and earlier.
Creates a <dl> element.
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.
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 |
Creates a <del> element.
Creates a <div> element.
Creates a new element.
tagName | the tag name of the element to be created |
---|
Creates a <fieldset> element.
Creates an <input type='file'> element.
Creates a <form> element.
Creates a <frame> element.
Creates a <frameset> element.
Creates an <h(n)> element.
n | the type of heading, from 1 to 6 inclusive |
---|
Creates an <hr> element.
Creates a <head> element.
Creates an <input type='hidden'> element.
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).
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 |
Creates an <iframe> element.
Creates an <img> element.
Creates an <input type='image'> element.
Creates an <ins> element.
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)
.
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 |
Creates a 'keydown' event.
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 |
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.
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 |
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).
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 |
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.
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 |
Creates a 'keypress' event.
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 |
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.
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 |
Creates a 'keyup' event.
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 |
Creates a <label> element.
Creates a <legend> element.
Creates a <link> element.
Creates a <map> element.
Creates a <meta> element.
Creates a 'mousedown' event.
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) |
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).
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) |
Creates a 'mousemove' event.
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) |
Creates a 'mouseout' event. Note: The 'relatedTarget' parameter will be ignored on Firefox 2 and earlier.
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 |
Creates a 'mouseover' event. Note: The 'relatedTarget' parameter will be ignored on Firefox 2 and earlier.
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 |
Creates a 'mouseup' event.
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) |
Creates an <ol> element.
Creates a <object> element.
Creates an <optgroup> element.
Creates an <option> element.
Creates a <p> element.
Creates a <param> element.
Creates an <input type='password'> element.
Creates a <pre> element.
Creates a <button type='button'> element.
Creates a <q> element.
Creates an <input type='radio'> element.
name | the name of the radio input (used for grouping) |
---|
Creates a <button type='reset'> element.
Creates an <input type='reset'> element.
Creates a <script> element.
source | the source code to set inside the element |
---|
Creates a <script> element.
Creates a 'scroll' event. Note: Contextmenu events will not dispatch properly on Firefox 2 and earlier.
Creates a <select> element.
Creates a <select> element.
multiple | true to allow multiple-selection |
---|
Creates a <span> element.
Creates a <style> element.
Creates a <button type='submit'> element.
Creates an <input type='submit'> element.
Creates a <tbody> element.
Creates a <td> element.
Creates a <tfoot> element.
Creates a <th> element.
Creates a <thead> element.
Creates a <tr> element.
Creates a <table> element.
Creates a <textarea> element.
Creates an <input type='text'> element.
Creates a text node.
data | the text node's initial text |
---|
Creates a <title> element.
Creates a <ul> element.
Creates an identifier guaranteed to be unique within this document. This is useful for allocating element id's.
Creates a <video> element.
Enables or disables scrolling of the document.
enable | whether scrolling should be enabled or disabled |
---|
Gets the default document. This is the document in which the module is running.
The element that contains the content for the document. In documents with BODY contents, returns the BODY element.
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 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.
The height of the document's client area.
The width of the document's client area.
Gets the document's "compatibility mode", typically used for determining whether the document is in "quirks" or "strict" mode.
Gets the document's element. This is typically the <html> element.
The domain name of the server that served the document, or null if the server cannot be identified by a domain name.
null
if none exists
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.
elementId | the unique id value for an element |
---|
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).
The height of the scrollable area of the document.
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.
The number of pixels that the document's content is scrolled from the top.
The width of the scrollable area of the document.
Gets the title of a document as specified by the TITLE element in the head of the document.
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.
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
|
Determines whether the document's "compatMode" is "CSS1Compat". This is normally described as "strict" mode.
true
if the document is in CSS1Compat mode
Sets the number of pixels that the document's content is scrolled from the left.
left | the document's left scroll position |
---|
Sets the number of pixels that the document's content is scrolled from the top.
top | the document's top scroll position |
---|
Sets the title of a document as specified by the TITLE element in the head of the document.
title | the document's new title |
---|