FileDocCategorySizeDatePackage
NodeImpl.javaAPI DocAndroid 1.5 API6396Wed May 06 22:42:46 BST 2009com.android.mms.dom

NodeImpl

public abstract class NodeImpl extends Object implements Node, EventTarget

Fields Summary
private Node
mParentNode
private final Vector
mChildNodes
DocumentImpl
mOwnerDocument
private final EventTarget
mEventTarget
Constructors Summary
protected NodeImpl(DocumentImpl owner)


    /*
     * Internal methods
     */

       
        mOwnerDocument = owner;
    
Methods Summary
public voidaddEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)

        mEventTarget.addEventListener(type, listener, useCapture);
    
public org.w3c.dom.NodeappendChild(org.w3c.dom.Node newChild)

        ((NodeImpl)newChild).setParentNode(this);
        mChildNodes.remove(newChild);
        mChildNodes.add(newChild);
        return newChild;
    
public org.w3c.dom.NodecloneNode(boolean deep)

        // TODO Auto-generated method stub
        return null;
    
public booleandispatchEvent(org.w3c.dom.events.Event evt)

        return mEventTarget.dispatchEvent(evt);
    
public org.w3c.dom.NamedNodeMapgetAttributes()

        // Default. Override in Element.
        return null;
    
public org.w3c.dom.NodeListgetChildNodes()

        return new NodeListImpl(this, null, false);
    
public org.w3c.dom.NodegetFirstChild()

        Node firstChild = null;
        try {
            firstChild = mChildNodes.firstElement();
        }
        catch (NoSuchElementException e) {
            // Ignore and return null
        }
        return firstChild;
    
public org.w3c.dom.NodegetLastChild()

        Node lastChild = null;
        try {
            lastChild = mChildNodes.lastElement();
        }
        catch (NoSuchElementException e) {
            // Ignore and return null
        }
        return lastChild;
    
public java.lang.StringgetLocalName()

        // TODO Auto-generated method stub
        return null;
    
public java.lang.StringgetNamespaceURI()

        // TODO Auto-generated method stub
        return null;
    
public org.w3c.dom.NodegetNextSibling()

        if ((mParentNode != null) && (this != mParentNode.getLastChild())) {
            Vector<Node> siblings = ((NodeImpl)mParentNode).mChildNodes;
            int indexOfThis = siblings.indexOf(this);
            return siblings.elementAt(indexOfThis + 1);
        }
        return null;
    
public abstract java.lang.StringgetNodeName()

public abstract shortgetNodeType()

public java.lang.StringgetNodeValue()

        // Default behaviour. Override if required.
        return null;
    
public org.w3c.dom.DocumentgetOwnerDocument()

        return mOwnerDocument;
    
public org.w3c.dom.NodegetParentNode()

        return mParentNode;
    
public java.lang.StringgetPrefix()

        // TODO Auto-generated method stub
        return null;
    
public org.w3c.dom.NodegetPreviousSibling()

        if ((mParentNode != null) && (this != mParentNode.getFirstChild())) {
            Vector<Node> siblings = ((NodeImpl)mParentNode).mChildNodes;
            int indexOfThis = siblings.indexOf(this);
            return siblings.elementAt(indexOfThis - 1);
        }
        return null;
    
public booleanhasAttributes()

        // Default. Override in Element.
        return false;
    
public booleanhasChildNodes()

        return !(mChildNodes.isEmpty());
    
public org.w3c.dom.NodeinsertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)

        // TODO Auto-generated method stub
        return null;
    
public booleanisSupported(java.lang.String feature, java.lang.String version)

        // TODO Auto-generated method stub
        return false;
    
public voidnormalize()

        // TODO Auto-generated method stub
    
public org.w3c.dom.NoderemoveChild(org.w3c.dom.Node oldChild)

        if (mChildNodes.contains(oldChild)) {
            mChildNodes.remove(oldChild);
            ((NodeImpl)oldChild).setParentNode(null);
        } else {
            throw new DOMException(DOMException.NOT_FOUND_ERR, "Child does not exist");
        }
        return null;
    
public voidremoveEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)

        mEventTarget.removeEventListener(type, listener, useCapture);
    
public org.w3c.dom.NodereplaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)

        if (mChildNodes.contains(oldChild)) {
            // Try to remove the new child if available
            try {
                mChildNodes.remove(newChild);
            } catch (DOMException e) {
                // Ignore exception
            }
            mChildNodes.setElementAt(newChild, mChildNodes.indexOf(oldChild));
            ((NodeImpl)newChild).setParentNode(this);
            ((NodeImpl)oldChild).setParentNode(null);
        } else {
            throw new DOMException(DOMException.NOT_FOUND_ERR, "Old child does not exist");
        }
        return oldChild;
    
public voidsetNodeValue(java.lang.String nodeValue)

        // Default behaviour. Override if required.
    
private voidsetParentNode(org.w3c.dom.Node parentNode)

        mParentNode = parentNode;
    
public voidsetPrefix(java.lang.String prefix)

        // TODO Auto-generated method stub