jimm.datavision
Class Subreport

java.lang.Object
  extended by jimm.datavision.Report
      extended by jimm.datavision.Subreport
All Implemented Interfaces:
Identity, Nameable, Writeable

public class Subreport
extends Report
implements Identity

A subreport is a report whose query is run every time the field containing it is output.

When first created, the subreport adds the joins given to it to its SQL where clause, turning the columns from the current report into parameters.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  java.lang.String cachedValue
           
protected  java.lang.Long id
           
protected  Report parentReport
           
 
Fields inherited from class jimm.datavision.Report
aggregateFields, askedForParameters, author, caseSensitiveDatabaseNames, databasePassword, dataSource, defaultField, description, details, formulas, groups, layoutEngine, name, OUTPUT_DTD_VERSION, pageFooters, pageHeaders, paperFormat, parameters, parametersHaveValues, paramReader, paramsSetManually, reportFooters, reportHeaders, rset, scripting, startFormula, subreports, title, usercols, XML_ENCODING_ATTRIBUTE, XML_JAVA_ENCODING
 
Constructor Summary
Subreport(Report parent, java.lang.Long id)
           
 
Method Summary
 void addAllJoins(java.util.Collection coll)
           
 void addJoin(Join join)
           
 void clearCache()
           
 java.lang.Object getId()
          Returns the identity.
 Report getParentReport()
           
 java.lang.Object getValue()
          Runs the query and returns a string containing a line of text for each row returned by the subreport query.
protected  java.util.Collection makeRowStrings()
          Returns an array of strings, each containing the values returned by the subreport query separated by spaces.
 java.util.Iterator parentColumns()
          Returns an iterator over all of the columns that need to be included in the parent report's query so that the values are available to this subreport when it builds its query.
 void writeXML(XMLWriter out)
          Writes the contents of this report as an XML file.
 
Methods inherited from class jimm.datavision.Report
add, addFormula, addGroup, addParameter, addSubreport, addUserColumn, askForDataSourceFile, askForParameters, askForPassword, caseSensitiveDatabaseNames, collectAggregateFields, collectUsedParameters, columnValue, contains, contains, containsReferenceTo, containsReferenceTo, containsReferenceTo, containsReferenceTo, countGroups, details, eval, evaluateFormulasIn, findColumn, findField, findFormula, findFormulaByName, findGroup, findGroup, findParameter, findParameterByName, findSelectable, findSubreport, findUserColumn, findUserColumnByName, footers, formulas, generateNewFormulaId, generateNewId, generateNewParameterId, generateNewSubreportId, generateNewUserColumnId, getAggregateFieldsFor, getAuthor, getCurrentRow, getDataSource, getDefaultField, getDescription, getDesignFrame, getFirstSectionByArea, getName, getPaperFormat, getParameterValue, getScripting, getSectionArea, getSectionLocation, getStartFormula, getTitle, groups, groupsReversed, hasDataSource, hasFields, hasGroups, hasParameterFields, headers, initializeSections, innermostGroup, insertSectionBelow, insertSectionBelow, isInsideGroup, isOneOfAKind, isUsedBySomeGroup, pageFooters, pageHeaders, pageNumber, parameters, parametersSetManually, processResultRow, read, read, reinsertSection, reloadColumns, remove, removeAllGroups, removeField, removeFormula, removeGroup, removeParameter, removeSection, removeSubreport, removeUserColumn, resetCachedValues, rowNumber, run, runReport, sectionContaining, setAuthor, setCaseSensitiveDatabaseNames, setDatabaseConnection, setDatabasePassword, setDataSource, setDescription, setLayoutEngine, setName, setPaperFormat, setParameterXMLInput, setParameterXMLInput, setStartFormula, setTitle, subreports, updateAggregates, updateGroupCounters, updateGroups, userColumns, value, withFieldsDo, withSectionsDo, writeComment, writeDescription, writeFile, writePage, writeReport, writeStartFormula, writeXMLDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentReport

protected Report parentReport

id

protected java.lang.Long id

cachedValue

protected java.lang.String cachedValue
Constructor Detail

Subreport

public Subreport(Report parent,
                 java.lang.Long id)
Method Detail

getId

public java.lang.Object getId()
Description copied from interface: Identity
Returns the identity.

Specified by:
getId in interface Identity

getParentReport

public Report getParentReport()

addJoin

public void addJoin(Join join)

addAllJoins

public void addAllJoins(java.util.Collection coll)

parentColumns

public java.util.Iterator parentColumns()
Returns an iterator over all of the columns that need to be included in the parent report's query so that the values are available to this subreport when it builds its query.

Returns:
an iterator over selectables

clearCache

public void clearCache()

getValue

public java.lang.Object getValue()
Runs the query and returns a string containing a line of text for each row returned by the subreport query.

Returns:
a string with newlines separating each row of data
See Also:
makeRowStrings()

makeRowStrings

protected java.util.Collection makeRowStrings()
Returns an array of strings, each containing the values returned by the subreport query separated by spaces.


writeXML

public void writeXML(XMLWriter out)
Description copied from class: Report
Writes the contents of this report as an XML file.

Specified by:
writeXML in interface Writeable
Overrides:
writeXML in class Report
Parameters:
out - an indent writer