PAJES 3.0.21

org.pajes.html
Class Table

java.lang.Object
  extended by org.pajes.html.Tag
      extended by org.pajes.html.TraversableElement
          extended by org.pajes.html.Container
              extended by org.pajes.html.TableContainer
                  extended by org.pajes.html.Table
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML, Traversable

public class Table
extends TableContainer

This class generates the TABLE and /TABLE tags. A table contains a series of rows. Each row contains a series of columns.

See Also:
Serialized Form

Nested Class Summary
 class Table.Body
          Inner class representing the body of the table.
 class Table.Cell
          Inner class representing a cell within the table.
 class Table.Column
          Inner class representing a column layout.
 class Table.ColumnGroup
          Inner class representing a column layout group.
 class Table.Foot
          Inner class representing the footer rows of the table.
 class Table.Head
          Inner class representing the header rows of the table.
 class Table.HeadingCell
          Inner class representing a heading cell within the table.
 class Table.Row
          Inner class representing a row within the table.
protected  class Table.RowContainer
          Abstract super-class of all body sections that contain rows.
 
Field Summary
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Table()
          Creates an HTML table.
Table(java.lang.String align)
          Creates an HTML table.
Table(java.lang.String align, java.lang.String width)
          Creates an HTML table.
Table(java.lang.String align, java.lang.String width, Color backgroundColor)
          Creates an HTML table.
Table(java.lang.String align, java.lang.String width, Color backgroundColor, int columns)
          Creates an HTML table.
Table(java.lang.String align, java.lang.String width, int columns)
          Creates an HTML table.
Table(java.lang.String align, java.lang.String width, int borderWidth, int cellPadding, int cellSpacing)
          Creates an HTML table.
Table(java.lang.String align, java.lang.String width, int borderWidth, int cellPadding, int cellSpacing, int columns)
          Creates an HTML table.
 
Method Summary
 Traversable add(HTML htmlObject)
          Adds an HTML object to the current container
 Table.Body addBody()
          Adds a new body section to the table.
 Table.Cell addCell(boolean content)
          Adds a cell to the table.
 Table.Cell addCell(java.lang.Boolean content)
          Adds a cell to the table.
 Table.Cell addCell(HTML content)
          Adds a cell to the table.
 Table.Cell addCell(HTML content, int columnsToSpan)
          Adds a cell to the table.
 Table.Cell addCell(HTML content, java.lang.String align)
          Adds a cell to the table.
 Table.Cell addCell(HTML content, java.lang.String align, int columnsToSpan)
          Adds a cell to the table.
 Table.Cell addCell(int content)
          Adds a cell to the table.
 Table.Cell addCell(java.lang.String content)
          Adds a cell to the table.
 Table.Cell addCell(java.lang.String content, boolean bold, java.lang.String align)
          Adds a cell to the table.
 Table.Cell addCell(java.lang.String content, int columnsToSpan)
          Adds a cell to the table.
 Table.Cell addCell(java.lang.String content, java.lang.String align)
          Adds a cell to the table.
 Table.Cell addHeadingCell(HTML headingContent)
          Adds a heading cell to the table.
 Table.Cell addHeadingCell(HTML headingContent, int columnsToSpan)
          Adds a heading cell to the table.
 Table.Cell addHeadingCell(HTML headingContent, int columnsToSpan, int rowsToSpan)
          Adds a heading cell to the table.
 Table.Cell addHeadingCell(java.lang.String headingContent)
          Adds a heading cell to the table.
 Table.Cell addHeadingCell(java.lang.String headingContent, int columnsToSpan)
          Adds a heading cell to the table.
 Table.Cell addHeadingCell(java.lang.String headingContent, int columnsToSpan, int rowsToSpan)
          Adds a heading cell to the table.
 Table.Row addRow()
          Adds a row into the table, or if a table body has been added, then it is added to the last added body.
 java.lang.Object clone()
          Allows a tag to be cloned.
 Table.Cell currentCell()
          Returns a reference to the cell just added, or null if no cells have been added.
 Table.Row currentRow()
          Returns a reference to the row just added, or null if no rows have been added.
 Table.Cell getCell(int row, int col)
          Returns the reference to the cell at the specified row and column position within the table body.
 Table.Foot getFooter()
          Returns the footer section of the table.
 Table.Head getHeader()
          Returns the header section of the table.
 Table.Cell getLogicalCell(int row, int col)
          Returns the reference to the cell at the specified logical row and column position (taking into account colspan and rowspan settings) within the table body.
 Table.Cell[][] getLogicalCellMap(boolean fill)
          Returns a two-dimensional Cell array containing the table cells in their logical positions.
 int getMaxColumns()
          Returns the maximum number of columns in each row of the table.
 Tag setAttribute(java.lang.String name, java.lang.String value)
          Adds a string attribute.
 Table setBackgroundImage(java.lang.String imageURL)
          Sets the background image for the table.
 Table setBorderColor(Color color)
          Sets the border colour for the table.
 Table setBorderWidth(int pixels)
          Set the Border width for the table.
 Table setCellPadding(int pixels)
          Cell Padding is the amount of empty space between the border of a table and the cell contents.
 Table setCellSpacing(int pixels)
          Cell spacing is the amount of empty space between the outer edge of each table cell.
 Table setMaxColumns(int columns)
          Sets the maximum number of columns in each row of the table.
 Table setSummary(java.lang.String summary)
          Sets the table summary, which is used to aid non-visual browsers in displaying the table.
 void write(Browser browser)
          Writes the tag to the browser.
 
