ice.pilots.html4
Class DDocument

java.lang.Object
  extended byice.storm.DynamicObject
      extended byice.pilots.html4.DNode
          extended byice.pilots.html4.DDocument
All Implemented Interfaces:
Cloneable, Document, DocumentEvent, DocumentStyle, DocumentView, EventTarget, HTMLDocument, Node

public class DDocument
extends DNode
implements Document, HTMLDocument, DocumentStyle, DocumentEvent, DocumentView

Implementation of DOM Level 2 Document. It can be used standalone (without HTML4 rendering engine).


Field Summary
protected  Names names
           
static boolean STRICT
           
 
Fields inherited from class ice.pilots.html4.DNode
doc, first, last, next, parent, prev
 
Fields inherited from class ice.storm.DynamicObject
NOT_FOUND, SETD_IGNORE, SETD_NOT_FOUND, SETD_OK
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
protected DDocument(DOMImplementation impl)
           
protected DDocument(ThePilot pilot, DOM implementation)
           
 
Method Summary
 void addStyleSheet(DStyleSheet s)
          Add a StyleSheet to this document
protected  DNode appendDChild(DNode node)
           
protected  void clear()
           
protected  void clearRootElement()
          clear root element
 void close()
          Closes a document stream opened by open() and forces rendering.
protected  DAttr createAttribute(int attrNameId)
           
 Attr createAttribute(String name)
          Creates an Attr of the given name.
 Attr createAttributeNS(String namespaceURI, String qualifiedName)
          Creates an attribute of the given qualified name and namespace URI.
 CDATASection createCDATASection(String data)
          not implemented
 Comment createComment(String data)
          not implemented
 DocumentFragment createDocumentFragment()
          Creates an empty DocumentFragment object.
 DOMEvent createDOMEvent(int id)
           
 DOMEvent createDOMEvent(int id, DNode target)
           
protected  DTextNode createDTextNode(char[] buf, int offset, int length, boolean isPre)
           
protected  DTextNode createDTextNode(String data)
           
protected  DTextNode createDTextNode(String data, boolean isPre)
           
protected  DElement createElement(int tagId)
           
 Element createElement(String tagName)
          Creates an element of the type specified.
 Element createElementNS(String namespaceURI, String qualifiedName)
          Creates an element of the given qualified name and namespace URI.
 Element createElementWithNameSpace(String localName, String namespace)
           
 EntityReference createEntityReference(String name)
          not implemented
 Event createEvent(String eventType)
           
 ProcessingInstruction createProcessingInstruction(String target, String data)
          not implemented
 Text createTextNode(String data)
          Creates a Text node given the specified string.
