FileDocCategorySizeDatePackage
HTMLTableElementImpl.javaAPI DocApache Xerces 3.0.110943Fri Sep 14 20:33:54 BST 2007org.apache.html.dom

HTMLTableElementImpl

public class HTMLTableElementImpl extends HTMLElementImpl implements HTMLTableElement
xerces.internal
version
$Revision: 447255 $ $Date: 2006-09-18 01:36:42 -0400 (Mon, 18 Sep 2006) $
author
Assaf Arkin
see
org.w3c.dom.html.HTMLAnchorElement
see
org.apache.xerces.dom.ElementImpl

Fields Summary
private static final long
serialVersionUID
private HTMLCollectionImpl
_rows
private HTMLCollectionImpl
_bodies
Constructors Summary
public HTMLTableElementImpl(HTMLDocumentImpl owner, String name)
Constructor requires owner document.

param
owner The owner HTML document

        super( owner, name );
    
Methods Summary
public org.w3c.dom.NodecloneNode(boolean deep)
Explicit implementation of cloneNode() to ensure that cache used for getRows() and getTBodies() gets cleared.

        HTMLTableElementImpl clonedNode = (HTMLTableElementImpl)super.cloneNode( deep );
        clonedNode._rows = null;
        clonedNode._bodies = null;
        return clonedNode;
    
public synchronized org.w3c.dom.html.HTMLElementcreateCaption()

        HTMLElement    section;
        
        section = getCaption();
        if ( section != null )
            return section;
        section = new HTMLTableCaptionElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "CAPTION" );
        appendChild( section );
        return section;
    
public synchronized org.w3c.dom.html.HTMLElementcreateTFoot()

        HTMLElement    section;
        
        section = getTFoot();
        if ( section != null )
            return section;
        section = new HTMLTableSectionElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TFOOT" );
        appendChild( section );
        return section;
    
public synchronized org.w3c.dom.html.HTMLElementcreateTHead()

        HTMLElement    section;
        
        section = getTHead();
        if ( section != null )
            return section;
        section = new HTMLTableSectionElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "THEAD" );
        appendChild( section );
        return section;
    
public synchronized voiddeleteCaption()

        Node    old;
        
        old = getCaption();
        if ( old != null )
            removeChild ( old );
    
public synchronized voiddeleteRow(int index)

        Node    child;
        
        child = getFirstChild();
        while ( child != null )
        {
            if ( child instanceof HTMLTableRowElement )
            {
                if ( index == 0 )
                {
                    removeChild ( child );
                    return;
                }
                --index;
            }
            else
            if ( child instanceof HTMLTableSectionElementImpl )
            {
                index = ( (HTMLTableSectionElementImpl) child ).deleteRowX( index );
                if ( index < 0 )
                    return;
            }
            child = child.getNextSibling();
        }
    
public synchronized voiddeleteTFoot()

        Node    old;
        
        old = getTFoot();
        if ( old != null )
            removeChild ( old );
    
public synchronized voiddeleteTHead()

        Node    old;
        
        old = getTHead();
        if ( old != null )
            removeChild ( old );
    
public java.lang.StringgetAlign()

        return capitalize( getAttribute( "align" ) );
    
public java.lang.StringgetBgColor()

        return getAttribute( "bgcolor" );
    
public java.lang.StringgetBorder()

        return getAttribute( "border" );
    
public synchronized org.w3c.dom.html.HTMLTableCaptionElementgetCaption()


       
    
        Node    child;
        
        child = getFirstChild();
        while ( child != null )
        {
            if ( child instanceof HTMLTableCaptionElement &&
                 child.getNodeName().equals( "CAPTION" ) )
                return (HTMLTableCaptionElement) child;
            child = child.getNextSibling();
        }
        return null;
    
public java.lang.StringgetCellPadding()

        return getAttribute( "cellpadding" );
    
public java.lang.StringgetCellSpacing()

        return getAttribute( "cellspacing" );
    
public java.lang.StringgetFrame()

        return capitalize( getAttribute( "frame" ) );
    
public org.w3c.dom.html.HTMLCollectiongetRows()

        if ( _rows == null )
            _rows = new HTMLCollectionImpl( this, HTMLCollectionImpl.ROW );
        return _rows;
    
