FileDocCategorySizeDatePackage
SmilDocumentImpl.javaAPI DocAndroid 1.5 API9101Wed May 06 22:42:46 BST 2009com.android.mms.dom.smil

SmilDocumentImpl

public class SmilDocumentImpl extends com.android.mms.dom.DocumentImpl implements org.w3c.dom.smil.SMILDocument, DocumentEvent

Fields Summary
org.w3c.dom.smil.ElementSequentialTimeContainer
mSeqTimeContainer
public static final String
SMIL_DOCUMENT_START_EVENT
public static final String
SMIL_DOCUMENT_END_EVENT
Constructors Summary
public SmilDocumentImpl()


    /*
     * Internal methods
     */
      
        super();
    
Methods Summary
public booleanbeginElement()

        return mSeqTimeContainer.beginElement();
    
public org.w3c.dom.ElementcreateElement(java.lang.String tagName)

        // Find the appropriate class for this element
        tagName = tagName.toLowerCase();
        if (tagName.equals("text") ||
                tagName.equals("img") ||
                tagName.equals("video")) {
            return new SmilRegionMediaElementImpl(this, tagName);
        } else if (tagName.equals("audio")) {
            return new SmilMediaElementImpl(this, tagName);
        } else if (tagName.equals("layout")) {
            return new SmilLayoutElementImpl(this, tagName);
        } else if (tagName.equals("root-layout")) {
            return new SmilRootLayoutElementImpl(this, tagName);
        } else if (tagName.equals("region")) {
            return new SmilRegionElementImpl(this, tagName);
        } else if (tagName.equals("ref")) {
            return new SmilRefElementImpl(this, tagName);
        } else if (tagName.equals("par")) {
            return new SmilParElementImpl(this, tagName);
        } else {
            // This includes also the structural nodes SMIL,
            // HEAD, BODY, for which no specific types are defined.
            return new SmilElementImpl(this, tagName);
        }
    
public org.w3c.dom.events.EventcreateEvent(java.lang.String eventType)

        if ("Event".equals(eventType)) {
            return new EventImpl();
        } else {
            throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
                       "Not supported interface");
        }
    
public booleanendElement()

        return mSeqTimeContainer.endElement();
    
public org.w3c.dom.NodeListgetActiveChildrenAt(float instant)

        return mSeqTimeContainer.getActiveChildrenAt(instant);
    
public org.w3c.dom.smil.TimeListgetBegin()

        return mSeqTimeContainer.getBegin();
    
public org.w3c.dom.smil.SMILElementgetBody()

        Node rootElement = getDocumentElement();
        Node headElement = getHead();
        Node bodyElement = headElement.getNextSibling();
        if (bodyElement == null || !(bodyElement instanceof SMILElement)) {
            // The body doesn't exist. Create a new one.
            bodyElement = createElement("body");
            rootElement.appendChild(bodyElement);
        }

        // Initialize the real sequential time container, which is body.
        mSeqTimeContainer = new ElementSequentialTimeContainerImpl((SMILElement) bodyElement) {
            public NodeList getTimeChildren() {
                return getBody().getElementsByTagName("par");
            }

            public boolean beginElement() {
                Event startEvent = createEvent("Event");
                startEvent.initEvent(SMIL_DOCUMENT_START_EVENT, false, false);
                dispatchEvent(startEvent);
                return true;
            }

            public boolean endElement() {
                Event endEvent = createEvent("Event");
                endEvent.initEvent(SMIL_DOCUMENT_END_EVENT, false, false);
                dispatchEvent(endEvent);
                return true;
            }

            public void pauseElement() {
                // TODO Auto-generated method stub

            }

            public void resumeElement() {
                // TODO Auto-generated method stub

            }

            public void seekElement(float seekTo) {
                // TODO Auto-generated method stub

            }

            ElementTime getParentElementTime() {
                return null;
            }
        };

        return (SMILElement) bodyElement;
    
public org.w3c.dom.smil.SMILElementgetDocumentElement()

        Node rootElement = getFirstChild();
        if (rootElement == null || !(rootElement instanceof SMILElement)) {
            // The root doesn't exist. Create a new one.
            rootElement = createElement("smil");
            appendChild(rootElement);
        }

        return (SMILElement) rootElement;
    
public floatgetDur()

        return mSeqTimeContainer.getDur();
    
public org.w3c.dom.smil.TimeListgetEnd()

        return mSeqTimeContainer.getEnd();
    
public shortgetFill()

        return mSeqTimeContainer.getFill();
    
public shortgetFillDefault()

        return mSeqTimeContainer.getFillDefault();
    
public org.w3c.dom.smil.SMILElementgetHead()

        Node rootElement = getDocumentElement();
        Node headElement = rootElement.getFirstChild();
        if (headElement == null || !(headElement instanceof SMILElement)) {
            // The head doesn't exist. Create a new one.
            headElement = createElement("head");
            rootElement.appendChild(headElement);
        }

        return (SMILElement) headElement;
    
public org.w3c.dom.smil.SMILLayoutElementgetLayout()

        Node headElement = getHead();
        Node layoutElement = null;

        // Find the layout element under <code>HEAD</code>
        layoutElement = headElement.getFirstChild();
        while ((layoutElement != null) && !(layoutElement instanceof SMILLayoutElement)) {
            layoutElement = layoutElement.getNextSibling();
        }

        if (layoutElement == null) {
            // The layout doesn't exist. Create a default one.
            layoutElement = new SmilLayoutElementImpl(this, "layout");
            headElement.appendChild(layoutElement);
        }
        return (SMILLayoutElement) layoutElement;
    
public floatgetRepeatCount()

        return mSeqTimeContainer.getRepeatCount();
    
public floatgetRepeatDur()

        return mSeqTimeContainer.getRepeatDur();
    
public shortgetRestart()

        return mSeqTimeContainer.getRestart();
    
public org.w3c.dom.NodeListgetTimeChildren()

        return mSeqTimeContainer.getTimeChildren();
    
public voidpauseElement()

        mSeqTimeContainer.pauseElement();
    
public voidresumeElement()

        mSeqTimeContainer.resumeElement();
    
public voidseekElement(float seekTo)

        mSeqTimeContainer.seekElement(seekTo);
    
public voidsetBegin(org.w3c.dom.smil.TimeList begin)

        mSeqTimeContainer.setBegin(begin);
    
public voidsetDur(float dur)

        mSeqTimeContainer.setDur(dur);
    
public voidsetEnd(org.w3c.dom.smil.TimeList end)

        mSeqTimeContainer.setEnd(end);
    
public voidsetFill(short fill)

        mSeqTimeContainer.setFill(fill);
    
public voidsetFillDefault(short fillDefault)

        mSeqTimeContainer.setFillDefault(fillDefault);
    
public voidsetRepeatCount(float repeatCount)

        mSeqTimeContainer.setRepeatCount(repeatCount);
    
public voidsetRepeatDur(float repeatDur)

        mSeqTimeContainer.setRepeatDur(repeatDur);
    
public voidsetRestart(short restart)

        mSeqTimeContainer.setRestart(restart);