Methods inherited from class org.pajes.html.TableContainer
getTable, setAlignment, setAlignmentCenter, setAlignmentLeft, setAlignmentRight, setBGColor, setHeight, setHeight, setVerticalAlignment, setVerticalAlignmentBottom, setVerticalAlignmentMiddle, setVerticalAlignmentTop, setWidth, setWidth, writeContent
 
Methods inherited from class org.pajes.html.Container
add, add, add, addContent, clear, delete, delete, destroy, get, getContent, getContents, getPosition, insert, replace, set, setContent, setContent, size
 
Methods inherited from class org.pajes.html.TraversableElement
dump, dump, getAll, getFieldByName, getFirstFieldByName, getFirstTagByAttribute, getFirstTagByClass, getFirstTagByID, getFirstTagByName, getTagByAttribute, getTagByClass, getTagByID, getTagByName, setWritable
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, clearAttribute, clearAttributes, getAttribute, getAttributes, getAttributeSet, getContainer, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getParent, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, hasAttribute, init, initAttributes, isChildOf, isChildOf, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setId, setOnClickHandler, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setParent, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pajes.html.Traversable
isWritable
 
Methods inherited from interface org.pajes.html.HTML
getContainer, getDocument, getId, getParent, getWritePermission, isChildOf, isChildOf, setContainer, setParent, setWritePermission
 

Constructor Detail

Table

public Table()
Creates an HTML table.


Table

public Table(java.lang.String align)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left, Center, or Right).

Table

public Table(java.lang.String align,
             java.lang.String width)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left, Center, or Right).
width - the width of the table expressed in pixels or as a percent ("80%")

Table

public Table(java.lang.String align,
             java.lang.String width,
             Color backgroundColor)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left, Center, or Right).
width - the width of the table expressed in pixels or as a percent ("80%")
backgroundColor - the colour name or HTML RGB colour.

Table

public Table(java.lang.String align,
             java.lang.String width,
             Color backgroundColor,
             int columns)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left, Center, or Right).
width - the width of the table expressed in pixels or as a percent ("80%")
backgroundColor - the colour name or HTML RGB colour.
columns - the number of columns in the table. When set, a new row will be automatically added as soon this number of columns is reached in a row.

Table

public Table(java.lang.String align,
             java.lang.String width,
             int columns)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left,Center, or Right).
width - the width of the table expressed in pixels or as a percent ("80%")
columns - the number of columns in the table. When set, a new row will be automatically added as soon this number of columns is reached in a row.

Table

public Table(java.lang.String align,
             java.lang.String width,
             int borderWidth,
             int cellPadding,
             int cellSpacing)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left, Center, or Right).
width - the width of the table expressed in pixels or as a percent ("80%")
borderWidth - the width of the table and cell borders, expressed in pixels.
cellPadding - the number of pixels between the edge of each cell and its contents.
cellSpacing - the number of pixels between adjacent cells and along the outer edges of the cells along the edges of the table.

Table

