Class Table

Table
Direct Known Subclasses:
Form

public class Table

This class represents the entity of a table. With it, one can add data in varying ways using the methods specified.


Constructor Summary
Table(var $columns, var $tp, var $ftp)
          Constructs a Table with the specified amount of columns.
 
Method Summary
 void add(var $data, var $colSpan, var $ftp)
          Adds data to the current table cell.
 void closeTable()
          Creates the necessary HTML footer for the table.
 void fillRow()
          Fills the current row if not a new row.
 FontProperties getFontProperties()
          Gets the current font properties of the table.
 TableProperties getTableProperties()
          Gets the current table properties of the table.
 void nextRow()
          Advances to the next row from the current row.
 void openTable()
          Creates an HTML header for the table.
 void setFontProperties(var $ftp)
          Sets the font properties to the specified value.
 void setTableProperties(var $tp)
          Sets the table properties to the specified value.
 void spacerRow(var $rows)
          Creates a "spacer" row.
 java.lang.String toString()
          Returns a string representation of the current table.
 

Constructor Detail

Table

public Table(var $columns,
             var $tp,
             var $ftp)
Constructs a Table with the specified amount of columns. If other values are passed, the table will also set the table and font properties to the specified values. Otherwise, default values will be used.
Parameters:
$columns - int specifying amount of columns
$tp - TableProperties specifying properties of table
$ftp - FontProperties specifying font of table
$columns - Default Value: 1
$tp - Default Value: ""
$ftp - Default Value: ""
Method Detail

getTableProperties

public TableProperties getTableProperties()
Gets the current table properties of the table.

getFontProperties

public FontProperties getFontProperties()
Gets the current font properties of the table.

setTableProperties

public void setTableProperties(var $tp)
Sets the table properties to the specified value.
Parameters:
$tp - TableProperties specifying table properties

setFontProperties

public void setFontProperties(var $ftp)
Sets the font properties to the specified value.
Parameters:
$ftp - FontProperties specifying font properties

toString

public java.lang.String toString()
Returns a string representation of the current table.

add

public void add(var $data,
                var $colSpan,
                var $ftp)
Adds data to the current table cell. If a column span amount is passed, then the table will add the data, but it will span the specified amount of cells; otherwise, it will span a default of one cell. If a font properties type is passed along, the current cell will use that font properties type. Will automatically start a new row once all the columns have been used.
Parameters:
$data - String specifying the data to be added
$colSpan - amount of cells to span across
$ftp - FontProperties to use for current cell
$data - Default Value: ""
$colSpan - Default Value: 1
$ftp - Default Value: ""

nextRow

public void nextRow()
Advances to the next row from the current row. Determines how many columns need to be filled for the current row and calls the add method until the row is filled and brought to the next row.

One should not that even if on a new row, the method will fill that row and bring it up to the next row.


fillRow

public void fillRow()
Fills the current row if not a new row. This method differs from nextRow() in that fillRow(), when encountering a new, blank row, will not fill it and leave it as is. Otherwise, fillRow() will fill a non-blank row to bring it up to the next row.

spacerRow

public void spacerRow(var $rows)
Creates a "spacer" row. Will fill the current row using fillRow() and then fill the next row with HTML space until brought to a new row.
Parameters:
$rows - int specifying how many rows to create
$rows - Default Value: 1

openTable

public void openTable()
Creates an HTML header for the table. Should only be called after everything is prepared, primarily the configuring of the table properties; and, it should also be called before any data is added.

closeTable

public void closeTable()
Creates the necessary HTML footer for the table. After calling closeTable(), the table can't be written to.