com.sas.servlet.beans
Interface TableInterface

All Known Implementing Classes:
BaseTable

public interface TableInterface
extends TableWriterInterface, TransformationInterface

Convenience interface for creating 2-dimensional tables. TableInterface can be used to automate this task. It can also be used to write the contents of a data table to output, row by row.


Method Summary
 String getBeginRowFormat()
          Gets the format to begin a new table row
 int getBorderWidth()
          Gets the width of the outer border around the table.
 int getCellPadding()
          Gets the number of pixels between the border of a cell and the cell's contents.
 int getCellSpacing()
          Gets the number of pixels between the border of each cell.
 String getColumnFormat()
          Gets the format to be applied to each data element in a row.
 String getColumnFormat(int index)
          Gets the format to be applied to a single data element in a row.
 String getColumnFormat(int columnIndex, long rowIndex)
          Gets the format to be applied to a single data element in the given row.
 String getColumnHeadingColumnFormat()
          Gets the format to be applied to each column heading column
 String getColumnHeadingColumnFormat(int index)
          Gets the format to be applied to a single column heading column.
 String getColumnHeadingFormat()
          Gets the format for the column heading row.
 String getDefaultBeginRowFormat()
          Gets the default format to begin a new table row.
 String getDefaultColumnFormat()
          Gets the default format to be applied to each data element in a row.
 String getDefaultColumnHeadingFormat()
          Gets the default format to be applied to each column heading column.
 String getDefaultEndRowFormat()
          Gets the default format to end a table row.
 String getEndRowFormat()
          Gets the format to end table row
 long getMaxRows()
          Gets the maximum number of rows to be formatted when writing a table.
 String getRowFormat()
          Gets the format for each row in the table.
 String getRowFormat(long index)
          Gets the format for the given row in the table.
 boolean getUseColumnHeadings()
          Returns true if column headings should be written.
 int getWidth()
          Gets the width of the table in pixels.
 int getWidthPercentage()
          Gets the width of the table as a percentage
 boolean isLastWriteTruncated()
          Determines if the last writing of a table exceeded the maximum number of rows.
 void setBeginRowFormat(String format)
          Sets the format to begin a new table row
 void setBorderWidth(int border)
          Sets the width of the outer border around the table in pixels.
 void setCellPadding(int padding)
          Sets the number of pixels between the border of a cell and the cell's contents.
 void setCellSpacing(int spacing)
          Sets the number of pixels between the border of each cell.
 void setColumnFormat(String format)
          Sets the format to be applied to each data element in a row.
 void setColumnFormat(String format, int index)
          Sets the format to be applied to an individual data element in a row.
 void setColumnFormat(String format, int index, int repeatColumn)
          Sets the format to be applied to an individual data element in a row.
 void setColumnFormat(String format, int index, int repeatColumn, long startingRow, int repeatRow)
          Sets the format to be applied to an individual data element in the given row.
 void setColumnFormat(String format, int index, long startingRow, int repeatRow)
          Sets the format to be applied to an individual data element in the given row.
 void setColumnHeadingColumnFormat(String format)
          Sets the format to be applied to each column heading column.
 void setColumnHeadingColumnFormat(String format, int index)
          Sets the format to be applied to a single column heading column.
 void setColumnHeadingFormat(String format)
          Sets the format for the column heading row.
 void setEndRowFormat(String format)
          Sets the format to end a table row
 void setMaxRows(long n)
          Sets the maximum number of rows to be formatted when writing a table.
 void setRowFormat(String format)
          Sets the format for each row in the table.
 void setRowFormat(String format, long startingRow, int repeatRow)
          Sets the format for a given 1-based row number in the table.
 void setUseColumnHeadings(boolean enable)
          Turns on/off the use of column headings.
 void setWidth(int pixels)
          Sets the width of the table in pixels.
 void setWidthPercentage(int width)
          Sets the width of the table as a percentage
 void writeColumnHeadings(PrintWriter out)
          Writes the column headings
 void writeRow(long row, PrintWriter out)
          Writes a single row of the formatted table.
 void writeTableFooter(PrintWriter out)
          Writes the table footer
 void writeTableHeader(PrintWriter out)
          Writes the table header
 
Methods inherited from interface com.sas.servlet.beans.TableWriterInterface
writeColumnHeadings, writeColumnHeadings, writeRow, writeRow, writeTableFooter, writeTableFooter, writeTableHeader, writeTableHeader
 

Method Detail

setWidth

public void setWidth(int pixels)
Sets the width of the table in pixels.
Parameters:
width - The width in pixels

getWidth

public int getWidth()
Gets the width of the table in pixels.
Returns:
The width in pixels

setWidthPercentage

public void setWidthPercentage(int width)
Sets the width of the table as a percentage
Parameters:
width - The width as a percentage

