DhElement | +--DhBaseContainer | +--DhDocumentpublic class DhDocument
Represents an HTML document. You can use it to bind to an existing HTML page and traverse the elements on that page. Alternatively, you can create new elements and add them to the page through this class.
Objects in this class cannot be created directly; instead, you acquire a reference to it through a DhModule class.
Also see wfc.html.DhStyle, wfc.html.DhText, wfc.html.DhElement, wfc.html.DhSection, DhPane
Constructors
Name | Description |
---|---|
DhDocument( DhModule module, IHTMLDocument2 document, IHTMLWindow2 window ) | Creates a document object. |
DhDocument() | Creates a document object. |
Methods
Name | Description |
---|---|
add(DhElement element) | Adds an element into this container. |
add(DhElement element, int insertFlag ) | Adds an element into this container. |
add( DhElement element, DhElement relativeTo, int insertFlag ) | Adds an element into this container. |
add( DhStyle newStyle ) |
Explicitly adds a DhStyle style object to this document.
Note that this is done automatically for you whenever you call the setStyle method on any element. |
addFilter(DhFilter filter) | Topic under construction. |
addFilter(DhFilter filter, boolean bApply) | Adds a filter to this element. |
addFilter(DhFilter filter, boolean bApply, boolean bFlush) | Adds a filter to this element. |
addText( String text ) | Appends a text string to the current document. |
addTransition(DhFilter trans) | Adds a transition effect to this element. |
applyFilters() | Applies filters that were previously deferred. |
enumerate( int type ) | Returns an enumerator that represents the collection of elements. |
findElement( String id ) | Searches for an element in the document. |
findFilter(Class filterClass) | Retrieves the current filter with the specified filter class. |
findStyle(String style) | Retrieves a DHStyle object with the named style for this document. |
getAllElements() | Recursively retrieves all child elements and their children. |
getDomain() | Returns the host name of the server the page is from. |
getElement( IHTMLElement peer ) | Returns the corresponding derivation of DhElement given the underlying HTML element peer. |
getElements() | Retrieves the child elements of this element. |
getFixed() | Determines whether the default placement of elements uses fixed x-y coordinate positioning or traditional HTML text flow layout positioning. |
getHTML() | Returns the representative HTML of this document (also known as the page). |
getLastModified() |
Retrieves the last modified date of the current document in the form
MM/DD/YY HH:MM:SS Return Value: Returns the document's last modified date, or returns a null string if it is unavailable. |
getLocation() | Retrieves the current location of the document. |
getMatchingChildElements( String strQuery, boolean fRecursive ) | Retrieves the matching child elements according to the parameters in strQuery. |
getModule() | Returns the DhModule associated with this document. |
getPeer() | Return the underlying HTML peer element for this class. |
getProtocol() | Retrieves the long name of the protocol. |
getReferrer() | Retrieves the referring document. |
getSize() | Retrieves the current size of the document. |
getStyles() | Retrieves all styles in this document. |
getTitle() | Retrieves the title of the document. |
getWindow() | Retrieves the window object of this document. |
getWindowPeer() | Retrieves the window peer of this document. |
importHTML(String html) | Topic under construction. |
importHTMLFromFile(String file) throws IOException | Imports the HTML code from the specified file. |
MessageBox( String s ) | Displays a modal user message box. |
moveElement( DhElement element, int newOrder ) | Moves an element to a new numeric order in the layout flow. |
newLine() | Appends a new line to the current document. |
recreateElement( String html ) | Deserializes HTML text generated by generateHTML. |
recreateElement( String html, boolean fHonorIDs ) | Deserializes HTML text generated by generateHTML. |
remove(DhElement element) | Removes an element from this container. |
removeAll() | Removes all child elements from this container. |
removeAllFilters() | Automatically removes all filters from this element immediately. |
removeAllFilters(boolean bApply) | Removes all filters from this element. |
removeFilter(DhFilter filter) | Removes the specified filter from this element. |
removeFilter(DhFilter filter, boolean bApply) | Removes the specified filter from this element. |
replaceFilter(DhFilter filter1, DhFilter filter2) | Replaces filters currently applied to the document. |
replaceFilter(DhFilter filter1, DhFilter filter2, boolean bApply) | Replaces filters currently applied to the document. |
setDomain( String strDomain ) | Sets the host domain for the page. |
setFixed( boolean isFixed ) | Determines whether the default placement of elements uses fixed x-y coordinate positioning or traditional HTML text flow layout positioning. |
setFixed() | Sets the default placement of elements to fixed x-y coordinate positioning in contrast to traditional HTML text flow layout. |
setGenerateTags( boolean fGenerate ) | Determines whether HEAD and TITLE tags are generated by the generateHTML() method. |
setTitle( String newTitle ) | Sets the title of the document. |
Creates a document object.
Creates a document object. This is a blank document with no object model binding.
Adds an element into this container. This method adds the element following all other elements.
Adds an element into this container. This method adds the element either at the beginning or at the end of this container depending on the insertFlag parameter.
Adds an element into this container. This method adds the specified element either at the end or at the beginning of the document, or before or after another element.
For details of this method and other available add methods, see DhSection.add.
Explicitly adds a DhStyle style object to this document.
Note that this is done automatically for you whenever you call the setStyle method on any element.
Topic under construction.
Adds a filter to this element. You can apply the filter immediately or delay application. Delaying application is useful if you are applying more than one filter to this element. Filters added this way are combined with other filters that were previously added and not explicity flushed or removed.
wfc.html.DhCantAddElementException thrown if this type of filter already exists on this element.
Adds a filter to this element. You can apply the filter immediately or delay application. Delaying application is useful if you are applying more than one filter to this element. You can also specify whether you want to flush filters that were previously applied to this element or whether you want this filter to be combined with those already present.
wfc.html.DhCantAddElementException thrown if this type of filter already exists on this element.
Appends a text string to the current document.
Adds a transition effect to this element. You must call this method before you can run the effect. Note that this functionality is provided for extension only (see the sample classes). This package does provide transition effects.
wfc.html.DhCantAddElementException thrown if this type of transition effect already exists on this element.
Applies filters that were previously deferred. Use this method if you called addFilter(DhFilter,boolean) with false as the second parameter. This function applies every filter that was added to this element.
Returns a DhEnumeration enumerator that represents the collection of elements of the types defined by the type parameter. This can be one of the following:
Returns an enumerator that represents the collection of elements.
ID="Caption1"
this argument would be: "Caption1".
Returns the DhElement representing the element in the document. This element can then be cast to the actual element type (for example, DhText).
Searches for an element in the document. This method can be used to find any element in the document by the HTML ID attribute.
Returns the DhFilter object (if found) that is of type filterClass.
Retrieves the current filter with the specified filter class.
Returns the style object that corresponds to the style parameter, or returns null if no such style exists in this document.
Retrieves a DHStyle object with the named style for this document.
Note This method is not used in the normal course of programming this package.
Returns an array of all child elements.
Recursively retrieves all child elements and their children.
getAllElements() in DhBaseContainer.
Returns the current host server domain, or returns a null string if it is unavailable.
Returns the host name of the server the page is from.
Returns the specific derivation that corresponds to the peer parameter.
Returns the corresponding derivation of DhElement given the underlying HTML element peer.
Note Calling this method represents a very advanced usage scenario. Typically, you would never use this method.
Returns an array of direct child elements.
Retrieves the child elements of this element.
getElements() in DhBaseContainer.
Returns true if this document uses fixed positioning; otherwise, returns false, which is the default.
Determines whether the default placement of elements uses fixed x-y coordinate positioning or traditional HTML text flow layout positioning. Rather than use this property, it is much more useful to create DhSections and/or DhPanels to control the placement of elements.
Returns the generated or bound HTML text.
Returns the representative HTML of this document (also known as the page).
Returns the document's last modified date, or returns a null string if it is unavailable.
Retrieves the last modified date of the current document in the form
MM/DD/YY HH:MM:SS
Returns a Point object holding the document's location.
Retrieves the current location of the document.
Returns an enumeration of matching elements, or returns null if there are none.
Retrieves the matching child elements according to the parameters in strQuery.
Some query examples are as follows:
getMatchingChildElements(String,boolean) in DhBaseContainer.
Returns the DhModule associated with this document.
Returns the DhModule associated with this document. DhDocument cannot be created directly; instead, you acquire a reference to it through a DhModule object.
Returns the element peer underlying the HTML peer for this class.
Return the underlying HTML peer element for this class. This method may return null if the document is not bound to this class. Java code that is running in a trusted environment can freely cast the resulting reference to a specific element peer type (such as wfc.html.om.IHTMLDocument2). This method always returns null if the code is running in a Web server environment.
Note Calling this method represents a very advanced usage scenario. Typically, you would never use this method.
Returns the name of the protocol.
Retrieves the long name of the protocol.
Examples:
"Hypertext Transfer Protocol"
"File Protocol"
Returns the URL of the referring document, or returns a null string if it is unavailable.
Retrieves the referring document. This is the document that contains the hyperlink to the current document.
Returns a Point object holding the document's size.
Retrieves the current size of the document.
Returns an array of DhStyle objects found on this document.
Retrieves all styles in this document. Style objects can be applied to any element using the setStyle method.
Returns the title of document.
Retrieves the title of the document. For a browser, the title appears in the caption of the browser window.
Returns the window object of the document.
Retrieves the window object of this document.
Returns the WindowPeer object related to this the document.
Retrieves the window peer of this document.
Topic under construction.
Imports the HTML code from the specified file.
IOException thrown if file cannot be read or opened.
Displays a modal user message box.
Moves an element to a new numeric order in the layout flow.
Appends a new line to the current document. All elements added after this call will be on a new line.
Returns the corresponding tree of derivations of DhElements that originally created the text in the html parameter.
Deserializes HTML text generated by generateHTML. The default case of calling this method ignores the ID attributes of the HTML and overrides those attributes with IDs that are unique to this document. To control this behavior, see recreateElement(String,boolean).
Returns the corresponding tree of derivations of DhElements that originally created the text in the html parameter.
Deserializes HTML text generated by generateHTML. Passing true to fHonorIDs tells this method not to overwrite the ID attributes of the HTML tags in the html parameter. This is a very advanced usage of this method. If ID attributes conflict with elements already on the page, the resulting behavior is undefined in the rest of the package.
Removes an element from this container. If the element was visible prior to this call, it will not be visible after the call.
Removes all child elements from this container. If the elements were visible prior to this call, they will not be visible after the call.
Automatically removes all filters from this element immediately.
Removes all filters from this element. You can clear all filters on this element or delay removal.
Removes the specified filter from this element. This method automatically reapplies filters that may be left after this method is called.
Removes the specified filter from this element. You can reapply other filters that may be left after this method is called, or you can delay if you are removing more than one filter.
Replaces filters currently applied to the document. This method provides an easy way to swap filters. It automatically applies all the changes immediately.
Replaces filters currently applied to the document. This method provides an easy way to swap filters. You can specify whether to apply all the changes immediately or to delay making changes until later.
Sets the host domain for the page. Pages on different frames can have their domains set to the same host to allow communication between frames.
Determines whether the default placement of elements uses fixed x-y coordinate positioning or traditional HTML text flow layout positioning. Rather than use this method, it is much more useful to create DhSection objects and/or DhPanel objects to control the placement of elements.
Sets the default placement of elements to fixed x-y coordinate positioning in contrast to traditional HTML text flow layout. Rather than use this method, it is much more useful to create DhSections and/or DhPanels to control the placement of elements.
Determines whether HEAD and TITLE tags are generated by the generateHTML() method.
Sets the title of the document. For a browser, the title appears in the caption of the browser window.