protected  void evalScriptHandlerListeners(DNode n, DOMEvent de, Object handler)
           
 Object execDynamicMethod(String name, Object[] args, DynEnv env)
          Perform function-like actions for `name' with the given args.
 String getAlinkColor()
           
 DAllList getAll()
           
 HTMLCollection getAnchors()
          A collection of all the anchor (A) elements in a document with a value for the name attribute.Note.
 HTMLCollection getApplets()
          A collection of all the OBJECT elements that include applets and APPLET (deprecated) elements in a document.
 boolean getAsync()
           
 String getBaseTarget()
           
 URL getBaseURL()
           
 String getBgColor()
           
 HTMLElement getBody()
          Returns BODY element or FRAMESET element
 String getCookie()
          The cookies associated with this document.
 DElement getDBody()
           
 String getDefaultCharset()
           
 AbstractView getDefaultView()
          The default AbstractView for this Document, or null if none available.
 DocumentType getDoctype()
          The Document Type Declaration (see DocumentType) associated with this document.
 DElement getDocumentDElement()
           
 Element getDocumentElement()
          This is a convenience attribute that allows direct access to the child node that is the root element of the document.
 Viewport getDocumentVieport()
          Deprecated. Please use getDocumentViewport.
 Viewport getDocumentViewport()
           
 DOM getDom()
           
 String getDomain()
          The domain name of the server that served the document, or null if the server cannot be identified by a domain name.
 TheView getDomView()
           
 Object getDynamicScopeParent()
          This is only relevant to support scope chain during event handler execution.
 Object getDynamicValue(String name, DynEnv env)
          Returns the `key' field or Defs.NOT_FOUND if `name' does not exist.
 Element getElementById(String elementId)
          Returns the Element whose ID is given by elementId.
 NodeList getElementsByName(String elementName)
          Returns the (possibly empty) collection of elements whose name value is given by elementName.
 NodeList 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.
 NodeList getElementsByTagNameNS(String namespaceURI, String localName)
          Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree.
 String getFgColor()
           
 HTMLCollection getForms()
          A collection of all the forms of a document.
 DElement getHead()
           
 int getHeight()
           
 HTMLCollection getImages()
          A collection of all the IMG elements in a document.
 DOMImplementation getImplementation()
          The DOMImplementation object that handles this document.
 String getLastModified()
           
 String getLinkColor()
           
 HTMLCollection getLinks()
          A collection of all AREA elements and anchor ( A) elements in a document with a value for the href attribute.
 HTMLCollection getMaps()
           
 int getMutation()
           
 String getNodeName()
          The name of this node, depending on its type; see the table above.
 short getNodeType()
          A code representing the type of the underlying object, as defined above.
 ThePilot getPilot()
           
 String getReferrer()
          Returns the URI of the page that linked to this page.
 DRange getSelection()
           
 Object getSlot(String name, DynEnv env)
           
 StyleSheetList getStyleSheets()
          A list containing all the style sheets explicitly linked into or embedded in a document.
 String getTitle()
          The title of a document as specified by the TITLE element in the head of the document.
 String getURL()
          The complete URI of the document.
 String getVlinkColor()
           
 int getWidth()
           
 Node importNode(Node importedNode, boolean deep)
          Imports a node from another document to this document.
 boolean isRTL()
           
 void mutate()
           
 void open()
          Note.
 void processEvent(int id, DNode target)
           
protected  DNode removeDChild(DNode node)
           
 void removeStyleSheet(DStyleSheet s)
          Remove a StyleSheet from this document
 String resolveUrl(String urlFragment)
          Resolve a relative url against this document's base url.
 URL resolveURL(String loc)
          Deprecated. Use resolveUrl(String).
protected  void script_load(DynEnv env, String urlFragment)
          This implements the load method of document, which can be executed from javascript.
protected  void script_loadXML(String xmltext)
          Replace the current document with the content of the xmltext argument.
 void setAlinkColor(String v)
           
 void setAsync(boolean asyncstat)
           
 void setBaseUrl(String url)
           
 void setBgColor(String v)
           
 void setBody(HTMLElement e)
           
 void setCookie(String text)
           
 int setDynamicValue(String name, Object value, DynEnv env)
          Set field `name' to `value'.
 void setFgColor(String v)
           
 void setHtmlMode(boolean flag)
           
 void setLinkColor(String v)
           
 void setTitle(String text)
           
 void setVlinkColor(String v)
           
protected  String transformNode(Document stylesheet)
          Transforms the current document into a new document, using the stylesheet document supplied as an argument.?The text of the transformed document is returned.
protected  void transformNodeToObject(Document stylesheet, Document result)
          Transforms the current document into a new document, using the stylesheet document supplied as an argument.?The transformed document is returned.
 void write(String str)
          Write a string of text to a document stream opened by open().
 void writeln(String str)
          Write a string of text followed by a newline character to a document stream opened by open().
 
Methods inherited from class ice.pilots.html4.DNode
addEventListener, afterClone, appendChild, attrNameToId, clone, clone, cloneNode, contains, deleteSlot, dispatchEvent, getAttributes, getChildNodes, getDAttr, getDAttrCount, getDAttrFromIndex, getDAttrListHead, getDAttrValueOrNull, getDParent, getFirstChild, getFirstDChild, getInnerText, getLastChild, getLastDChild, getLocalName, getNameId, getNamespaceURI, getNextDSibling, getNextSibling, getNodeValue, getOuterText, getOwnerDDocument, getOwnerDocument, getParentDNode, getParentNode, getPrefix, getPreviousDSibling, getPreviousSibling, getRootDNode, getRootNode, hasAttributes, hasChildNodes, hasSlot, insertBefore, insertDChildBefore, isSupported, normalize, onDAttrValueChange, removeAllDAttrs, removeChild, removeDAttr, removeDAttr, removeEventListener, replaceChild, replaceDChild, setDAttr, setDAttr, setInnerText, setNodeValue, setOuterText, setParent, setPrefix, setSlot, unlinkAllSlots
 
