cox.jmatt.java.MathTools.markup.html
Class TableTag

java.lang.Object
  extended by cox.jmatt.java.MathTools.markup.Tag
      extended by cox.jmatt.java.MathTools.markup.html.BaseHTag
          extended by cox.jmatt.java.MathTools.markup.html.TableTag

public class TableTag
extends BaseHTag

This class provides the <table> tag. It contains methods to add rows to an existing table or to create one from an Object[][] array.


Nested Class Summary
 
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.html.BaseHTag
BaseHTag.TagKeys
 
Field Summary
 
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag
myTagName
 
Constructor Summary
TableTag()
          Create an empty TableTag.
 
Method Summary
 TableTag addRow(java.lang.Object[] pRow, java.lang.String pCellID, boolean bIsTH)
          Add a row based on a one-dimensional Object[] array.
 TableTag addRow(TRTag pTag)
          Add an existing row to the current table.
 TableTag copyOf()
          Produce a copy of this table.
static TableTag createTable(java.lang.Object[][] pTable, java.lang.String pRowID, java.lang.String pCellID, boolean bUseRowIDforCells, boolean bFirstRowTH)
          Create a <table> based on an Object[][] array.
 TableTag newTable(java.lang.Object[][] pTable, java.lang.String pRowID, java.lang.String pCellID, boolean bUseRowIDforCells, boolean bFirstRowTH)
          Instance flavor of createTable().
 
Methods inherited from class cox.jmatt.java.MathTools.markup.html.BaseHTag
_addTag, _content, _enableCopy, _setContent, addCDATA, addContent, getID, getRawContent, getTagKey, getTagName, isInBody, setClicked, setCSS, setName, setStyle
 
Methods inherited from class cox.jmatt.java.MathTools.markup.Tag
_addAttribute, _addAttributes, _addNAttribute, _asBoolean, _asDouble, _asInt, _attributes, _clampNAttribute, _clampNAttribute, _fixKey, _setEnableXMLTag, badPizza, closeTag, configureTag, configureTagFromGlobalPizza, makeTag, openTag, reset, setID, toString, validString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableTag

public TableTag()
Create an empty TableTag.

Method Detail

copyOf

public TableTag copyOf()
Produce a copy of this table.


createTable

public static final TableTag createTable(java.lang.Object[][] pTable,
                                         java.lang.String pRowID,
                                         java.lang.String pCellID,
                                         boolean bUseRowIDforCells,
                                         boolean bFirstRowTH)

Create a <table> based on an Object[][] array. The first index is a row index, the second is the cells within that row. A row ID prefix can be given as can a column ID prefix. The row number is appended to the end of the row ID prefix, if it is specified, and the cell ID prefix is sent into each TRTag.createRow() call. If 'bUseRowIDforCells' is true the row ID prefix is concatenated with the cell ID prefix (if present) or simply sent in (cell ID not specified) giving a way to uniquely ID both rows and cells.

Null entries within a row become empty <td> elements, null rows are ignored. If a row is null, originally or when converted to a row, it is ignored and it does not affect the row count.

Parameters:
pTable - The Object[][] array to convert to a table. If null or empty the return value is null.
pRowID - The row ID prefix. If defined this is prepended to the row number for each <tr> tag ID.
pCellID - The cell ID prefix sent into each row.
bUseRowIDforCells - true to prefix the cell ID prefix with the (current) row ID, false to omit it.
bFirstRowTH - 'true' if the first row (pTable[0][]) should be <th> elements.

newTable

public TableTag newTable(java.lang.Object[][] pTable,
                         java.lang.String pRowID,
                         java.lang.String pCellID,
                         boolean bUseRowIDforCells,
                         boolean bFirstRowTH)
Instance flavor of createTable().


addRow

public TableTag addRow(TRTag pTag)
Add an existing row to the current table.


addRow

public TableTag addRow(java.lang.Object[] pRow,
                       java.lang.String pCellID,
                       boolean bIsTH)

Add a row based on a one-dimensional Object[] array. This uses the TRTag.createRow method. Parameters are the Object[] array to create the row and the (optional) cell ID header. Return value is a self-reference.