com.meterware.httpunit

Class WebTable

public class WebTable extends HTMLElementBase

This class represents a table in an HTML page.

Author: Russell Gold Benoit Xhenseval

Field Summary
static HTMLElementPredicateMATCH_FIRST_NONBLANK_CELL
Predicate to match the complete text of a table's first non-blank cell.
static HTMLElementPredicateMATCH_FIRST_NONBLANK_CELL_PREFIX
Predicate to match a prefix of a table's first non-blank cell.
static HTMLElementPredicateMATCH_ID
Predicate to match a table's ID.
static HTMLElementPredicateMATCH_SUMMARY
Predicate to match a table's summary attribute.
Method Summary
String[][]asText()
Returns a rendering of this table with all cells converted to text.
StringgetCellAsText(int row, int column)
Returns the contents of the specified table cell as text.
intgetColumnCount()
Returns the number of columns in the table.
protected ScriptableDelegategetParentDelegate()
intgetRowCount()
Returns the number of rows in the table.
TableRow[]getRows()
Returns an array of rows for this table.
StringgetSummary()
Returns the summary attribute associated with this table.
TableCellgetTableCell(int row, int column)
Returns the contents of the specified table cell as text.
TableCellgetTableCellWithID(String id)
Returns the contents of the specified table cell with a given ID
protected ScriptableDelegatenewScriptable()
voidpurgeEmptyCells()
Removes all rows and all columns from this table which have no visible text in them.
StringtoString()

Field Detail

MATCH_FIRST_NONBLANK_CELL

public static final HTMLElementPredicate MATCH_FIRST_NONBLANK_CELL
Predicate to match the complete text of a table's first non-blank cell. *

MATCH_FIRST_NONBLANK_CELL_PREFIX

public static final HTMLElementPredicate MATCH_FIRST_NONBLANK_CELL_PREFIX
Predicate to match a prefix of a table's first non-blank cell. *

MATCH_ID

public static final HTMLElementPredicate MATCH_ID
Predicate to match a table's ID. *

MATCH_SUMMARY

public static final HTMLElementPredicate MATCH_SUMMARY
Predicate to match a table's summary attribute. *

Method Detail

asText

public String[][] asText()
Returns a rendering of this table with all cells converted to text.

getCellAsText

public String getCellAsText(int row, int column)
Returns the contents of the specified table cell as text. The row and column numbers are zero-based.

Throws: IndexOutOfBoundsException if the specified cell numbers are not valid

getColumnCount

public int getColumnCount()
Returns the number of columns in the table.

getParentDelegate

protected ScriptableDelegate getParentDelegate()

getRowCount

public int getRowCount()
Returns the number of rows in the table.

getRows

public TableRow[] getRows()
Returns an array of rows for this table.

getSummary

public String getSummary()
Returns the summary attribute associated with this table.

getTableCell

public TableCell getTableCell(int row, int column)
Returns the contents of the specified table cell as text. The row and column numbers are zero-based.

Throws: IndexOutOfBoundsException if the specified cell numbers are not valid

getTableCellWithID

public TableCell getTableCellWithID(String id)
Returns the contents of the specified table cell with a given ID

Returns: TableCell with given ID or null if ID is not found.

newScriptable

protected ScriptableDelegate newScriptable()

purgeEmptyCells

public void purgeEmptyCells()
Removes all rows and all columns from this table which have no visible text in them.

toString

public String toString()