jimm.datavision.source.object
Class ObjectSource

java.lang.Object
  extended by jimm.datavision.source.DataSource
      extended by jimm.datavision.source.object.ObjectSource
All Implemented Interfaces:
Writeable

public class ObjectSource
extends DataSource

Provides the classes and interfaces that make up the a data source that uses an ArrayList of ArrayLists representing a table of data. See the ObjectSourceTest.java in the examples directory for usage example.

Author:
Frank W. Zammetti, fzammetti@omnytex.com

Field Summary
protected  java.util.ArrayList columns
           
 
Fields inherited from class jimm.datavision.source.DataSource
metadataURL, query, report
 
Constructor Summary
ObjectSource(Report report, java.util.ArrayList inData)
          Constructor.
 
Method Summary
 void addColumn(Column col)
          This override not only remembers the column but also hands it to the query for cacheing.
 boolean areRecordsSelectable()
          Used to enable/disable the "Select Records" menu item.
 boolean areRecordsSortable()
          Used to enable/disable the "Sort By" menu item.
 boolean canGroupRecords()
          Used to enable/disable the "Group By" menu item.
 boolean canJoinTables()
          Used to enable/disable the "Table Linker" menu item.
 java.util.Iterator columns()
          Returns an iterator over all columns.
protected  void doWriteXML(XMLWriter out)
          Writes this database and all its tables as an XML tag.
 DataCursor execute()
           
 Column findColumn(java.lang.Object id)
          Given an id (a column name), returns the column that has that id.
 java.util.ArrayList getData()
          Return the ArrayList of data this data source contains.
 int indexOfSelectable(Selectable sel)
          Returns the index of the specified selectable.
 boolean isConnectionEditable()
          Used to enable/disable the "Connection" menu item.
 boolean isSQLGenerated()
          Used to enable/disable the "SQL Query Text" menu item.
 java.util.Iterator tables()
          Returns an iterator over all tables, or null if the data source does not have tables (for example, a character-separated file data source).
 java.util.Iterator tablesUsedInReport()
          Returns an iterator over all tables actually used in the report, or null if the data source does not have tables (for example, a character-separated file data source).
 boolean usesSourceFile()
          Returns true if this data source uses a file to retrieve data.
 
Methods inherited from class jimm.datavision.source.DataSource
alreadyUsedSourceFile, canRunReports, columnsInTablesUsedInReport, containsReferenceTo, getQuery, getReport, getSourceFile, needsSourceFile, readMetadataFrom, reloadColumns, removeSort, reuseSourceFile, setSourceFile, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columns

protected java.util.ArrayList columns
Constructor Detail

ObjectSource

public ObjectSource(Report report,
                    java.util.ArrayList inData)
Constructor.

Parameters:
report - The Report object that uses this data source.
inData - An ArrayList of ArrayLists that is the data this data source is to use.
Method Detail

canJoinTables

public boolean canJoinTables()
Description copied from class: DataSource
Used to enable/disable the "Table Linker" menu item.

Specified by:
canJoinTables in class DataSource
Returns:
true if the "Table Linker" menu item should be enabled.

isSQLGenerated

public boolean isSQLGenerated()
Description copied from class: DataSource
Used to enable/disable the "SQL Query Text" menu item.

Specified by:
isSQLGenerated in class DataSource
Returns:
true if the "SQL Query Text" menu item should be enabled.

isConnectionEditable

public boolean isConnectionEditable()
Description copied from class: DataSource
Used to enable/disable the "Connection" menu item.

Specified by:
isConnectionEditable in class DataSource
Returns:
true if the "Connection" menu item should be enabled.

areRecordsSelectable

public boolean areRecordsSelectable()
Description copied from class: DataSource
Used to enable/disable the "Select Records" menu item.

Specified by:
areRecordsSelectable in class DataSource
Returns:
true if the "Select Records" menu item should be enabled.

areRecordsSortable

public boolean areRecordsSortable()
Description copied from class: DataSource
Used to enable/disable the "Sort By" menu item.

Specified by:
areRecordsSortable in class DataSource
Returns:
true if the "Sort By" menu item should be enabled.

canGroupRecords

public boolean canGroupRecords()
Description copied from class: DataSource
Used to enable/disable the "Group By" menu item.

Specified by:
canGroupRecords in class DataSource
Returns:
true if the "Group By" menu item should be enabled.

usesSourceFile

public boolean usesSourceFile()
Description copied from class: DataSource
Returns true if this data source uses a file to retrieve data. The default implementation returns false.

Overrides:
usesSourceFile in class DataSource
Returns:
true if this data source uses a file to retrieve data

addColumn

public void addColumn(Column col)
This override not only remembers the column but also hands it to the query for cacheing.

Overrides:
addColumn in class DataSource
Parameters:
col - a column

getData

public java.util.ArrayList getData()
Return the ArrayList of data this data source contains.

Returns:
The ArrayList of data passed to the data source during construction.

findColumn

public Column findColumn(java.lang.Object id)
Given an id (a column name), returns the column that has that id. If no column with the specified id exists, returns null. Uses Table.findColumn.

Specified by:
findColumn in class DataSource
Parameters:
id - a column id
Returns:
a column, or null if no column with the specified id exists
See Also:
Table.findColumn(java.lang.Object)

indexOfSelectable

public int indexOfSelectable(Selectable sel)
Description copied from class: DataSource
Returns the index of the specified selectable.

Overrides:
indexOfSelectable in class DataSource
Parameters:
sel - a selectable

tables

public java.util.Iterator tables()
Description copied from class: DataSource
Returns an iterator over all tables, or null if the data source does not have tables (for example, a character-separated file data source).

Specified by:
tables in class DataSource
Returns:
a possibly null iterator over all tables

tablesUsedInReport

public java.util.Iterator tablesUsedInReport()
Description copied from class: DataSource
Returns an iterator over all tables actually used in the report, or null if the data source does not have tables (for example, a character-separated file data source).

Specified by:
tablesUsedInReport in class DataSource
Returns:
a possibly null iterator over all tables used in the report

columns

public java.util.Iterator columns()
Description copied from class: DataSource
Returns an iterator over all columns.

Specified by:
columns in class DataSource
Returns:
an iterator over all columns

execute

public DataCursor execute()
Specified by:
execute in class DataSource

doWriteXML

protected void doWriteXML(XMLWriter out)
Writes this database and all its tables as an XML tag.

Specified by:
doWriteXML in class DataSource
Parameters:
out - a writer that knows how to write XML