onDocumentComplete has fired.
This class allows access to the underlying Document Object Model of a Webpage
- See Also:
NetworkListener
|
Method Summary |
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 |
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 |
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. |
java.lang.String |
getFgColour()
Gets the foreground (text) colour of the document. |
java.lang.String |
getFileModifiedDate()
Gets the date the file was last modified. |
IElementCollection |
getForms()
Gets an interface pointer to a zero-based
collection of all the form objects in an HTML document. |
IElementCollection |
getImages()
Gets a collection of images in a document. |
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 |
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 |
putCookie(java.lang.String cookie)
Sets the String value of a cookie |
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. |
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. |
getActiveElement
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
java.lang.String getAlinkColour()
- Gets the colour of all active links in the document.
- Returns:
- the colour of active links.
putAlinkColour
void putAlinkColour(java.lang.String col)
- Sets the colour of all active links in the document.
- Parameters:
col - the colour of active links.
getAll
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
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
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
java.lang.String getBgColour()
- Gets a value that indicates the
background color behind the object.
- Returns:
- background color.
putBgColour
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
IElement getBody()
- Gets the document's body object.
- Returns:
- reference to the document body.
getCharSet
java.lang.String getCharSet()
- Gets the character set used to encode the object.
- Returns:
- character set used to encode the object.
close
void close()
- Closes an output stream and forces the sent data to display.
getCookie
java.lang.String getCookie()
- Gets the string value of a cookie.
- Returns:
- cookie
putCookie
void putCookie(java.lang.String cookie)
- Sets the String value of a cookie
- Parameters:
cookie - value of cookie
createElement
IElement createElement(java.lang.String name)
- Creates an instance of the element for the specified tag.
- Parameters:
name - tag
getDefaultCharSet
java.lang.String getDefaultCharSet()
- Gets the default character set.
- Returns:
- default character set.
getDomain
java.lang.String getDomain()
- Gets the security domain of the document.
- Returns:
- Security domain.
elementFromPoint
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
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.
getFgColour
java.lang.String getFgColour()
- Gets the foreground (text) colour of the document.
- Returns:
- Foreground colour of the document.
putFgColour
void putFgColour(java.lang.String col)
- Sets the foreground (text) colour of the document.
- Parameters:
col - Foreground colour of the document.
getFileModifiedDate
java.lang.String getFileModifiedDate()
- Gets the date the file was last modified.
- Returns:
- File last-modification date.
getForms
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.
getChildFrames
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
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.
getLinkColour
java.lang.String getLinkColour()
- Gets the colour of the document links.
- Returns:
- Colour of the document links.
putLinkColour
void putLinkColour(java.lang.String col)
- Sets the colour of links in the document.
- Parameters:
col - Colour of the links.
getLinks
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
java.lang.String getMimeType()
- Gets the MIME type for the document.
- Returns:
- MIME type for the document.
getNameProp
java.lang.String getNameProp()
- Gets the title of the document file.
- Returns:
- Title of document.
getPlugins
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
java.lang.String getProtocol()
- Gets the protocol portion of a URL.
- Returns:
- Proptocol portion of URL.
getReferrer
java.lang.String getReferrer()
- Gets the referrer URL.
- Returns:
- the URL of the location that referred the user to the current page.
getScripts
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
java.lang.String getSecurity()
- Gets security information for the document.
- Returns:
- Security information.
getStyleSheets
IStyleSheet[] getStyleSheets()
- Get the styleSheets on the document.
- Returns:
- array of stylesheets on the document.
getTitle
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
void putTitle(java.lang.String title)
- Sets the title of the document.
- Parameters:
title - The title of the document.
toString
java.lang.String toString()
- Gets a string representation of the object.
- Overrides:
toString in class java.lang.Object
- Returns:
- String representation.
getURL
java.lang.String getURL()
- Gets the URL for the current document.
- Returns:
- URL of document.
putURL
void putURL(java.lang.String url)
- Sets the URL for the current document.
- Parameters:
url - URL for the document.
getVlinkColour
java.lang.String getVlinkColour()
- Gets the colour of the links that the user has visited.
- Returns:
- Colour of the links.
putVlinkColour
void putVlinkColour(java.lang.String col)
- Sets the colour in which visited links are displayed.
- Parameters:
col - Colour of the links.
open
void open()
- Opens a document to collect the output of the write and writeln methods.
write
void write(java.lang.String data)
- Writes one or more HTML expressions to a document in the specified window.
- Parameters:
data - HTML expression.
writeln
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
java.lang.String getSelectedText()
- Returns the active text selection in the document.
- Returns:
- Selected text.
createRange
IRange createRange()
- Returns an empty Range object that is tied to the current document.
- Returns:
- Empty Range Object
getSelectionAsRange
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
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
boolean equals(IDocument element)
- Compares with another IDocument.
- Parameters:
element - IDocument to compare
- Returns:
true if IDocuments are the same.
execCommand
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
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
void deleteSelectedText()
- Deletes the current selected text.
If the Browser type is IE and the selection contains non-text, the command is aborted.