Methods inherited from class ice.storm.DynamicObject
deleteSlot, getEnumeratableIds, getMethodPropertySource, getScriptDataLock, getScriptWrapper, getSlot, hasSlot, javaReflectionTarget, readOnlySlots, script_toSource, script_toString, setScriptWrapperIfAbsent, setSlot
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

STRICT

public static boolean STRICT

names

protected Names names
Constructor Detail

DDocument

protected DDocument(DOMImplementation impl)

DDocument

protected DDocument(ThePilot pilot,
                    DOM implementation)
Method Detail

getMutation

public final int getMutation()

mutate

public final void mutate()

isRTL

public boolean isRTL()

setHtmlMode

public void setHtmlMode(boolean flag)

clear

protected void clear()

getPilot

public final ThePilot getPilot()
Overrides:
getPilot in class DNode

getDocumentVieport

public final Viewport getDocumentVieport()
Deprecated. Please use getDocumentViewport.


getDocumentViewport

public final Viewport getDocumentViewport()

createEvent

public Event createEvent(String eventType)
Specified by:
createEvent in interface DocumentEvent
Returns:
The newly created Event

createDOMEvent

public DOMEvent createDOMEvent(int id)

createDOMEvent

public final DOMEvent createDOMEvent(int id,
                                     DNode target)

processEvent

public void processEvent(int id,
                         DNode target)

evalScriptHandlerListeners

protected void evalScriptHandlerListeners(DNode n,
                                          DOMEvent de,
                                          Object handler)

createElement

protected DElement createElement(int tagId)

createDTextNode

protected DTextNode createDTextNode(char[] buf,
                                    int offset,
                                    int length,
                                    boolean isPre)

createDTextNode

protected DTextNode createDTextNode(String data,
                                    boolean isPre)

createDTextNode

protected final DTextNode createDTextNode(String data)

createAttribute

protected DAttr createAttribute(int attrNameId)

appendDChild

protected DNode appendDChild(DNode node)
Overrides:
appendDChild in class DNode

removeDChild

protected DNode removeDChild(DNode node)
Overrides:
removeDChild in class DNode

getNodeName

public String getNodeName()
Description copied from interface: Node
The name of this node, depending on its type; see the table above.

Specified by:
getNodeName in interface Node
Overrides:
getNodeName in class DNode

getNodeType

public short getNodeType()
Description copied from interface: Node
A code representing the type of the underlying object, as defined above.

Specified by:
getNodeType in interface Node
Overrides:
getNodeType in class DNode

getDoctype