public Table(java.lang.String align,
             java.lang.String width,
             int borderWidth,
             int cellPadding,
             int cellSpacing,
             int columns)
Creates an HTML table.

Parameters:
align - the alignment of the table (Left, Center, or Right).
width - the width of the table expressed in pixels or as a percent ("80%")
borderWidth - the width of the table and cell borders, expressed in pixels.
cellPadding - the number of pixels between the edge of each cell and its contents.
cellSpacing - the number of pixels between adjacent cells and along the outer edges of the cells along the edges of the table.
columns - the number of columns in the table. When set, a new row will be automatically added as soon this number of columns is reached in a row.
Method Detail

add

public Traversable add(HTML htmlObject)
Description copied from class: Container
Adds an HTML object to the current container

Specified by:
add in interface Traversable
Overrides:
add in class Container
Parameters:
htmlObject - - the Object to add (eg. doc.add(new htmlBody);)
Returns:
the modified Container object;
See Also:
Container.add(org.pajes.html.HTML)

addBody

public Table.Body addBody()
Adds a new body section to the table.

Returns:
the newly created table body section.

addCell

public Table.Cell addCell(boolean content)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(java.lang.Boolean content)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(HTML content)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(HTML content,
                          int columnsToSpan)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
columnsToSpan - the number of columns this content should span.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(HTML content,
                          java.lang.String align)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
align - the horizontal alignment of the content within the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(HTML content,
                          java.lang.String align,
                          int columnsToSpan)
Adds a cell to the table.

Parameters:
content - the content to place in the next cell
align - the horizontal alignment of the content within the cell
columnsToSpan - the number of columns this content should span.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(int content)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(java.lang.String content)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(java.lang.String content,
                          boolean bold,
                          java.lang.String align)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
bold - if true, the content of the cell will be displayed in bold font.
align - the horizontal alignment of the content within the cell.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(java.lang.String content,
                          int columnsToSpan)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
columnsToSpan - the number of columns this content should span.
Returns:
the new Cell object.

addCell

public Table.Cell addCell(java.lang.String content,
                          java.lang.String align)
Adds a cell to the table.

Parameters:
content - the content to place in the cell.
align - the horizontal alignment of the content within the cell.
Returns:
the new Cell object.

addHeadingCell

public Table.Cell addHeadingCell(HTML headingContent)
Adds a heading cell to the table.

Parameters:
headingContent - The feature to be added to the HeadingCell attribute
Returns:
the new Cell object.

addHeadingCell

public Table.Cell addHeadingCell(HTML headingContent,
                                 int columnsToSpan)
Adds a heading cell to the table.

Parameters:
headingContent - The feature to be added to the HeadingCell attribute
columnsToSpan - the number of columns this content should span.
Returns:
the new Cell object.

addHeadingCell

public Table.Cell addHeadingCell(HTML headingContent,
                                 int columnsToSpan,
                                 int rowsToSpan)
Adds a heading cell to the table.

Parameters:
headingContent - The feature to be added to the HeadingCell attribute
columnsToSpan - the number of columns this content should span.
rowsToSpan - the number of rows this content should span.
Returns:
the new Cell object.

addHeadingCell

public Table.Cell addHeadingCell(java.lang.String headingContent)
Adds a heading cell to the table.

Parameters:
headingContent - The feature to be added to the HeadingCell attribute
Returns:
the new Cell object.

addHeadingCell

public Table.Cell addHeadingCell(java.lang.String headingContent,
                                 int columnsToSpan)
Adds a heading cell to the table.

Parameters:
headingContent - The feature to be added to the HeadingCell attribute
columnsToSpan - the number of columns this content should span.
Returns:
the new Cell object.

addHeadingCell

public Table.Cell addHeadingCell(java.lang.String headingContent,
                                 int columnsToSpan,
                                 int rowsToSpan)
Adds a heading cell to the table.

Parameters:
headingContent - The feature to be added to the HeadingCell attribute
columnsToSpan - the number of columns this content should span.
rowsToSpan - the number of rows this content should span.
Returns:
the new Cell object.

addRow

public Table.Row addRow()
Adds a row into the table, or if a table body has been added, then it is added to the last added body.

Returns:
the new Row object.

clone