public java.lang.StringgetRules()

        return capitalize( getAttribute( "rules" ) );
    
public java.lang.StringgetSummary()

        return getAttribute( "summary" );
    
public org.w3c.dom.html.HTMLCollectiongetTBodies()

        if ( _bodies == null )
            _bodies = new HTMLCollectionImpl( this, HTMLCollectionImpl.TBODY );
        return _bodies;
    
public synchronized org.w3c.dom.html.HTMLTableSectionElementgetTFoot()

        Node    child;
        
        child = getFirstChild();
        while ( child != null )
        {
            if ( child instanceof HTMLTableSectionElement &&
                 child.getNodeName().equals( "TFOOT" ) )
                return (HTMLTableSectionElement) child;
            child = child.getNextSibling();
        }
        return null;
    
public synchronized org.w3c.dom.html.HTMLTableSectionElementgetTHead()

        Node    child;
        
        child = getFirstChild();
        while ( child != null )
        {
            if ( child instanceof HTMLTableSectionElement &&
                 child.getNodeName().equals( "THEAD" ) )
                return (HTMLTableSectionElement) child;
            child = child.getNextSibling();
        }
        return null;
    
public java.lang.StringgetWidth()

        return getAttribute( "width" );
    
public org.w3c.dom.html.HTMLElementinsertRow(int index)

        HTMLTableRowElementImpl    newRow;

        newRow = new HTMLTableRowElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TR" );
        //newRow.insertCell( 0 );
        insertRowX( index, newRow );
        return newRow;
    
voidinsertRowX(int index, HTMLTableRowElementImpl newRow)

        Node    child;
        Node    lastSection = null;
                
        child = getFirstChild();
        while ( child != null )
        {
            if ( child instanceof HTMLTableRowElement )
            {
                if ( index == 0 )
                {
                    insertBefore( newRow, child );
                    return;
                }
            }
            else
            if ( child instanceof HTMLTableSectionElementImpl )
            {
                lastSection = child;
                index = ( (HTMLTableSectionElementImpl) child ).insertRowX( index, newRow );
                if ( index < 0 )
                    return;
            }
            child = child.getNextSibling();
        }
        if ( lastSection != null )
            lastSection.appendChild( newRow );
        else
            appendChild( newRow );
    
public voidsetAlign(java.lang.String align)

        setAttribute( "align", align );
    
public voidsetBgColor(java.lang.String bgColor)

        setAttribute( "bgcolor", bgColor );
    
public voidsetBorder(java.lang.String border)

        setAttribute( "border", border );
    
public synchronized voidsetCaption(org.w3c.dom.html.HTMLTableCaptionElement caption)

        if ( caption != null && ! caption.getTagName().equals( "CAPTION" ) )
            throw new IllegalArgumentException( "HTM016 Argument 'caption' is not an element of type <CAPTION>." );
        deleteCaption();
        if ( caption != null )
            appendChild( caption );
    
public voidsetCellPadding(java.lang.String cellPadding)

        setAttribute( "cellpadding", cellPadding );
    
public voidsetCellSpacing(java.lang.String cellSpacing)

        setAttribute( "cellspacing", cellSpacing );
    
public voidsetFrame(java.lang.String frame)

        setAttribute( "frame", frame );
    
public voidsetRules(java.lang.String rules)

        setAttribute( "rules", rules );
    
public voidsetSummary(java.lang.String summary)

        setAttribute( "summary", summary );
    
public synchronized voidsetTFoot(org.w3c.dom.html.HTMLTableSectionElement tFoot)

        if ( tFoot != null && ! tFoot.getTagName().equals( "TFOOT" ) )
            throw new IllegalArgumentException( "HTM018 Argument 'tFoot' is not an element of type <TFOOT>." );
        deleteTFoot();
        if ( tFoot != null )
            appendChild( tFoot );
    
public synchronized voidsetTHead(org.w3c.dom.html.HTMLTableSectionElement tHead)

        if ( tHead != null && ! tHead.getTagName().equals( "THEAD" ) )
            throw new IllegalArgumentException( "HTM017 Argument 'tHead' is not an element of type <THEAD>." );
        deleteTHead();
        if ( tHead != null )
            appendChild( tHead );
    
public voidsetWidth(java.lang.String width)

        setAttribute( "width", width );