com.ge.research.html
Class TableTag

java.lang.Object
  extended bycom.ge.research.html.HTMLTag
      extended bycom.ge.research.html.TableElement
          extended bycom.ge.research.html.TableTag

public class TableTag
extends TableElement

Encapsulates all the attributes of an HTML "TABLE" element, its accessors, validations, and default values.

Version:
$Revision: 1.1 $ $Date: 2006/08/11 00:17:33 $
Author:
garbiras
Created on:
Sep 9, 2002

Field Summary
 
Fields inherited from class com.ge.research.html.HTMLTag
HORIZONTAL_LINE, LINEBREAK, reconstructTag, tag, WHITESPACE
 
Constructor Summary
TableTag()
          Default constructor.
 
Method Summary
 void addRow(TableRowTag tr)
          Adds a row to the list of rows within the table.
 int getNumRows()
          Returns the current count of the number of rows in this table.
 TableRowTag getRow(int index)
          Returns the table row at the specified index within the list.
 java.util.List getRows()
          Returns the List of rows for this row.
 java.lang.String getRowString(int index)
          Returns the string representation of the table row at the specified index within the list.
 boolean removeRow(int index)
          Removes the table row at the specified index within the list.
 void removeRows()
          Removes all rows from the list of rows within the table.
protected  void resetTagSpecificInformation()
          Resets the tag attributes and content of the HTML Tag to their default values.
 void setRows(java.util.List list)
          Sets the list of table rows within the table.
protected  void writeTagSpecificData()
          Adds each table row tag within the table to the tag
 
Methods inherited from class com.ge.research.html.TableElement
getAlign, getBackground, getBgColor, getBorder, getBorderColor, getBorderColorDark, getBorderColorLight, getCellPadding, getCellSpacing, getColspan, getFrame, getHeight, getNowrap, getRowspan, getRules, getVAlign, getWidth, setAlign, setBackground, setBgColor, setBorder, setBorderColor, setBorderColorDark, setBorderColorLight, setCellPadding, setCellSpacing, setColspan, setFrame, setHeight, setNowrap, setRowspan, setRules, setVAlign, setWidth, writeTagSpecificAttributes
 
Methods inherited from class com.ge.research.html.HTMLTag
addAttribute, addAttribute, getId, getOnClick, getOnContextMenu, getOnDblClick, getOnDrag, getOnDragEnd, getOnDragStart, getOnFocus, getOnFocusOut, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnMoveEnd, getOnMoveStart, getStyle, getStyleClass, getTitle, removeAttribute, reset, setId, setOnClick, setOnContextMenu, setOnDblClick, setOnDrag, setOnDragEnd, setOnDragStart, setOnFocus, setOnFocusOut, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnMoveEnd, setOnMoveStart, setStyle, setStyleClass, setTitle, toString, writeAttribute, writeAttribute, writeAttribute, writeAttribute, writeAttribute, writeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableTag

public TableTag()
Default constructor. Calls super(TagPropertyConstants.TABLE_TAG)

See Also:
TagPropertyConstants.TABLE_TAG
Method Detail

addRow

public void addRow(TableRowTag tr)
Adds a row to the list of rows within the table. Increments the current count of rows within the table. Sets the value of the HTMLTag.reconstructTag to true

Parameters:
tr - the row to add to the table
See Also:
HTMLTag.reconstructTag

getNumRows

public int getNumRows()
Returns the current count of the number of rows in this table. The count is incremented and decremented after each "add" and "remove" method executes, so that the count is always accurate and does not have to be computed each time it is requested.

Returns:
The number of rows currently within the table

getRow

public TableRowTag getRow(int index)
                   throws java.lang.IndexOutOfBoundsException
Returns the table row at the specified index within the list.

Parameters:
index - the index of the list of rows to extract
Returns:
The row at the specified index
Throws:
java.lang.IndexOutOfBoundsException - If index is negative or if index is greater than or equal to the value of getNumRows()

getRows

public java.util.List getRows()
Returns the List of rows for this row. Each element of the List is of type TableRowTag

Returns:
The List of rows, of type TableRowTag, within the table

getRowString

public java.lang.String getRowString(int index)
                              throws java.lang.IndexOutOfBoundsException
Returns the string representation of the table row at the specified index within the list.

Parameters:
index - the index of the list of rows to extract
Returns:
The string representation of the row object at the specified index
Throws:
java.lang.IndexOutOfBoundsException - If index is negative or if index is greater than or equal to the value of getNumRows()
See Also:
getRow(int)

removeRow

public boolean removeRow(int index)
                  throws java.lang.IndexOutOfBoundsException
Removes the table row at the specified index within the list. Decrements the current count of rows within the table. Sets the value of the HTMLTag.reconstructTag to true

Parameters:
index - the index of the list of rows to remove
Returns:
true if the row was successfully removed; otherwise an exception is thrown
Throws:
java.lang.IndexOutOfBoundsException - If index is negative or if index is greater than or equal to the value of getNumRows()
See Also:
HTMLTag.reconstructTag

removeRows

public void removeRows()
Removes all rows from the list of rows within the table. Updates the current row count to zero. Sets the value of the HTMLTag.reconstructTag to true

See Also:
HTMLTag.reconstructTag

setRows

public void setRows(java.util.List list)
             throws java.lang.ClassCastException
Sets the list of table rows within the table. If list is not null or empty, checks to make sure that all elements of list are of type TableRowTag. If so, it first removes all previously existing rows, updating the current row count to zero. Then it adds the contents of the list argument to the list of table rows, in the same order as they appear in list. If during this operation an element of list is found to not be of type TableRowTag, then the table row list is purged and an exception is thrown.

Parameters:
list - the new list of table rows for this table
Throws:
java.lang.ClassCastException - If any elements of list are not of type TableRowTag. If this is found to be the case prior to attempting to add the list contents to this tag, then the original list of table rows is left unchanged. If however this is found during updating the table row list, then the entire list is purged.
See Also:
removeRows(), addRow(com.ge.research.html.TableRowTag)

resetTagSpecificInformation

protected void resetTagSpecificInformation()
Description copied from class: HTMLTag
Resets the tag attributes and content of the HTML Tag to their default values. Called by HTMLTag.reset(). This method is not implemented in HTMLTag. Subclasses that contain tag content information should implement this method to set their information to their default values.

Overrides:
resetTagSpecificInformation in class TableElement

writeTagSpecificData

protected void writeTagSpecificData()
Adds each table row tag within the table to the tag

Overrides:
writeTagSpecificData in class HTMLTag
See Also:
HTMLTag.toString()