getWidthPercentage

public int getWidthPercentage()
Gets the width of the table as a percentage
Returns:
The width as a percentage

setBorderWidth

public void setBorderWidth(int border)
Sets the width of the outer border around the table in pixels. The default is 0.
Parameters:
border - The border width in pixels

getBorderWidth

public int getBorderWidth()
Gets the width of the outer border around the table.
Returns:
The border width in pixels

setCellSpacing

public void setCellSpacing(int spacing)
Sets the number of pixels between the border of each cell. The default is 1.
Parameters:
spacing - The number of pixels between each cell

getCellSpacing

public int getCellSpacing()
Gets the number of pixels between the border of each cell.
Returns:
The number of pixels between each cell

setCellPadding

public void setCellPadding(int padding)
Sets the number of pixels between the border of a cell and the cell's contents. The default is 0.
Parameters:
padding - The number of pixels between the cell border and the cell content

getCellPadding

public int getCellPadding()
Gets the number of pixels between the border of a cell and the cell's contents.
Returns:
The number of pixels between the cell border and the cell content

setMaxRows

public void setMaxRows(long n)
Sets the maximum number of rows to be formatted when writing a table. A value of -1 indicates no maximum
Parameters:
max - The maximum number of rows

getMaxRows

public long getMaxRows()
Gets the maximum number of rows to be formatted when writing a table.
Returns:
The maximum number of rows, or -1 for unlimited

isLastWriteTruncated

public boolean isLastWriteTruncated()
Determines if the last writing of a table exceeded the maximum number of rows.
Returns:
true if the table was truncated

setRowFormat

public void setRowFormat(String format)
Sets the format for each row in the table. The exact details of the format are implementation-specific. Tags can be used as markers for variable data read out of a database table. Markers can supply either a column name, such as #NAME#, or a 0-based column index, such as #1#. Database meta data can be used with the markers #META_NAME <column>#, #META_LABEL <column>#, and #META_LENGTH <column>#. Setting the rowFormat will override the columnFormat.
Parameters:
format - The format string

getRowFormat

public String getRowFormat()
Gets the format for each row in the table. null indicates that a columnFormat is being used
Returns:
The format string

setRowFormat

public void setRowFormat(String format,
                         long startingRow,
                         int repeatRow)
Sets the format for a given 1-based row number in the table. This method also allows the format to be repeated every 'n' rows. Setting the rowFormat for a row will override the global format set by setRowFormat(String format). If a conflict exists when repeating rows (mulitple setRowFormat calls apply to the same row), the first format that was set will be applied.
Parameters:
format - The format string, or null to remove the format
startingRow - The 1-based row number that will first use the format
repeatRow - The number of rows until the format is repeated, or -1 for no repeating.

getRowFormat

public String getRowFormat(long index)
Gets the format for the given row in the table. null indicates that no format was specified for the specific row; getRowFormat() can be used to query whether a global row format was set.
Parameters:
index - The 1-based row index
Returns:
The format string

setBeginRowFormat

public void setBeginRowFormat(String format)
Sets the format to begin a new table row
Parameters:
The - format string

getBeginRowFormat

public String getBeginRowFormat()
Gets the format to begin a new table row
Returns:
The format string

setColumnFormat

