fi.hut.tml.xsmiles.dom
Class XSmilesDocumentImpl

java.lang.Object
  extended byorg.apache.xerces.dom.NodeImpl
      extended byorg.apache.xerces.dom.ChildNode
          extended byorg.apache.xerces.dom.ParentNode
              extended byorg.apache.xerces.dom.CoreDocumentImpl
                  extended byorg.apache.xerces.dom.DocumentImpl
                      extended byfi.hut.tml.xsmiles.dom.XSmilesDocumentImpl
All Implemented Interfaces:
AsyncChangeHandler, java.lang.Cloneable, org.w3c.dom.Document, org.w3c.dom.events.DocumentEvent, org.w3c.dom.ls.DocumentLS, org.w3c.dom.ranges.DocumentRange, org.w3c.dom.traversal.DocumentTraversal, org.w3c.dom.events.EventTarget, ExtendedDocument, org.w3c.dom.Node, org.w3c.dom.NodeList, ScriptRunner, java.io.Serializable, StylesheetService

public class XSmilesDocumentImpl
extends org.apache.xerces.dom.DocumentImpl
implements ExtendedDocument, StylesheetService, AsyncChangeHandler

The factory for creating DOM event instances

See Also:
Serialized Form

Field Summary
protected  java.util.Vector bindingURLs
           
protected  XMLBroker broker
           
 boolean inited
           
static double lastDurC
           
static double lastDurD
          the duration for CSS engine
protected  MLFC sourceMLFC
           
protected  XSmilesStyleSheet styleSheet
           
protected  boolean wasHTMLDocument
           
 
Fields inherited from class org.apache.xerces.dom.DocumentImpl
eventListeners, iterators, mutationEvents, ranges
 
Fields inherited from class org.apache.xerces.dom.CoreDocumentImpl
actualEncoding, allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, fDocumentURI, identifiers, standalone, userData, version
 
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, UNNORMALIZED
 
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
XSmilesDocumentImpl()
           
 
Method Summary
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Create a DOM attribute.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String localName)
          Xerces-specific constructor.
 org.w3c.dom.Element createElement(java.lang.String tagname)
          Create a DOM element
 org.w3c.dom.Element createElementNS(java.lang.String URI, java.lang.String tagname)
           
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String localpart)
          NON-DOM: Xerces-specific constructor.
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
           
 org.w3c.dom.Text createTextNode(java.lang.String data)
          Creates a Text node given the specified string.
 void deleteExposedObject(java.lang.String name, java.lang.Object theObject)
          Remove a previously exposed object
 void destroy()
           
 void eval(java.lang.String scriptText)
           
 void exposeToScriptEngine(java.lang.String name, java.lang.Object theObject)
          Expose a java object to javascript as javascript object
 org.w3c.dom.Element getAnonymousElementByAttribute(org.w3c.dom.Element root, java.lang.String attrname, java.lang.String value)
           
 BindingHandler getBindingHandler()
          Returns the document's BindingHandler that handles the logic of XML Binding Language 2.0 elements.
 AsyncChangeHandler getChangeHandler()
          this is for executing layout or DOM changing code from an external thread
 ECMAScripter getECMAScripter()
           
 org.w3c.dom.Element getElementById(java.lang.String id)
          this is a crude hack for scripts, because XSmilesDocuments do not implement real id's
 MLFC getHostMLFC()
          Accessor function to the browser object.
 java.util.Hashtable getParasiteMLFCs()
           
 XSmilesStyleSheet getStyleSheet()
          get the stylesheet object
 java.util.Vector getStylesheetReferences(java.lang.String reqtype)
          Return an Vector of StylesheetReference objects containing all stylesheet references of a certain type created by - processing instruction, in the beginning of the doc.
 java.lang.String getTitle()
           
 XMLDocument getXMLDocument()
           
 void init()
           
 void invokeLater(java.lang.Runnable doRun)
          Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread.
 boolean isDispatchThread()
           
 boolean isHTMLDocument()
          this method returns true, if the original was HTML and then it was converted to XHTML.
 boolean isInited()
           
 org.w3c.dom.Document loadBindingDocument(java.lang.String documentURI)
           
 java.net.URL resolveURI(java.lang.String src)
          Resolve an uri to an absolute uri using the base-uri of the current element.
 void setBindingHandler(BindingHandler bh)
           
 void setHostMLFC(MLFC source)
          this is mainly for source MLFC
 void setHTMLDocument(boolean isHTMLDoc)
          was this originally HTML document -> XHTML
 void setPIStylesheets()
           
 void setPIXBLDocs()
           
 void setStyleSheet(XSmilesStyleSheet sheet)
           
 
