echopointng.ui.util
Class HtmlTable

java.lang.Object
  extended by echopointng.ui.util.HtmlTable

public class HtmlTable
extends java.lang.Object

The HtmlTable class is a helper for creating HTML TABLE elements, TBODY element, TR elements and TD elements in less code that usual. It auto creates a TBODY and then TR and TD elements since a table cannot have content without TBODY, TR and TD elements.

It keeps a logical pointer to the current TR and TD so you can add more content as you go, more easily.


Constructor Summary
HtmlTable(org.w3c.dom.Document document)
          Constructs a HtmlTable with a zero sized border, cellpadding and cellspacing.
HtmlTable(org.w3c.dom.Document document, boolean autoAddTRTD)
          Constructs a HtmlTable with a zero sized border, cellpadding and cellspacing and may optionally create TR and TD combination.
HtmlTable(org.w3c.dom.Document document, boolean autoAddTRTD, int border, int cellspacing, int cellpadding)
          Constructs a HtmlTable with the specified border, cellpadding and cellspacing.
HtmlTable(org.w3c.dom.Document document, int cellspacing, int cellpadding)
          Constructs a HtmlTable with a zero sized border, and the specified cellpadding and cellspacing.
HtmlTable(org.w3c.dom.Document document, int border, int cellspacing, int cellpadding)
          Constructs a HtmlTable with the specified border, cellpadding and cellspacing.
 
Method Summary
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
           
 org.w3c.dom.Node cloneNode(boolean deep)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAttribute(java.lang.String name)
           
 org.w3c.dom.Attr getAttributeNode(java.lang.String name)
           
 org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 org.w3c.dom.NamedNodeMap getAttributes()
           
 org.w3c.dom.NodeList getChildNodes()
           
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)
           
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
           
 org.w3c.dom.Node getFirstChild()
           
 org.w3c.dom.Node getLastChild()
           
 java.lang.String getLocalName()
           
 java.lang.String getNamespaceURI()
           
 org.w3c.dom.Node getNextSibling()
           
 java.lang.String getNodeName()
           
 short getNodeType()
           
 java.lang.String getNodeValue()
           
 org.w3c.dom.Document getOwnerDocument()
           
 org.w3c.dom.Node getParentNode()
           
 java.lang.String getPrefix()
           
 org.w3c.dom.Node getPreviousSibling()
           
 org.w3c.dom.Element getTABLE()
           
 java.lang.String getTagName()
           
 org.w3c.dom.Element getTBODY()
           
 org.w3c.dom.Element getTD()
           
 org.w3c.dom.Element getTR()
           
 boolean hasAttribute(java.lang.String name)
           
 boolean hasAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 boolean hasAttributes()
           
 boolean hasChildNodes()
           
 int hashCode()
           
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
           
 boolean isSupported(java.lang.String feature, java.lang.String version)
           
 org.w3c.dom.Element newTD()
          Adds a new TD element to the current TR and returns the new TD element.
 org.w3c.dom.Element newTR()
          Adds a new TR element to the TABLE and returns the new TR element.
 org.w3c.dom.Element newTRnoTD()
          Adds a new TR element to the TABLE and returns the new TR element.
 void normalize()
           
 void removeAttribute(java.lang.String name)
           
 org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
           
 void removeAttributeNS(java.lang.String namespaceURI, java.lang.String localName)
           
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
           
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
           
 void setAttribute(java.lang.String name, int value)
           
 void setAttribute(java.lang.String name, java.lang.String value)
           
 org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
           
 org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
           
 void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
           
 void setNodeValue(java.lang.String nodeValue)
           
 void setPrefix(java.lang.String prefix)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlTable

public HtmlTable(org.w3c.dom.Document document)
Constructs a HtmlTable with a zero sized border, cellpadding and cellspacing. A TR and TD are also created.

Parameters:
document - - the Document to create elements in

HtmlTable

public HtmlTable(org.w3c.dom.Document document,
                 boolean autoAddTRTD)
Constructs a HtmlTable with a zero sized border, cellpadding and cellspacing and may optionally create TR and TD combination.

Parameters:
document - - the Document to create elements in
autoAddTRTD - - wheter a child Tr and TD should be added to the Table

HtmlTable

public HtmlTable(org.w3c.dom.Document document,
                 int cellspacing,
                 int cellpadding)
Constructs a HtmlTable with a zero sized border, and the specified cellpadding and cellspacing. A TR and TD are also created.

