Class java.servlet.html.HtmlTable
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.servlet.html.HtmlTable

java.lang.Object
   |
   +----java.servlet.html.HtmlTable

public class HtmlTable
extends Object
implements HtmlElement
Class for maintaining row elements in an HtmlTable.

Constructor Index

 o HtmlTable()
 o HtmlTable(String)
Create a table container with the specified attributes.

Method Index

 o addCaption(String)
Caption the table.
 o addData(HtmlElement)
 o addData(HtmlElement, String)
 o addData(String)
 o addData(String, String)
 o addDataElements(String)
Add data to the current row.
 o addDataElements(String, String)
Add data to the current row, with specified attributes.
 o addDataElements(Vector)
 o addDataElements(Vector, String)
 o addHeader(HtmlElement)
 o addHeader(HtmlElement, String)
 o addHeader(String)
 o addHeader(String, String)
 o addHeaders(String)
Add headers to the current row.
 o addHeaders(String, String)
Adds a bunch of headers to the current row
 o addHeaders(Vector)
 o addHeaders(Vector, String)
 o addRow(HtmlRow)
 o concat(HtmlRow)
 o newRow()
Starts a new row, ending the previous row if necessary.
 o newRow(String)
Starts a new row, ending the previous row if necessary.
 o toString()
 o wrap(String)
 o write(OutputStream)

Constructors

 o HtmlTable
  public HtmlTable()
 o HtmlTable
  public HtmlTable(String attribs)
Create a table container with the specified attributes.
Parameters:
attribs - the attributes use with the <table> tag. ie. HtmlTable table = new HtmlTable("align=center"); will produce this html when written out. <table align=center></table>

Methods

 o newRow
  public void newRow()
Starts a new row, ending the previous row if necessary.
 o newRow
  public void newRow(String attribs)
Starts a new row, ending the previous row if necessary.
Parameters:
attribs - The attributes to embed in this <td> tag.
 o addCaption
  public void addCaption(String caption)
Caption the table.
Parameters:
caption - The caption to add to this table.
 o addHeaders
  public void addHeaders(String headers,
                         String attribs)
Adds a bunch of headers to the current row
Parameters:
headers - Comma delimited String of headers to add to the current row.
attribs - The attributes to embed in the <th> tags. ie. HtmlTable table = new HtmlTable("align=center"); table.addHeaders("Male,Female", "colspan=2 rowspan=2"); will produce this html when written out <table align=center> <td> <th colspan=2 rowspan=2>Male</th> <th colspan=2 rowspan=2>Female</th> </td> </table>
 o addHeaders
  public void addHeaders(String headers)
Add headers to the current row.
Parameters:
headers - The headers to add.
 o addDataElements
  public void addDataElements(String cells,
                              String attribs)
Add data to the current row, with specified attributes.
Parameters:
cells - String of cells to add to the current row.
attribs - The attributes to embed in the <td> tag.
 o addDataElements
  public void addDataElements(String cells)
Add data to the current row.
Parameters:
cells - Cells to add to the row.
 o addHeaders
  public void addHeaders(Vector headers,
                         String attribs)
Parameters:
headers - Vector of headers to add to the current row. elements in the headers Vector must either be HtmlElements or Strings.
attribs - the attributes to embed in the <th> tag.
 o addHeaders
  public void addHeaders(Vector headers)
 o addDataElements
  public void addDataElements(Vector cells,
                              String attribs)
Parameters:
headers - Vector of headers to add to the current row. elements in the headers Vector must either be HtmlElements or Strings.
attribs - the attributes to embed in the <td> tag.
 o addDataElements
  public void addDataElements(Vector cells)
 o addHeader
  public void addHeader(String header)
Parameters:
header - the content of the header to add to the current row.
 o addHeader
  public void addHeader(String cell,
                        String attribs)
Parameters:
header - the content of the header to add to the current row.
attribs - the attributes to associate with this header.
ie. addHeader("text", "align=bottom") produces
text
 o addHeader
  public void addHeader(HtmlElement cell)
Parameters:
header - the content of the header to add to the current row.
 o addHeader
  public void addHeader(HtmlElement cell,
                        String attribs)
Parameters:
header - the content of the header to add to the current row.
attribs - the attributes to associate with this header.
ie. addHeader(new HtmlText("text"), "align=bottom") produces
text
 o addData
  public void addData(String cell)
Parameters:
cell - the content of the data element to add to the current row.
 o addData
  public void addData(String cell,
                      String attribs)
Parameters:
cell - the content of the data element to add to the current row.
attribs - the attributes to associate with this header.
ie. addData("text", "align=bottom") produces
text
 o addData
  public void addData(HtmlElement cell)
Parameters:
cell - the content of the data element to add to the current row.
 o addData
  public void addData(HtmlElement cell,
                      String attribs)
Parameters:
cell - the content of the data element to add to the current row.
attribs - the attributes to associate with this data element.
ie. addData(new HtmlText("text"), "align=bottom") produces
text
 o concat
  public void concat(HtmlRow row)
Parameters:
row - Row to append to the end of the current row assumes the attributes of this row. ie. HtmlRow row1 = new HtmlRow(); row1.addData("row1 data"); HtmlRow row2 = new HtmlRow("align=top"); row2.addData("row2 data"); row1.concat(row2)
generates: <tr><td>row1 data</td><td>row2 data</td><tr>
 o addRow
  public void addRow(HtmlRow row)
 o wrap
  public void wrap(String tags)
 o write
  public void write(OutputStream out) throws IOException
 o toString
  public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index