public void setColumnFormat(String format)
Sets the format to be applied to each data element in a row. Use regular parameter markers with no name or index to indicate the location of the data (such as ##, or #META_NAME#). Setting the columnFormat will override the rowFormat.
Parameters:
format - The format string to be applied to each data element

setColumnFormat

public void setColumnFormat(String format,
                            int index)
Sets the format to be applied to an individual data element in a row. Use regular parameter markers with no name or index to indicate the location of the data (such as ##, or #META_NAME#). Only valid if the rowFormat is not currently in use.
Parameters:
format - The format string to be applied to a single data element, or null to remove the format
index - The 1-based column index, or -1 for all columns

setColumnFormat

public void setColumnFormat(String format,
                            int index,
                            int repeatColumn)
Sets the format to be applied to an individual data element in a row. This method also allows the format to be repeated every 'n' columns. Only valid if the rowFormat is not currently in use.
Parameters:
format - The format string to be applied to a single data element, or null to remove the format
index - The 1-based column index that will first use the format
repeatColumn - The number of columns until the format is repeated, or -1 for no repeating

setColumnFormat

public void setColumnFormat(String format,
                            int index,
                            long startingRow,
                            int repeatRow)
Sets the format to be applied to an individual data element in the given row. This method also allows the format to be repeated every 'n' rows. Only valid if the rowFormat is not currently in use.
Parameters:
format - The format string to be applied to a single data element, or null to remove the format
index - The 1-based column index or -1 for all columns
startingRow - The 1-based row number that will first use the format
repeatRow - The number of rows until the format is repeated, or -1

setColumnFormat

public void setColumnFormat(String format,
                            int index,
                            int repeatColumn,
                            long startingRow,
                            int repeatRow)
Sets the format to be applied to an individual data element in the given row. This method also allows the format to be repeated every 'n' columns and every 'n' rows. Only valid if the rowFormat is not currently in use.
Parameters:
format - The format string to be applied to a single data element, or null to remove the format
index - The 1-based column index or -1 for all columns
repeatColumn - The number of columns until the format is repeated, or -1 for no repeating
startingRow - The 1-based row number that will first use the format
repeatRow - The number of rows until the format is repeated, or -1 for no repeating

getColumnFormat

public String getColumnFormat()
Gets the format to be applied to each data element in a row.
Returns:
The format string

getColumnFormat

public String getColumnFormat(int index)
Gets the format to be applied to a single data element in a row. Returns null if a format has not been applied to the given column.
Parameters:
index - The 1-based column index
Returns:
The format string

getColumnFormat

public String getColumnFormat(int columnIndex,
                              long rowIndex)
Gets the format to be applied to a single data element in the given row. Returns null if a format has not been applied to the given column.
Parameters:
columnIndex - The 1-based column index
rowIndex - The 1-based row index
Returns:
The format string

setEndRowFormat

public void setEndRowFormat(String format)
Sets the format to end a table row
Parameters:
The - format string

getEndRowFormat

public String getEndRowFormat()
Gets the format to end table row
Returns:
The format string

getDefaultBeginRowFormat

public String getDefaultBeginRowFormat()
Gets the default format to begin a new table row.
Returns:
The default begin row format

getDefaultColumnFormat

public String getDefaultColumnFormat()
Gets the default format to be applied to each data element in a row. Use regular parameter markers with no name or index to indicate the location of the data (such as ##, or #META_NAME#)
Returns:
The default data format

getDefaultEndRowFormat

public String getDefaultEndRowFormat()
Gets the default format to end a table row.
Returns:
The default end row format

getDefaultColumnHeadingFormat

public String getDefaultColumnHeadingFormat()
Gets the default format to be applied to each column heading column. Use regular parameter markers with no name or index to indicate the location of the meta data (such as #META_NAME#)
Returns:
The default column heading column format

setColumnHeadingColumnFormat

public void setColumnHeadingColumnFormat(String format)
Sets the format to be applied to each column heading column. Use regular parameter markers with no name or index to indicate the location of the meta data (such as #META_NAME#). Setting the columnHeadingColumnFormat will override the columnHeadingFormat.
Parameters:
The - column heading column format

setColumnHeadingColumnFormat

public void setColumnHeadingColumnFormat(String format,
                                         int index)
Sets the format to be applied to a single column heading column. Use regular parameter markers with no name or index to indicate the location of the meta data (such as #META_NAME#). Only valid if the rowFormat is not currently in use
Parameters:
The - column heading column format to be applied to a single column, or null to remove the format
index - The 1-based column index

getColumnHeadingColumnFormat

public String getColumnHeadingColumnFormat()
Gets the format to be applied to each column heading column
Returns:
The column heading column format

getColumnHeadingColumnFormat

public String getColumnHeadingColumnFormat(int index)
Gets the format to be applied to a single column heading column. Returns null if a format has not been applied to the given column
Parameters:
index - The 1-based column index
Returns:
The column heading column format

setColumnHeadingFormat

public void setColumnHeadingFormat(String format)
Sets the format for the column heading row.
Parameters:
The - column heading format

getColumnHeadingFormat

public String getColumnHeadingFormat()
Gets the format for the column heading row.
Returns:
The column heading format

setUseColumnHeadings

public void setUseColumnHeadings(boolean enable)
Turns on/off the use of column headings. The default is false.
Parameters:
enable - true if headings should be written

getUseColumnHeadings

public boolean getUseColumnHeadings()
Returns true if column headings should be written.
Parameters:
true - if headings should be written

writeRow

public void writeRow(long row,
                     PrintWriter out)
              throws IOException
Writes a single row of the formatted table. The data from the current row in the database will be used.
Parameters:
row - The 1-based row number to write
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeColumnHeadings

public void writeColumnHeadings(PrintWriter out)
                         throws IOException
Writes the column headings
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableHeader

public void writeTableHeader(PrintWriter out)
                      throws IOException
Writes the table header
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs

writeTableFooter

public void writeTableFooter(PrintWriter out)
                      throws IOException
Writes the table footer
Parameters:
out - The output stream
Throws:
IOException - Thrown if some type of I/O error occurs


Version: 1.2.20000317.001 Formatted: 2000/07/06 15:57:33PM