Methods inherited from class org.apache.xerces.dom.DocumentImpl
addEventListener, cloneNode, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, getEventListeners, getImplementation, removeEventListener, saveEnclosingAttr, setEventListeners
 
Methods inherited from class org.apache.xerces.dom.CoreDocumentImpl
abort, adoptNode, changed, changes, checkDOMNSErr, checkNamespaceWF, checkQName, clearIdentifiers, clone, cloneNode, createAttribute, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElementDefinition, createEntity, createEntityReference, createNotation, getActualEncoding, getAsync, getBaseURI, getConfig, getDoctype, getDocumentElement, getDocumentURI, getElementsByTagName, getElementsByTagNameNS, getEncoding, getErrorChecking, getIdentifier, getIdentifiers, getNodeName, getNodeNumber, getNodeNumber, getNodeType, getOwnerDocument, getStandalone, getStrictErrorChecking, getTextContent, getUserData, getUserData, getVersion, importNode, insertBefore, isKidOK, isXMLName, load, loadXML, normalizeDocument, putIdentifier, removeChild, removeIdentifier, renameNode, replaceChild, saveXML, setActualEncoding, setAsync, setDocumentURI, setEncoding, setErrorChecking, setStandalone, setStrictErrorChecking, setTextContent, setUserData, setUserData, setVersion
 
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setReadOnly, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getContainer, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, synchronizeData, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fi.hut.tml.xsmiles.dom.ExtendedDocument
getBaseURI
 
Methods inherited from interface org.w3c.dom.Document
createAttribute, createCDATASection, createComment, createDocumentFragment, createEntityReference, getDoctype, getDocumentElement, getElementsByTagName, getElementsByTagNameNS, getImplementation, importNode
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

broker

protected XMLBroker broker

sourceMLFC

protected MLFC sourceMLFC

styleSheet

protected XSmilesStyleSheet styleSheet

lastDurD

public static double lastDurD
the duration for CSS engine


lastDurC

public static double lastDurC

inited

public boolean inited

bindingURLs

protected java.util.Vector bindingURLs

wasHTMLDocument

protected boolean wasHTMLDocument
Constructor Detail

XSmilesDocumentImpl

public XSmilesDocumentImpl()
Method Detail

getBindingHandler

public BindingHandler getBindingHandler()
Returns the document's BindingHandler that handles the logic of XML Binding Language 2.0 elements. With the BindingHandler one can e.g. add bindings dynamically to the document's elements.

Returns:
Returns the bindinghandler responsible of handling the bindings in this document.

setBindingHandler

public void setBindingHandler(BindingHandler bh)

getHostMLFC

public MLFC getHostMLFC()
Description copied from interface: ExtendedDocument
Accessor function to the browser object.

Specified by:
getHostMLFC in interface ExtendedDocument

setHostMLFC

public void setHostMLFC(MLFC source)
Description copied from interface: ExtendedDocument
this is mainly for source MLFC

Specified by:
setHostMLFC in interface ExtendedDocument

getParasiteMLFCs

public java.util.Hashtable getParasiteMLFCs()
Specified by:
getParasiteMLFCs in interface ExtendedDocument

getStyleSheet

public XSmilesStyleSheet getStyleSheet()
Description copied from interface: StylesheetService
get the stylesheet object

Specified by:
getStyleSheet in interface ExtendedDocument

setStyleSheet

public void setStyleSheet(XSmilesStyleSheet sheet)

createElement

public org.w3c.dom.Element createElement(java.lang.String tagname)
                                  throws org.w3c.dom.DOMException
Create a DOM element

Specified by:
createElement in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
Specified by:
createProcessingInstruction in interface org.w3c.dom.Document

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String URI,
                                           java.lang.String tagname)
                                    throws org.w3c.dom.DOMException
Specified by:
createElementNS in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName,
                                           java.lang.String localpart)
                                    throws org.w3c.dom.DOMException
NON-DOM: Xerces-specific constructor. "localName" is passed in, so we don't need to create a new String for it.

Parameters:
namespaceURI - The namespace URI of the element to create.
qualifiedName - The qualified name of the element type to instantiate.
Returns:
Element A new Element object with the following attributes:
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName,
                                          java.lang.String localName)
                                   throws org.w3c.dom.DOMException
Xerces-specific constructor. "localName" is passed in, so we don't need to create a new String for it.

