com.azalient.api.file.table
Class ResultsTableAdapter

java.lang.Object
  extended by com.azalient.api.file.table.ResultsTableAdapter
All Implemented Interfaces:
ITable, ITableType, ResultsTable, Table, TableW

public class ResultsTableAdapter
extends Object
implements ResultsTable

This adapter allows the creation of a results table from any table implementing TableW


Constructor Summary
ResultsTableAdapter(IResultsPage page, TableW tableW)
          Create a new results table on the given page
 
Method Summary
 Object[] colNameObjects()
          Return an array of all column name objects.
 String columnName(Object nameObj)
          Map a column name object to a printable name.
 void destroy()
          Called when the table is no longer required, to discard references held in the table, for example to the parent page
 void finishedW(PageW page)
          The writer is finished
 CellF format(Object col, int row)
          Return the format for (column, row) cell.
 int headerRows()
          The number of header rows in this table.
 Class[] keyTypes()
          The type and number of key columns in this table.
 void newPage(IPage newPage)
          Move this table to a new page
 void newResultsPage(IResultsPage page)
          Move this table to be included in the given page.
 IPage page()
          The page to which this table belongs
 String pageName()
          The name of the page on which this table is found
 PageType pageType()
           
 RecordW[] recordArray()
          Return an array all records.
 IResultsPage resultsPage()
          A reference to the results page that contains this table
 boolean save()
          save the table to current open file
 void save(SavingStatus ss)
          save the table to current open file
 String tableName()
           
 int width(Object col)
          Set the width of a column, return -1 to get default width
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultsTableAdapter

public ResultsTableAdapter(IResultsPage page,
                           TableW tableW)
Create a new results table on the given page

Parameters:
page - the results page that will hold the table
tableW - the table of data used to create the results table.
Method Detail

newResultsPage

public void newResultsPage(IResultsPage page)
Description copied from interface: ResultsTable
Move this table to be included in the given page. If pages are saved periodically, this can be used to move a growing table of data to the latest page of results.

Specified by:
newResultsPage in interface ResultsTable

resultsPage

public IResultsPage resultsPage()
Description copied from interface: ResultsTable
A reference to the results page that contains this table

Specified by:
resultsPage in interface ResultsTable

columnName

public String columnName(Object nameObj)
Description copied from interface: TableW
Map a column name object to a printable name. The object may be a string and may just be the name, but this part of the interface allows you to use integers or other objects for better performance, which might be important on large pages.

Specified by:
columnName in interface TableW
Parameters:
nameObj - the column key, which may be the same as the name

format

public CellF format(Object col,
                    int row)
Description copied from interface: TableW
Return the format for (column, row) cell. Null means appply default format

Specified by:
format in interface TableW
Parameters:
col - The key specifying the column of the cell to be formatted
row - The row index for the cell to be formatted
Returns:
the cell format, which can be null

recordArray

public RecordW[] recordArray()
Description copied from interface: TableW
Return an array all records. Each record is then queried (in sequential order) to extract the data from each field. The data in each field should be one of the primitive types described in RecordW

Specified by:
recordArray in interface TableW
Returns:
An array of all records, giving access to each field

save

public boolean save()
Description copied from interface: TableW
save the table to current open file

Specified by:
save in interface TableW

width

public int width(Object col)
Description copied from interface: TableW
Set the width of a column, return -1 to get default width

Specified by:
width in interface TableW

headerRows

public int headerRows()
Description copied from interface: Table
The number of header rows in this table. Must be at least one, but can be more.

Specified by:
headerRows in interface Table

keyTypes

public Class[] keyTypes()
Description copied from interface: Table
The type and number of key columns in this table. There must be at least one key column, and exactly one is common, but it may be more.

If you create a table/object definition with more than one key column, and the uniqueness of the name depends on the key columns after the first, then the name() function should return a concatenation of the key column objects otherwise the lookup() function will fail, the objects which have the same first column value but differ in the others will not be added to the store, as they will appear to be duplicate entries.

See TypeObject.keyString(Object[])

See IRecord.name()

Specified by:
keyTypes in interface Table

page

public IPage page()
Description copied from interface: ITable
The page to which this table belongs

Specified by:
page in interface ITable

pageName

public String pageName()
Description copied from interface: ITable
The name of the page on which this table is found

Specified by:
pageName in interface ITable

colNameObjects

public Object[] colNameObjects()
Description copied from interface: ITableType
Return an array of all column name objects. The order in which they are presented defines the order in which the columns will be written to an output file.

Specified by:
colNameObjects in interface ITableType
Returns:
an array of column name objects

pageType

public PageType pageType()
Specified by:
pageType in interface ITableType

tableName

public String tableName()
Specified by:
tableName in interface ITableType

finishedW

public void finishedW(PageW page)
Description copied from interface: TableW
The writer is finished

Specified by:
finishedW in interface TableW

newPage

public void newPage(IPage newPage)
Description copied from interface: TableW
Move this table to a new page

Specified by:
newPage in interface TableW

save

public void save(SavingStatus ss)
Description copied from interface: TableW
save the table to current open file

Specified by:
save in interface TableW

destroy

public void destroy()
Description copied from interface: Table
Called when the table is no longer required, to discard references held in the table, for example to the parent page

Specified by:
destroy in interface Table