fi.hut.tml.xsmiles.mlfc.smil.basic
Class SMILDocumentImpl

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.mlfc.smil.basic.SMILDocumentImpl
All Implemented Interfaces:
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, org.w3c.dom.Node, org.w3c.dom.NodeList, java.io.Serializable, SMILDocument

public class SMILDocumentImpl
extends org.apache.xerces.dom.DocumentImpl
implements SMILDocument

A SMIL document is the root of the SMIL Hierarchy and holds the entire content. Beside providing access to the hierarchy, it also provides some convenience methods for accessing certain sets of information from the document. Cover document timing, document locking?, linking modality and any other document level issues. Are there issues with nested SMIL files? Is it worth talking about different document scenarios, corresponding to differing profiles? E.g. Standalone SMIL, HTML integration, etc.

See Also:
Serialized Form

Field Summary
static int ABORTED
           
static java.net.URL defaultSMILCSSDocument
           
static int DESTROYED
           
protected static boolean noParamElement
           
protected static java.lang.reflect.Constructor paramElementConst
           
static int PAUSED
           
static int PREFETCHED
           
static int STARTED
           
static int STOPPED
           
 
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
SMILDocumentImpl()
          Create a SMIL Document.
 
Method Summary
static XSmilesStyleSheet createDefaultStyleSheet()
          Creates default stylesheet defined in ../xsmiles/bin/cfg/smil.css
 org.w3c.dom.Element createElement(java.lang.String tag)
           
 org.w3c.dom.Element createElementNS(org.apache.xerces.dom.DocumentImpl XSmilesDoc, java.lang.String ns, java.lang.String tagi)
          Create a new element - this method should be the only way to create new elements.
 org.w3c.dom.Element createElementNS(java.lang.String ns, java.lang.String tag)
          Create a new element - this method should be the only way to create new elements.
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String localpart)
          NON-DOM: Xerces-specific constructor.
 void freeResources(boolean browser)
          Uninitializes all elements in this document, freeing all memory.
 AnimationScheduler getAnimationScheduler()
          Get AnimationScheduler.
 XSMILBodyElement getBodyElement()
          Get the body element.
 boolean getCSSLayoutModel()
          Get the CSS Layout Model on/off.
 SMILLayoutElement getDocLayout()
           
 int getDocumentState()
          Get this SMIL document state.
 java.lang.String getDomain()
           
protected  java.lang.String getLocalname(java.lang.String tagname)
           
 java.lang.String getReferrer()
           
 SMILElement getRootElement()
           
 Scheduler getScheduler()
          Get Scheduler.
 XSmilesStyleSheet getStyleSheet()
          Returns a stylesheet instance created from default and associated stylesheet file.
 java.lang.String getTitle()
           
 java.lang.String getURL()
           
 Viewer getViewer()
           
 boolean gotoInternalLink(java.lang.String url)
          Seeks the SMIL presentation to the correct time - to activate internal doc link.
 void initialize(boolean browser)
          Initialize this smil document / presentation.
 void parasiteStop()
          Stops parasite smil document.
 void pause()
          Pauses the whole presentation immediately.
 void prefetch()
          Prefetch media (not non-playable media, under switch elements); This prefetch goes the same route through elements as start().
 org.w3c.dom.Element searchElementWithId(org.w3c.dom.Element e, java.lang.String id)
          Searches for element with id from the tree under element e.
 org.w3c.dom.Element searchElementWithId(java.lang.String id)
          Searches for element with id.
 SMILElement searchElementWithIdInBody(java.lang.String id)
          Searches for element with id under body.
 SMILCustomAttributesElementImpl searchFirstCustomAttributesElement()
          Searches through the document head to find the first customAttributes element that is active.
 void setCSSLayoutModel(boolean flag)
          Set the CSS Layout Model on/off.
 void setDocumentState(int state)
          Set this SMIL document state.
 void setViewer(Viewer v)
          Set the viewer, which has MediaHandlers and TimerHandlers.
 void showLinkPopup(java.lang.String url, java.awt.event.MouseEvent e)
          open a link popup
 void start()
          Starts the whole presentation from the start time = 0.
 boolean startFromElementName(java.lang.String s)
          Starts the presentation from the element id = s.
 void stop()
          Stops the whole presentation immediately.
 void traverseLink(java.lang.String url, int show, java.lang.String target, java.awt.event.MouseEvent e)
          Move to destination node or document.
 
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, createAttributeNS, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElementDefinition, createEntity, createEntityReference, createNotation, createProcessingInstruction, createTextNode, getActualEncoding, getAsync, getBaseURI, getConfig, getDoctype, getDocumentElement, getDocumentURI, getElementById, 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 org.w3c.dom.Document
createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getElementById, 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
 
Methods inherited from interface org.w3c.dom.events.DocumentEvent
createEvent
 

Field Detail

defaultSMILCSSDocument

public static java.net.URL defaultSMILCSSDocument

STOPPED

public static final int STOPPED
See Also:
Constant Field Values

PREFETCHED

public static final int PREFETCHED
See Also:
Constant Field Values

STARTED

public static final int STARTED
See Also:
Constant Field Values

PAUSED

public static final int PAUSED
See Also:
Constant Field Values

ABORTED

public static final int ABORTED
See Also:
Constant Field Values

DESTROYED

public static final int DESTROYED
See Also:
Constant Field Values

paramElementConst

protected static java.lang.reflect.Constructor paramElementConst