Parameters:
namespaceURI - The namespace URI of the attribute to create. When it is null or an empty string, this method behaves like createAttribute.
qualifiedName - The qualified name of the attribute to instantiate.
localName - The local name of the attribute to instantiate.
Returns:
Attr A new Attr object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Creates a Text node given the specified string.

Specified by:
createTextNode in interface org.w3c.dom.Document

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.DOMException
Create a DOM attribute.

Specified by:
createAttributeNS in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

destroy

public void destroy()
Specified by:
destroy in interface ExtendedDocument

init

public void init()
Specified by:
init in interface ExtendedDocument

getElementById

public org.w3c.dom.Element getElementById(java.lang.String id)
this is a crude hack for scripts, because XSmilesDocuments do not implement real id's

Specified by:
getElementById in interface org.w3c.dom.Document

getStylesheetReferences

public java.util.Vector getStylesheetReferences(java.lang.String reqtype)
Return an Vector of StylesheetReference objects containing all stylesheet references of a certain type created by - processing instruction, in the beginning of the doc.


setPIStylesheets

public void setPIStylesheets()

setPIXBLDocs

public void setPIXBLDocs()

loadBindingDocument

public org.w3c.dom.Document loadBindingDocument(java.lang.String documentURI)

getXMLDocument

public XMLDocument getXMLDocument()

isHTMLDocument

public boolean isHTMLDocument()
this method returns true, if the original was HTML and then it was converted to XHTML. This is useful for those features that need HTML case independency

Specified by:
isHTMLDocument in interface ExtendedDocument

setHTMLDocument

public void setHTMLDocument(boolean isHTMLDoc)
was this originally HTML document -> XHTML

Specified by:
setHTMLDocument in interface ExtendedDocument

isInited

public boolean isInited()
Specified by:
isInited in interface ExtendedDocument

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface ExtendedDocument
Returns:

getChangeHandler

public AsyncChangeHandler getChangeHandler()
Description copied from interface: ExtendedDocument
this is for executing layout or DOM changing code from an external thread

Specified by:
getChangeHandler in interface ExtendedDocument

invokeLater

public void invokeLater(java.lang.Runnable doRun)
Description copied from interface: AsyncChangeHandler
Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread. This will happen after all pending AWT events have been processed. This method should be used when an application thread needs to update the GUI. In the following example the invokeLater call queues the Runnable object doHelloWorld on the event dispatching thread and then prints a message.
 Runnable doHelloWorld = new Runnable() {
     public void run() {
         System.out.println("Hello World on " + Thread.currentThread());
     }
 };

 SwingUtilities.invokeLater(doHelloWorld);
 System.out.println("This might well be displayed before the other message.");
 
If invokeLater is called from the event dispatching thread -- for example, from a JButton's ActionListener -- the doRun.run() will still be deferred until all pending events have been processed. Note that if the doRun.run() throws an uncaught exception the event dispatching thread will unwind (not the current thread).

Additional documentation and examples for this method can be found in How to Use Threads, in The Java Tutorial.

As of 1.3 this method is just a cover for java.awt.EventQueue.invokeLater().

Specified by:
invokeLater in interface AsyncChangeHandler
See Also:
#invokeAndWait

isDispatchThread

public boolean isDispatchThread()
Specified by:
isDispatchThread in interface AsyncChangeHandler

getAnonymousElementByAttribute

public org.w3c.dom.Element getAnonymousElementByAttribute(org.w3c.dom.Element root,
                                                          java.lang.String attrname,
                                                          java.lang.String value)
Specified by:
getAnonymousElementByAttribute in interface ExtendedDocument

eval

public void eval(java.lang.String scriptText)
Specified by:
eval in interface ScriptRunner

exposeToScriptEngine

public void exposeToScriptEngine(java.lang.String name,
                                 java.lang.Object theObject)
Description copied from interface: ScriptRunner
Expose a java object to javascript as javascript object

Specified by:
exposeToScriptEngine in interface ScriptRunner

deleteExposedObject

public void deleteExposedObject(java.lang.String name,
                                java.lang.Object theObject)
Description copied from interface: ScriptRunner
Remove a previously exposed object

Specified by:
deleteExposedObject in interface ScriptRunner

getECMAScripter

public ECMAScripter getECMAScripter()

resolveURI

public java.net.URL resolveURI(java.lang.String src)
                        throws java.net.MalformedURLException
Resolve an uri to an absolute uri using the base-uri of the current element.

Parameters:
src - the uri to resolve
Throws:
java.net.MalformedURLException - if the resulting URL has an unsupported scheme or a parse error occured


X-Smiles 1.2