public DocumentType getDoctype()
Description copied from interface: Document
The Document Type Declaration (see DocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returns null. The DOM Level 2 does not support editing the Document Type Declaration. docType cannot be altered in any way, including through the use of methods inherited from the Node interface, such as insertNode or removeNode.

Specified by:
getDoctype in interface Document

getImplementation

public final DOMImplementation getImplementation()
Description copied from interface: Document
The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.

Specified by:
getImplementation in interface Document

getDom

public DOM getDom()

getDocumentElement

public final Element getDocumentElement()
Description copied from interface: Document
This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".

Specified by:
getDocumentElement in interface Document

getDocumentDElement

public DElement getDocumentDElement()

createElement

public Element createElement(String tagName)
Description copied from interface: Document
Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
In addition, if there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element.
To create an element with a qualified name and namespace URI, use the createElementNS method.

Specified by:
createElement in interface Document
Returns:
A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.

createDocumentFragment

public DocumentFragment createDocumentFragment()
Description copied from interface: Document
Creates an empty DocumentFragment object.

Specified by:
createDocumentFragment in interface Document
Returns:
A new DocumentFragment.

createTextNode

public final Text createTextNode(String data)
Description copied from interface: Document
Creates a Text node given the specified string.

Specified by:
createTextNode in interface Document
Returns:
The new Text object.

createComment

public Comment createComment(String data)
not implemented

Specified by:
createComment in interface Document
Returns:
The new Comment object.

createCDATASection

public CDATASection createCDATASection(String data)
not implemented

Specified by:
createCDATASection in interface Document
Returns:
The new CDATASection object.

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(String target,
                                                         String data)
not implemented

Specified by:
createProcessingInstruction in interface Document
Returns:
The new ProcessingInstruction object.

createAttribute

public Attr createAttribute(String name)
Description copied from interface: Document
Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttributeNode method.
To create an attribute with a qualified name and namespace URI, use the createAttributeNS method.

Specified by:
createAttribute in interface Document
Returns:
A new Attr object with the nodeName attribute set to name, and localName, prefix, and namespaceURI set to null. The value of the attribute is the empty string.

createEntityReference

public EntityReference createEntityReference(String name)
not implemented

Specified by:
createEntityReference in interface Document
Returns:
The new EntityReference object.

getElementsByTagName

public NodeList getElementsByTagName(String tagName)
Description copied from interface: Document
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.

Specified by:
getElementsByTagName in interface Document
Returns:
A new NodeList object containing all the matched Elements.

getTitle

public String getTitle()
Description copied from interface: HTMLDocument
The title of a document as specified by the TITLE element in the head of the document.

Specified by:
getTitle in interface HTMLDocument

setTitle

public void setTitle(String text)
Specified by:
setTitle in interface HTMLDocument

getReferrer

public String getReferrer()
Description copied from interface: HTMLDocument
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).

Specified by:
getReferrer in interface HTMLDocument

getBaseURL

public URL getBaseURL()

getDomain

public String getDomain()
Description copied from interface: HTMLDocument
The domain name of the server that served the document, or null if the server cannot be identified by a domain name.

Specified by:
getDomain in interface HTMLDocument

getURL

public final String getURL()
Description copied from interface: HTMLDocument
The complete URI of the document.

Specified by:
getURL in interface HTMLDocument

getBody

public final HTMLElement getBody()
Returns BODY element or FRAMESET element

Specified by:
getBody in interface HTMLDocument

getDBody

public DElement getDBody()

setBody

public void setBody(HTMLElement e)
Specified by:
setBody in interface HTMLDocument

getImages

public HTMLCollection getImages()
Description copied from interface: HTMLDocument
A collection of all the IMG elements in a document. The behavior is limited to IMG elements for backwards compatibility.

Specified by:
getImages in interface HTMLDocument

getApplets

public HTMLCollection getApplets()
Description copied from interface: HTMLDocument
A collection of all the OBJECT elements that include applets and APPLET (deprecated) elements in a document.

Specified by:
getApplets in interface HTMLDocument

getLinks

public HTMLCollection getLinks()
Description copied from interface: HTMLDocument
A collection of all AREA elements and anchor ( A) elements in a document with a value for the href attribute.

Specified by:
getLinks in interface HTMLDocument

getForms

public HTMLCollection getForms()
Description copied from interface: HTMLDocument
A collection of all the forms of a document.

Specified by:
getForms in interface HTMLDocument

getAnchors

public HTMLCollection getAnchors()
Description copied from interface: HTMLDocument
A collection of all the anchor (A) elements in a document with a value for the name attribute.Note. For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute.

Specified by:
getAnchors in interface HTMLDocument

getMaps

public HTMLCollection getMaps()

getCookie

public String getCookie()
Description copied from interface: HTMLDocument
The cookies associated with this document. If there are none, the value is an empty string. Otherwise, the value is a string: a semicolon-delimited list of "name=value" pairs for all the cookies associated with the page. For example, name=value;expires=date.

Specified by:
getCookie in interface HTMLDocument

setCookie

public void setCookie(String text)
Specified by:
setCookie in interface HTMLDocument

getLastModified

