edu.nrao.sss.html
Class HtmlTableRow

java.lang.Object
  extended by edu.nrao.sss.html.HtmlElement
      extended by edu.nrao.sss.html.HtmlTableRow

public class HtmlTableRow
extends HtmlElement

A row in an HTML table.

Version Info:

$Revision: 483 $
$Date: 2007-03-23 16:48:30 -0600 (Fri, 23 Mar 2007) $
$Author: dharland $

Since:
2007-03-15
Author:
David M. Harland

Nested Class Summary
static class HtmlTableRow.Type
          Types of table rows.
 
Field Summary
 
Fields inherited from class edu.nrao.sss.html.HtmlElement
NBSP_HTML, NBSP_TEXT, NBSP_UNICODE
 
Constructor Summary
HtmlTableRow()
          Creates a new data row.
HtmlTableRow(HtmlTableRow.Type rowType)
          Creates a new row of the given type.
 
Method Summary
 void addCell(HtmlTableCell newCell)
          Adds newCell to this row.
 List<HtmlTableCell> getCells()
          Returns a copy of this row's list of cells.
 HtmlTable getParentTable()
          Returns the table to which this row belongs.
 int getPositionInTable()
          Returns the position of this row in its table.
 HtmlTableRow.Type getType()
          Returns the type of this row.
 boolean isSimple()
          Returns false.
 boolean removeCell(HtmlTableCell unwantedCell)
          Removes unwantedCell from this row.
 HtmlTableCell removeCell(int index)
          Removes the cell at index from this row.
 void setType(HtmlTableRow.Type newType)
          Sets the type of this row.
 int size()
          Returns the number of cells in this row.
 
Methods inherited from class edu.nrao.sss.html.HtmlElement
addAttribute, copyAttributesOf, getAttribute, getAttributes, getAttributeValue, getTag, removeAllAttributes, removeAttribute, writeHtmlTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlTableRow

public HtmlTableRow()
Creates a new data row.


HtmlTableRow

public HtmlTableRow(HtmlTableRow.Type rowType)
Creates a new row of the given type.

Parameters:
rowType - the type of this row, either header, data, or footer. If this value is null, this row will be a data row.
Method Detail

isSimple

public boolean isSimple()
Returns false.

Specified by:
isSimple in class HtmlElement
Returns:
true if this is a simple element.

getParentTable

public HtmlTable getParentTable()
Returns the table to which this row belongs.

Returns:
the table to which this row belongs. If this row does not belong to a table, the returned value will be null.

getPositionInTable

public int getPositionInTable()
Returns the position of this row in its table. The first position is zero.

Returns:
the position of this row in its table. If this row is not part of a table, the value returned is -1.

setType

public void setType(HtmlTableRow.Type newType)
Sets the type of this row.

Parameters:
newType - the type of this row. If this value is null, this cell will be set to a data row.

getType

public HtmlTableRow.Type getType()
Returns the type of this row.

Returns:
the type of this row.

addCell

public void addCell(HtmlTableCell newCell)
Adds newCell to this row.

If the new cell is null or already in this row, this method does nothing. Otherwise the new cell is removed from its previous row, if any, and added to this one. The new cell's parent row is set to this one.

Parameters:
newCell - a new cell for this row.

removeCell

public boolean removeCell(HtmlTableCell unwantedCell)
Removes unwantedCell from this row.

If the unwanted cell is null or not part of this row, this method does nothing. Otherwise the unwanted cell is removed from this row, and its parent row is set to null.

Parameters:
unwantedCell - the cell to be removed from this row.
Returns:
true if unwantedCell was removed from this row.

removeCell

public HtmlTableCell removeCell(int index)
Removes the cell at index from this row.

Parameters:
index - the index of the unwanted cell.
Returns:
the cell formerly at index.

getCells

public List<HtmlTableCell> getCells()
Returns a copy of this row's list of cells.

While the list is a copy, the cells in the returned list are the actual cells held in this row.

Returns:
a copy of this row's list of cells.

size

public int size()
Returns the number of cells in this row. The returned value does not consider how many columns a cell spans.

Returns:
the number of cells in this row.


Copyright © 2009. All Rights Reserved.