Parameters:
document - - the Document to create elements in
cellspacing - - the cellspacing of the table
cellpadding - - the cellpadding of the table

HtmlTable

public HtmlTable(org.w3c.dom.Document document,
                 int border,
                 int cellspacing,
                 int cellpadding)
Constructs a HtmlTable with the specified border, cellpadding and cellspacing. A TR and TD are also created.

Parameters:
document - - the Document to create elements in
border - - the border of the table
cellspacing - - the cellspacing of the table
cellpadding - - the cellpadding of the table

HtmlTable

public HtmlTable(org.w3c.dom.Document document,
                 boolean autoAddTRTD,
                 int border,
                 int cellspacing,
                 int cellpadding)
Constructs a HtmlTable with the specified border, cellpadding and cellspacing. A TR and TD are also created if the autoAddTRTD is true.

Parameters:
document - - the Document to create elements in
autoAddTRTD - - wheter a child Tr and TD should be added to the Table
border - - the border of the table
cellspacing - - the cellspacing of the table
cellpadding - - the cellpadding of the table
Method Detail

getTABLE

public org.w3c.dom.Element getTABLE()
Returns:
the TABLE element

getTBODY

public org.w3c.dom.Element getTBODY()
Returns:
the TBODY element

getTD

public org.w3c.dom.Element getTD()
Returns:
the current TD element

getTR

public org.w3c.dom.Element getTR()
Returns:
the current TR element

newTD

public org.w3c.dom.Element newTD()
Adds a new TD element to the current TR and returns the new TD element. The current TD becomes this new TD element.

Returns:
a new TD element

newTR

public org.w3c.dom.Element newTR()
Adds a new TR element to the TABLE and returns the new TR element. It also adds a new TD element to this TR. The current TR becomes this new TR element.

Returns:
the new child TD element created under the TR

newTRnoTD

public org.w3c.dom.Element newTRnoTD()
Adds a new TR element to the TABLE and returns the new TR element. It DOES NOT create a new TD element under the TR. The current TR becomes this new TR element.

Returns:
a new child TE element

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getAttribute

public java.lang.String getAttribute(java.lang.String name)

getAttributeNode

public org.w3c.dom.Attr getAttributeNode(java.lang.String name)

getAttributeNodeNS

public org.w3c.dom.Attr getAttributeNodeNS(java.lang.String namespaceURI,
                                           java.lang.String localName)

getAttributeNS

public java.lang.String getAttributeNS(java.lang.String namespaceURI,
                                       java.lang.String localName)

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()

getChildNodes

public org.w3c.dom.NodeList getChildNodes()

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String name)

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.String localName)

getFirstChild

public org.w3c.dom.Node getFirstChild()

getLastChild

public org.w3c.dom.Node getLastChild()

getLocalName

public java.lang.String getLocalName()

getNamespaceURI

public java.lang.String getNamespaceURI()

getNextSibling

public org.w3c.dom.Node getNextSibling()

getNodeName

public java.lang.String getNodeName()

getNodeType

public short getNodeType()

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()

getParentNode

public org.w3c.dom.Node getParentNode()

getPrefix

public java.lang.String getPrefix()

getPreviousSibling

public org.w3c.dom.Node getPreviousSibling()

getTagName

public java.lang.String getTagName()

hasAttribute

public boolean hasAttribute(java.lang.String name)

hasAttributeNS

public boolean hasAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)

hasAttributes

public boolean hasAttributes()

hasChildNodes

public boolean hasChildNodes()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

isSupported

public boolean isSupported(java.lang.String feature,
                           java.lang.String version)

normalize

public void normalize()

removeAttribute

public void removeAttribute(java.lang.String name)
                     throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

removeAttributeNode

public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr oldAttr)
                                     throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

removeAttributeNS

public void removeAttributeNS(java.lang.String namespaceURI,
                              java.lang.String localName)
                       throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setAttribute

public void setAttribute(java.lang.String name,
                         int value)
                  throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setAttributeNode

public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr newAttr)
                                  throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setAttributeNodeNS

public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr newAttr)
                                    throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setAttributeNS

public void setAttributeNS(java.lang.String namespaceURI,
                           java.lang.String qualifiedName,
                           java.lang.String value)
                    throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setNodeValue

public void setNodeValue(java.lang.String nodeValue)
                  throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

setPrefix

public void setPrefix(java.lang.String prefix)
               throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object