noParamElement

protected static boolean noParamElement
Constructor Detail

SMILDocumentImpl

public SMILDocumentImpl()
Create a SMIL Document.

Method Detail

getAnimationScheduler

public AnimationScheduler getAnimationScheduler()
Get AnimationScheduler.


getScheduler

public Scheduler getScheduler()
Get Scheduler.


setViewer

public void setViewer(Viewer v)
Set the viewer, which has MediaHandlers and TimerHandlers.


getViewer

public Viewer getViewer()

createElement

public org.w3c.dom.Element createElement(java.lang.String tag)
                                  throws org.w3c.dom.DOMException
Specified by:
createElement 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.

Throws:
org.w3c.dom.DOMException

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String ns,
                                           java.lang.String tag)
                                    throws org.w3c.dom.DOMException
Create a new element - this method should be the only way to create new elements. To copy an element, call this and then copy the attributes. This method is for standalone players.

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

getLocalname

protected java.lang.String getLocalname(java.lang.String tagname)

createElementNS

public org.w3c.dom.Element createElementNS(org.apache.xerces.dom.DocumentImpl XSmilesDoc,
                                           java.lang.String ns,
                                           java.lang.String tagi)
                                    throws org.w3c.dom.DOMException
Create a new element - this method should be the only way to create new elements. To copy an element, call this and then copy the attributes.

Throws:
org.w3c.dom.DOMException

getDocLayout

public SMILLayoutElement getDocLayout()
Specified by:
getDocLayout in interface SMILDocument

searchFirstCustomAttributesElement

public SMILCustomAttributesElementImpl searchFirstCustomAttributesElement()
Searches through the document head to find the first customAttributes element that is active. Returns the element.


getDocumentState

public int getDocumentState()
Get this SMIL document state. Used in prefetch() to ABORT the prefetching.


setDocumentState

public void setDocumentState(int state)
Set this SMIL document state. Used in SMILMLFC to ABORT the prefetch.


initialize

public void initialize(boolean browser)
Initialize this smil document / presentation.

Parameters:
browser - Set to true, if run in X-Smiles

prefetch

public void prefetch()
Prefetch media (not non-playable media, under switch elements); This prefetch goes the same route through elements as start().


start

public void start()
Starts the whole presentation from the start time = 0. Cannot currently restart a paused presentation.


searchElementWithId

public org.w3c.dom.Element searchElementWithId(org.w3c.dom.Element e,
                                               java.lang.String id)
Searches for element with id from the tree under element e.

Parameters:
e - start element
id - id to search for
Returns:
the element with id, or null if not found.

searchElementWithId

public org.w3c.dom.Element searchElementWithId(java.lang.String id)
Searches for element with id.

Parameters:
id - id to search for
Returns:
the element with id, or null if not found.

searchElementWithIdInBody

public SMILElement searchElementWithIdInBody(java.lang.String id)
Searches for element with id under body.

Parameters:
id - id to search for
Returns:
the element with id, or null if not found.

startFromElementName

public boolean startFromElementName(java.lang.String s)
Starts the presentation from the element id = s.

Returns:
true if presentation playing after this method (was playing or was started) false if psesentation wasn't playing and the element wasn't found.

pause

public void pause()
Pauses the whole presentation immediately.


parasiteStop

public void parasiteStop()
Stops parasite smil document.


stop

public void stop()
Stops the whole presentation immediately.


freeResources

public void freeResources(boolean browser)
Uninitializes all elements in this document, freeing all memory. Also, stops all timers and so on.

Parameters:
browser - true, if called from X-Smiles browser

showLinkPopup

public void showLinkPopup(java.lang.String url,
                          java.awt.event.MouseEvent e)
open a link popup


traverseLink

public void traverseLink(java.lang.String url,
                         int show,
                         java.lang.String target,
                         java.awt.event.MouseEvent e)
Move to destination node or document.

Parameters:
url - URL, can be internal "#node" or external "http://..."
show - show attribute in area and a elements
target - target attribute in area and a elements

gotoInternalLink

public boolean gotoInternalLink(java.lang.String url)
Seeks the SMIL presentation to the correct time - to activate internal doc link.

Parameters:
url - Internal url, '#node'
Returns:
true if successfully started.

getTitle

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

getReferrer

public java.lang.String getReferrer()
Specified by:
getReferrer in interface SMILDocument

getDomain

public java.lang.String getDomain()
Specified by:
getDomain in interface SMILDocument

getURL

public java.lang.String getURL()
Specified by:
getURL in interface SMILDocument

getRootElement

public SMILElement getRootElement()
Specified by:
getRootElement in interface SMILDocument

getBodyElement

public XSMILBodyElement getBodyElement()
Get the body element.


getStyleSheet

public XSmilesStyleSheet getStyleSheet()
Returns a stylesheet instance created from default and associated stylesheet file.

Returns:
instance of XMLStyleSheet2

createDefaultStyleSheet

public static XSmilesStyleSheet createDefaultStyleSheet()
Creates default stylesheet defined in ../xsmiles/bin/cfg/smil.css

Returns:
instance of XMLStyleSheet2

setCSSLayoutModel

public void setCSSLayoutModel(boolean flag)
Set the CSS Layout Model on/off.


getCSSLayoutModel

public boolean getCSSLayoutModel()
Get the CSS Layout Model on/off.

Returns:
true=CSS Layout Model, false=SMIL Basic Layout


X-Smiles 1.2