onDocumentComplete has fired.
This class allows access to the underlying Document Object Model of a Webpage
- See Also:
NetworkListener
Method Summary |
void |
addScrollPositionListener(ScrollPositionListener listener)
Add a ScrollPositionListener to this document. |
void |
close()
Closes an output stream and forces the sent data to display. |
IElement |
createElement(java.lang.String name)
Creates an instance of the element for the specified tag. |
IRange |
createRange()
Returns an empty Range object that is tied to the current document. |
void |
deleteSelectedText()
Deletes the current selected text. |
IElement |
elementFromPoint(long x,
long y)
Gets the element object located at coordinate (x, y) on the document. |
boolean |
equals(IDocument element)
Compares with another IDocument. |
void |
execCommand(java.lang.String cmd,
boolean showUI,
java.lang.String value)
Executes a command on the current document with specified value. |
IElement |
getActiveElement()
Gets the object that has the focus when the parent document has focus. |
java.lang.String |
getActiveInnerHTML()
Get Inner HTML of current HTML DOM Node. |
java.lang.String |
getActiveOuterHTML()
Get Outer HTML of current HTML DOM Node. |
java.lang.String |
getAlinkColour()
Gets the colour of all active links in the document. |
IElementCollection |
getAll()
Gets an interface pointer to a zero-based
collection of all the elements in the HTML document. |
IElementCollection |
getAnchors()
Gets an interface pointer to a zero-based
collection of all the anchors in an HTML document. |
IElementCollection |
getApplets()
Gets an interface pointer to a zero-based
collection of all the applet objects in an HTML
document. |
java.lang.String |
getBgColour()
Gets a value that indicates the
background color behind the object. |
IElement |
getBody()
Gets the document's body object. |
java.lang.String |
getCharSet()
Gets the character set used to encode the object. |
IDocument[] |
getChildFrames()
Gets the child frames of a document. |
java.lang.String |
getCookie()
Gets the string value of a cookie. |
java.lang.String |
getDefaultCharSet()
Gets the default character set. |
java.lang.String |
getDesignMode()
Gets a value that indicates whether or not the document can be edited. |
java.lang.String |
getDocumentSource()
Gets the unmodified source for the document. |
java.lang.String |
getDomain()
Gets the security domain of the document. |
IElement |
getElementById(java.lang.String iD)
Returns the IElement with specified
ID or null if no element exists with that ID |
IElementCollection |
getEmbeds()
Gets an interface pointer to a zero-based
collection of all the embed objects in an HTML
document. |
boolean |
getExpando()
Gets a value indicating whether arbitrary variables can be created within the object. |
java.lang.String |
getFgColour()
Gets the foreground (text) colour of the document. |
java.lang.String |
getFileCreatedDate()
Gets the date the file was created. |
java.lang.String |
getFileModifiedDate()
Gets the date the file was last modified. |
java.lang.String |
getFileSize()
Gets the file size. |
java.lang.String |
getFileUpdatedDate()
Gets the date the file was last updated. |
IElementCollection |
getForms()
Gets an interface pointer to a zero-based
collection of all the form objects in an HTML document. |
IElementCollection |
getFrames()
Deprecated. |
IElementCollection |
getImages()
Gets a collection of images in a document. |
java.lang.String |
getLastModified()
Gets the date the page was last modified, if the page supplies one. |
java.lang.String |
getLinkColour()
Gets the colour of the document links. |
IElementCollection |
getLinks()
Gets an interface pointer to a zero-based
collection of all the link and area objects in an
HTML document. |
java.lang.String |
getMimeType()
Gets the MIME type for the document. |
java.lang.String |
getNameProp()
Gets the title of the document file. |
IElementCollection |
getPlugins()
Gets an interface pointer to a zero-based
collection of all the embed objects in an HTML
document. |
java.lang.String |
getProtocol()
Gets the protocol portion of a URL. |
java.lang.String |
getReadyState()
Gets a the current state of the object. |
java.lang.String |
getReferrer()
Gets the referrer URL. |
IElementCollection |
getScripts()
Gets an interface pointer to a zero-based collection of all the script objects in an HTML
document. |
java.lang.String |
getSecurity()
Gets security information for the document. |
java.lang.String |
getSelectedText()
Returns the active text selection in the document. |
IRange |
getSelectionAsRange()
Returns a Range object that is constructed from the current selection. |
IStyleSheet[] |
getStyleSheets()
Get the styleSheets on the document. |
java.lang.String |
getTitle()
Gets the title of the document. |
java.lang.String |
getURL()
Gets the URL for the current document. |
java.lang.String |
getVlinkColour()
Gets the colour of the links that the user has visited. |
void |
open()
Opens a document to collect the output of the write and writeln methods. |
void |
putAlinkColour(java.lang.String col)
Sets the colour of all active links in the document. |
void |
putBgColour(java.lang.String col)
Sets the value that indicates the
background colour of the document. |
void |
putCharSet(java.lang.String cset)
Sets the character set used to encode the object. |
void |
putCookie(java.lang.String cookie)
Sets the String value of a cookie |
void |
putDefaultCharSet(java.lang.String cset)
Sets the default character set from the current regional language settings. |
void |
putDesignMode(java.lang.String mode)
Sets a value that indicates whether the document can be edited. |
void |
putDomain(java.lang.String domain)
Sets the security domain of the document. |
void |
putExpando(boolean b)
Sets a value indicating whether or not arbitrarty variables can be created within the object. |
void |
putFgColour(java.lang.String col)
Sets the foreground (text) colour of the document. |
void |
putLinkColour(java.lang.String col)
Sets the colour of links in the document. |
void |
putTitle(java.lang.String title)
Sets the title of the document. |
void |
putURL(java.lang.String url)
Sets the URL for the current document. |
void |
putVlinkColour(java.lang.String col)
Sets the colour in which visited links are displayed. |
boolean |
queryCommandEnabled(java.lang.String cmd)
Query if command enabled. |
boolean |
queryCommandIndeterm(java.lang.String cmd)
Check to see if command is in indeterminate state. |
boolean |
queryCommandState(java.lang.String cmd)
Check the current state of the command. |
boolean |
queryCommandSupported(java.lang.String cmd)
Check if the command is supported. |
void |
removeScrollPositionListener(ScrollPositionListener listener)
Remove a scrollPositionListener from this Document. |
void |
scrollTo(long x,
long y)
Scroll this Document to given x,y position. |
void |
setActiveInnerHTML(java.lang.String strHTML)
Set Inner HTML to current HTML DOM Node. |
void |
setActiveOuterHTML(java.lang.String strHTML)
Set Outer HTML to current HTML DOM Node. |
java.lang.String |
toString()
Gets a string representation of the object. |
void |
write(java.lang.String data)
Writes one or more HTML expressions to a document in the specified window. |
void |
writeln(java.lang.String data)
Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. |
setActiveInnerHTML
public void setActiveInnerHTML(java.lang.String strHTML)
- Set Inner HTML to current HTML DOM Node.
This applies to an
IEBrowserCanvas
- Parameters:
strHTML
-
setActiveOuterHTML
public void setActiveOuterHTML(java.lang.String strHTML)
- Set Outer HTML to current HTML DOM Node.
This applies to an
IEBrowserCanvas
- Parameters:
strHTML
-
getActiveInnerHTML
public java.lang.String getActiveInnerHTML()
- Get Inner HTML of current HTML DOM Node.
This applies to an
IEBrowserCanvas
- Returns:
- the inner HTML.
getActiveOuterHTML
public java.lang.String getActiveOuterHTML()
- Get Outer HTML of current HTML DOM Node.
This applies to an
IEBrowserCanvas
- Returns:
- the outer HTML.
getActiveElement
public IElement getActiveElement()
- Gets the object that has the focus when the parent document has focus.
If this is called on an
MozillaBrowserCanvas
it will only get focusable elements, as Mozilla has no concept of an active element.
- Returns:
- the active element.
getAlinkColour
public java.lang.String getAlinkColour()
- Gets the colour of all active links in the document.
- Returns:
- the colour of active links.
putAlinkColour
public void putAlinkColour(java.lang.String col)
- Sets the colour of all active links in the document.
- Parameters:
col
- the colour of active links.
getAll
public IElementCollection getAll()
- Gets an interface pointer to a zero-based
collection of all the elements in the HTML document.
- Returns:
- a collection of elements in the document.
getAnchors
public IElementCollection getAnchors()
- Gets an interface pointer to a zero-based
collection of all the anchors in an HTML document.
The elements are in the same order as they appear in
the document.
- Returns:
- collection of objects representing anchors in document.
getApplets
public IElementCollection getApplets()
- Gets an interface pointer to a zero-based
collection of all the applet objects in an HTML
document. The objects are in the same order as
they appear in the document.
- Returns:
- collection of objects representing applets in document.
getBgColour
public java.lang.String getBgColour()
- Gets a value that indicates the
background color behind the object.
- Returns:
- background color.
putBgColour
public void putBgColour(java.lang.String col)
- Sets the value that indicates the
background colour of the document.
- Parameters:
col
- background colour of the document.
getBody
public IElement getBody()
- Gets the document's body object.
- Returns:
- reference to the document body.
getCharSet
public java.lang.String getCharSet()
- Gets the character set used to encode the object.
- Returns:
- character set used to encode the object.
putCharSet
public void putCharSet(java.lang.String cset)
- Sets the character set used to encode the object.
This applies to an
IEBrowserCanvas
- Parameters:
cset
- character set used to encode the object.
close
public void close()
- Closes an output stream and forces the sent data to display.
getCookie
public java.lang.String getCookie()
- Gets the string value of a cookie.
- Returns:
- cookie
putCookie
public void putCookie(java.lang.String cookie)
- Sets the String value of a cookie
- Parameters:
cookie
- value of cookie
createElement
public IElement createElement(java.lang.String name)
- Creates an instance of the element for the specified tag.
- Parameters:
name
- tag
getDefaultCharSet
public java.lang.String getDefaultCharSet()
- Gets the default character set.
- Returns:
- default character set.
putDefaultCharSet
public void putDefaultCharSet(java.lang.String cset)
- Sets the default character set from the current regional language settings.
STATUS: Not Implemented
- Parameters:
cset
- The default character set.
getDesignMode
public java.lang.String getDesignMode()
- Gets a value that indicates whether or not the document can be edited.
This applies to an
IEBrowserCanvas
- Returns:
- design mode.
putDesignMode
public void putDesignMode(java.lang.String mode)
- Sets a value that indicates whether the document can be edited.
This applies to an
IEBrowserCanvas
- Parameters:
mode
- design mode.
getDomain
public java.lang.String getDomain()
- Gets the security domain of the document.
- Returns:
- Security domain.
putDomain
public void putDomain(java.lang.String domain)
- Sets the security domain of the document.
This applies to an
IEBrowserCanvas
- Parameters:
domain
- The security domain.
elementFromPoint
public IElement elementFromPoint(long x,
long y)
- Gets the element object located at coordinate (x, y) on the document.
- Parameters:
x
- X-coordinate.y
- Y-coordinate.
- Returns:
- The element at the specified coordinate.
getEmbeds
public IElementCollection getEmbeds()
- Gets an interface pointer to a zero-based
collection of all the embed objects in an HTML
document. The objects are in the same order as they
appear in the document.
- Returns:
- Collection of embed objects.
getExpando
public boolean getExpando()
- Gets a value indicating whether arbitrary variables can be created within the object.
This applies to an
IEBrowserCanvas
- Returns:
- value indicates if variables can be created.
putExpando
public void putExpando(boolean b)
- Sets a value indicating whether or not arbitrarty variables can be created within the object.
This applies to an
IEBrowserCanvas
- Parameters:
b
- indicates if variables can be created.
getFgColour
public java.lang.String getFgColour()
- Gets the foreground (text) colour of the document.
- Returns:
- Foreground colour of the document.
putFgColour
public void putFgColour(java.lang.String col)
- Sets the foreground (text) colour of the document.
- Parameters:
col
- Foreground colour of the document.
getFileCreatedDate
public java.lang.String getFileCreatedDate()
- Gets the date the file was created.
- Returns:
- File creation date.
getFileModifiedDate
public java.lang.String getFileModifiedDate()
- Gets the date the file was last modified.
- Returns:
- File last-modification date.
getFileSize
public java.lang.String getFileSize()
- Gets the file size.
- Returns:
- File size.
getFileUpdatedDate
public java.lang.String getFileUpdatedDate()
- Gets the date the file was last updated.
- Returns:
- Date file was last updated.
getForms
public IElementCollection getForms()
- Gets an interface pointer to a zero-based
collection of all the form objects in an HTML document.
The objects are in the same order as they appear in
the document.
- Returns:
- Collection of form objects in document.
getFrames
public IElementCollection getFrames()
- Deprecated.
- Gets an interface pointer to a zero-based
collection of all the frame objects in an HTML document. The
Objects are in the same order as they appear in the
document.
- Returns:
- Collection of frame objects.
getChildFrames
public IDocument[] getChildFrames()
- Gets the child frames of a document.
If this is a frameset document returns the child frames in an array, otherwise returns null.
- Returns:
- An array of IDocuments for the child frames
getImages
public IElementCollection getImages()
- Gets a collection of images in a document.
Gets a pointer to the HTMLElementCollection interface
of the zero-based collection of all the images in an HTML
document. The images are in the same order as they appear
in the document.
- Returns:
- Collection of images.
getLastModified
public java.lang.String getLastModified()
- Gets the date the page was last modified, if the page supplies one.
- Returns:
- Last modified date of page.
getLinkColour
public java.lang.String getLinkColour()
- Gets the colour of the document links.
- Returns:
- Colour of the document links.
putLinkColour
public void putLinkColour(java.lang.String col)
- Sets the colour of links in the document.
getLinks
public IElementCollection getLinks()
- Gets an interface pointer to a zero-based
collection of all the link and area objects in an
HTML document. The objects are in the same order as
they appear in the document.
- Returns:
- Collection of link and area objects in document.
getMimeType
public java.lang.String getMimeType()
- Gets the MIME type for the document.
- Returns:
- MIME type for the document.
getNameProp
public java.lang.String getNameProp()
- Gets the title of the document file.
- Returns:
- Title of document.
getPlugins
public IElementCollection getPlugins()
- Gets an interface pointer to a zero-based
collection of all the embed objects in an HTML
document. The objects are in the same order as
they appear in the document.
- Returns:
- Collection of embed objects in document.
getProtocol
public java.lang.String getProtocol()
- Gets the protocol portion of a URL.
- Returns:
- Proptocol portion of URL.
queryCommandEnabled
public boolean queryCommandEnabled(java.lang.String cmd)
- Query if command enabled.
- Parameters:
cmd
- Command to check.
- Returns:
- indicates whether a specified command can be successfully executed using IHTMLDocument2::execCommand, given the current state of the document.
queryCommandIndeterm
public boolean queryCommandIndeterm(java.lang.String cmd)
- Check to see if command is in indeterminate state.
- Parameters:
cmd
- The command.
- Returns:
- indicates whether the specified command is in an indeterminate state.
queryCommandState
public boolean queryCommandState(java.lang.String cmd)
- Check the current state of the command.
- Parameters:
cmd
- The command.
- Returns:
- value indicates the current state of the command.
queryCommandSupported
public boolean queryCommandSupported(java.lang.String cmd)
- Check if the command is supported.
- Parameters:
cmd
- The command.
- Returns:
- value indicates if the command is supported on the current range.
getReadyState
public java.lang.String getReadyState()
- Gets a the current state of the object.
- Returns:
- The ready state.
getReferrer
public java.lang.String getReferrer()
- Gets the referrer URL.
- Returns:
- the URL of the location that referred the user to the current page.
getScripts
public IElementCollection getScripts()
- Gets an interface pointer to a zero-based collection of all the script objects in an HTML
document. The objects are in the same order as they appear in the document.
- Returns:
- Collection of script objects.
getSecurity
public java.lang.String getSecurity()
- Gets security information for the document.
- Returns:
- Security information.
getStyleSheets
public IStyleSheet[] getStyleSheets()
- Get the styleSheets on the document.
- Returns:
- array of stylesheets on the document.
getTitle
public java.lang.String getTitle()
- Gets the title of the document. The title
identifies the contents of the document and is
displayed in the header bar of the document window.
- Returns:
- Title of the document.
putTitle
public void putTitle(java.lang.String title)
- Sets the title of the document.
- Parameters:
title
- The title of the document.
toString
public java.lang.String toString()
- Gets a string representation of the object.
- Returns:
- String representation.
getURL
public java.lang.String getURL()
- Gets the URL for the current document.
- Returns:
- URL of document.
putURL
public void putURL(java.lang.String url)
- Sets the URL for the current document.
- Parameters:
url
- URL for the document.
getVlinkColour
public java.lang.String getVlinkColour()
- Gets the colour of the links that the user has visited.
- Returns:
- Colour of the links.
putVlinkColour
public void putVlinkColour(java.lang.String col)
- Sets the colour in which visited links are displayed.
open
public void open()
- Opens a document to collect the output of the write and writeln methods.
write
public void write(java.lang.String data)
- Writes one or more HTML expressions to a document in the specified window.
- Parameters:
data
- HTML expression.
writeln
public void writeln(java.lang.String data)
- Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
- Parameters:
data
- HTML expression.
getSelectedText
public java.lang.String getSelectedText()
- Returns the active text selection in the document.
- Returns:
- Selected text.
createRange
public IRange createRange()
- Returns an empty Range object that is tied to the current document.
- Returns:
- Empty Range Object
getSelectionAsRange
public IRange getSelectionAsRange()
- Returns a Range object that is constructed from the current selection.
If no selection is currently made on this document, null
is returned.
- Returns:
- Range object made from current selection.
getElementById
public IElement getElementById(java.lang.String iD)
- Returns the
IElement
with specified
ID or null
if no element exists with that ID
- Parameters:
iD
- ID of element.
- Returns:
- Element with given ID
equals
public boolean equals(IDocument element)
- Compares with another IDocument.
- Parameters:
element
- IDocument to compare
- Returns:
true
if IDocuments are the same.
addScrollPositionListener
public void addScrollPositionListener(ScrollPositionListener listener)
- Add a ScrollPositionListener to this document.
- Parameters:
listener
- The ScrollPositionListener to add.
removeScrollPositionListener
public void removeScrollPositionListener(ScrollPositionListener listener)
- Remove a scrollPositionListener from this Document.
- Parameters:
listener
- The ScrollPositionListener to remove.
scrollTo
public void scrollTo(long x,
long y)
- Scroll this Document to given x,y position.
- Parameters:
x
- coordinate (in twips).y
- coordinate (in twips).
execCommand
public void execCommand(java.lang.String cmd,
boolean showUI,
java.lang.String value)
- Executes a command on the current document with specified value.
(This applies to a document retrieved from an
IIEBrowserCanvas
).
Some common commands include:
- "Bold" - Toggles the current selection between bold and nonbold.
E.g. doc.execCommand("Bold",false,"");
- "FontName" - Sets the font for the current selection.
E.g. doc.execCommand("Font",false,"Arial");
- "FontSize" - Sets the font size for the current selection. (This value must be between 1 and 7, inclusive).
E.g. doc.execCommand("FontSize",false,"3");
- "ForeColor" - Sets the foreground(text) color of the current selection.
E.g. doc.execCommand("ForeColor",false,"red");
- "Italic" - Toggles the current selection between italic and nonitalic.
E.g. doc.execCommand("Italic",false,"");
- "Underline" - Toggles the current selection between underlined and not underlined.
E.g. doc.execCommand("Underline",false,"");
See http://msdn.microsoft.com/workshop/author/dhtml/reference/commandids.asp for a complete list of commands.
- Parameters:
cmd
- The command to execute.showUI
- if set to true, display a user interface if the command supports one.value
- the value to assign.
getDocumentSource
public java.lang.String getDocumentSource()
- Gets the unmodified source for the document.
Use getChildFrames to get frames documents to get their source.
- Returns:
- Source of document.
deleteSelectedText
public void deleteSelectedText()
- Deletes the current selected text.
If the Browser type is IE and the selection contains non-text, the command is aborted.