public java.lang.Object clone()
Description copied from class: Container
Allows a tag to be cloned. Over-rides the clone() method in Tag to do a deep clone: all the objects contained in this object will be cloned individually.

Specified by:
clone in interface HTML
Overrides:
clone in class Container
Returns:
a clone of this Container.
See Also:
Object.clone()

currentCell

public Table.Cell currentCell()
Returns a reference to the cell just added, or null if no cells have been added.

Returns:
a reference to the cell just added, or null if no cells have been added. added.

currentRow

public Table.Row currentRow()
Returns a reference to the row just added, or null if no rows have been added.

Returns:
a reference to the row just added, or null if no rows have been added.

getCell

public Table.Cell getCell(int row,
                          int col)
Returns the reference to the cell at the specified row and column position within the table body.

Parameters:
row - the zero-based index of the row to access.
col - the zero-based index of the column to access on the specified row.
Returns:
the Cell.

getFooter

public Table.Foot getFooter()
Returns the footer section of the table. If it does not exist, it will be created before returning.

Returns:
the table footer section.

getHeader

public Table.Head getHeader()
Returns the header section of the table. If it does not exist, it will be created before returning.

Returns:
the table header section.

getLogicalCell

public Table.Cell getLogicalCell(int row,
                                 int col)
Returns the reference to the cell at the specified logical row and column position (taking into account colspan and rowspan settings) within the table body.

Parameters:
row - the zero-based index of the row to access.
col - the zero-based index of the column to access on the specified row.
Returns:
the Cell.

getLogicalCellMap

public Table.Cell[][] getLogicalCellMap(boolean fill)
Returns a two-dimensional Cell array containing the table cells in their logical positions.

Parameters:
fill - if true, cell instances may appear multiple times in the array, if they span multiple columns or rows. If false, cells that would logically be filled by an adjacent cell will be null.
Returns:
the Cell.

getMaxColumns

public int getMaxColumns()
Returns the maximum number of columns in each row of the table.

Returns:
the maximum number of columns in the table.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.String value)
Description copied from class: Tag
Adds a string attribute. The value will be trimmed and quoted.

Overrides:
setAttribute in class Tag
Parameters:
name - The attribute name.
value - The value of the attribute.
Returns:
the modified Tag instance.
See Also:
Tag.setAttribute(java.lang.String, java.lang.String)

setBackgroundImage

public Table setBackgroundImage(java.lang.String imageURL)
Sets the background image for the table.

Parameters:
imageURL - the URL of the background image.
Returns:
the modified Table object.

setBorderColor

public Table setBorderColor(Color color)
Sets the border colour for the table.

Parameters:
color - the colour name or HTML RGB colour.
Returns:
the modified Table object.

setBorderWidth

public Table setBorderWidth(int pixels)
Set the Border width for the table. A border width of zero (default) will make the table borders invisible.

Parameters:
pixels - the width of the border in pixels.
Returns:
the modified Table object.

setCellPadding

public Table setCellPadding(int pixels)
Cell Padding is the amount of empty space between the border of a table and the cell contents. Applies to the space inside a cell.

Parameters:
pixels - the number of pixels with which to pad the cells.
Returns:
the modified Table object.

setCellSpacing

public Table setCellSpacing(int pixels)
Cell spacing is the amount of empty space between the outer edge of each table cell.

Parameters:
pixels - the number of pixels with which to space the cells.
Returns:
the modified Table object.

setMaxColumns

public Table setMaxColumns(int columns)
Sets the maximum number of columns in each row of the table. If this method is called, automatic calculation of the maximum number of columns in the table is turned off.

Parameters:
columns - the number of columns in the table. When set, a new row will be automatically added as soon this number of columns is reached in a row.
Returns:
the modified Table object.

setSummary

public Table setSummary(java.lang.String summary)
Sets the table summary, which is used to aid non-visual browsers in displaying the table.

Parameters:
summary - the summary to set for the table.
Returns:
the modified Table object.

write

public void write(Browser browser)
           throws java.io.IOException
Description copied from class: Tag
Writes the tag to the browser.

Specified by:
write in interface HTML
Overrides:
write in class Tag
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an I/O error occurs writing to the browser.
See Also:
Tag.setWriteEndTag(boolean), Tag.writeContent(org.pajes.servlet.Browser)

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.