public String getLastModified()

getDefaultCharset

public String getDefaultCharset()

open

public void open()
Description copied from interface: HTMLDocument
Note. This method and the ones following allow a user to add to or replace the structure model of a document using strings of unparsed HTML. At the time of writing alternate methods for providing similar functionality for both HTML and XML documents were being considered. The following methods may be deprecated at some point in the future in favor of a more general-purpose mechanism.
Open a document stream for writing. If a document exists in the target, this method clears it.

Specified by:
open in interface HTMLDocument

close

public void close()
Description copied from interface: HTMLDocument
Closes a document stream opened by open() and forces rendering.

Specified by:
close in interface HTMLDocument

write

public void write(String str)
Description copied from interface: HTMLDocument
Write a string of text to a document stream opened by open(). The text is parsed into the document's structure model.

Specified by:
write in interface HTMLDocument

writeln

public void writeln(String str)
Description copied from interface: HTMLDocument
Write a string of text followed by a newline character to a document stream opened by open(). The text is parsed into the document's structure model.

Specified by:
writeln in interface HTMLDocument

getElementById

public Element getElementById(String elementId)
Description copied from interface: Document
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. The DOM implementation must have information that says which attributes are of type ID. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return null.

Specified by:
getElementById in interface Document
Returns:
The matching element.

getElementsByName

public NodeList getElementsByName(String elementName)
Description copied from interface: HTMLDocument
Returns the (possibly empty) collection of elements whose name value is given by elementName.

Specified by:
getElementsByName in interface HTMLDocument
Returns:
The matching elements.

getStyleSheets

public StyleSheetList getStyleSheets()
Description copied from interface: DocumentStyle
A list containing all the style sheets explicitly linked into or embedded in a document. For HTML documents, this includes external style sheets, included via the HTML LINK element, and inline STYLE elements. In XML, this includes external style sheets, included via style sheet processing instructions (see ).

Specified by:
getStyleSheets in interface DocumentStyle

getDefaultView

public final AbstractView getDefaultView()
Description copied from interface: DocumentView
The default AbstractView for this Document, or null if none available.

Specified by:
getDefaultView in interface DocumentView

getDomView

public TheView getDomView()

createElementWithNameSpace

public Element createElementWithNameSpace(String localName,
                                          String namespace)

getWidth

public int getWidth()

getHeight

public int getHeight()

getAll

public DAllList getAll()
Overrides:
getAll in class DNode

getSelection

public DRange getSelection()

getAsync

public boolean getAsync()

setAsync

public void setAsync(boolean asyncstat)

script_load

protected void script_load(DynEnv env,
                           String urlFragment)
                    throws IOException
This implements the load method of document, which can be executed from javascript. The content in the browser window is replaced by the content of the URL supplied by the URLString. MSIE extension.

Throws:
IOException

script_loadXML

protected void script_loadXML(String xmltext)
                       throws IOException
Replace the current document with the content of the xmltext argument. Binds to the script function loadXML. MSIE extension.

Throws:
IOException

transformNode

protected String transformNode(Document stylesheet)
                        throws IOException
Transforms the current document into a new document, using the stylesheet document supplied as an argument.?The text of the transformed document is returned.

Throws:
IOException

transformNodeToObject

protected void transformNodeToObject(Document stylesheet,
                                     Document result)
                              throws IOException
Transforms the current document into a new document, using the stylesheet document supplied as an argument.?The transformed document is returned.

Throws:
IOException

getSlot

public Object getSlot(String name,
                      DynEnv env)
Overrides:
getSlot in class DNode

addStyleSheet

public void addStyleSheet(DStyleSheet s)
Add a StyleSheet to this document


removeStyleSheet

public void removeStyleSheet(DStyleSheet s)
Remove a StyleSheet from this document


resolveURL

public URL resolveURL(String loc)
Deprecated. Use resolveUrl(String).


resolveUrl

public String resolveUrl(String urlFragment)
Resolve a relative url against this document's base url. Useful for resolving, for example, anchor.href into a full url.


setBaseUrl

public void setBaseUrl(String url)

getBaseTarget