org.jcon.text
Class IteratingReportEngine

java.lang.Object
  extended by org.jcon.text.AbstractReportEngine
      extended by org.jcon.text.IteratingReportEngine
All Implemented Interfaces:
java.io.Serializable, TextReportEngine

public class IteratingReportEngine
extends AbstractReportEngine

A TextReportEngine that iterates through a list of objects and applies a subreport to each. Headers, footers, betweens, and empty conditions are all supported.

Author:
Paul Reavis
See Also:
Serialized Form

Constructor Summary
IteratingReportEngine()
           
 
Method Summary
 java.lang.String getBetween()
          Something to go in between each iteration.
 java.util.Comparator getComparer()
          A sorting object, for example a {link org.jcon.data.NumericPrefixComparer NumericPrefixComparer} or {link org.jcon.data.PropertyComparer PropertyComparer}.
 java.lang.String getFooter()
          Something for the bottom of this report or section.
 java.lang.String getHeader()
          Something for the top of this report or section.
 java.lang.String getIfEmptyText()
          If this text is non-null and iteration is empty, just prints this text instead of going through the iteration.
 int getLimit()
           
 boolean getSkipIfEmpty()
          Deprecated.  
 java.lang.String getSpacer()
          Text used to fill out rest of iteration if "limit" property is non-null and is higher than the number of objects in the source list.
 TextReportEngine getSubReport()
          The report engine to run on each object iterated.
 void setBetween(java.lang.String newBetween)
          Something to go in between each iteration.
 void setComparer(java.util.Comparator newComparer)
           
 void setFooter(java.lang.String newFooter)
          Something for the bottom of this report or section.
 void setHeader(java.lang.String newHeader)
          Something for the top of this report or section.
 void setIfEmptyText(java.lang.String newText)
           
 void setLimit(int newLimit)
          Sets the limit on number of iterations.
 void setSkipIfEmpty(boolean tizit)
           
 void setSpacer(java.lang.String newSpacer)
           
 void setSubReport(TextReportEngine newReport)
           
 void writeReport(java.lang.Object source, java.io.PrintWriter printy)
          Generates and writes a report based on the provided source object.
 
Methods inherited from class org.jcon.text.AbstractReportEngine
generateReportFor, writeReport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratingReportEngine

public IteratingReportEngine()
Method Detail

writeReport

public void writeReport(java.lang.Object source,
                        java.io.PrintWriter printy)
Generates and writes a report based on the provided source object. It iterates through the object's elements, then calls super.generateReportFor() on each and concatenates them.

Specified by:
writeReport in class AbstractReportEngine

getHeader

public java.lang.String getHeader()
Something for the top of this report or section.


setHeader

public void setHeader(java.lang.String newHeader)
Something for the top of this report or section.


getBetween

public java.lang.String getBetween()
Something to go in between each iteration.


setBetween

public void setBetween(java.lang.String newBetween)
Something to go in between each iteration.


getFooter

public java.lang.String getFooter()
Something for the bottom of this report or section.


setFooter

public void setFooter(java.lang.String newFooter)
Something for the bottom of this report or section.


getSubReport

public TextReportEngine getSubReport()
The report engine to run on each object iterated.


setSubReport

public void setSubReport(TextReportEngine newReport)

getComparer

public java.util.Comparator getComparer()
A sorting object, for example a {link org.jcon.data.NumericPrefixComparer NumericPrefixComparer} or {link org.jcon.data.PropertyComparer PropertyComparer}. Used to sort the items in the list.


setComparer

public void setComparer(java.util.Comparator newComparer)

setLimit

public void setLimit(int newLimit)
Sets the limit on number of iterations. Zero means no limit. Used when you want it to iterate a certain number of times. If too many objects are in the list, the remaining ones are ignored. If there are not enough, the remaining spaces are filled with text supplied by the "spacer" property.


getLimit

public int getLimit()

getSpacer

public java.lang.String getSpacer()
Text used to fill out rest of iteration if "limit" property is non-null and is higher than the number of objects in the source list.


setSpacer

public void setSpacer(java.lang.String newSpacer)

getSkipIfEmpty

public boolean getSkipIfEmpty()
Deprecated. 

If true, skips the whole mess if the thing is null or has no elements. Deprecated; use ifEmptyText property instead.


setSkipIfEmpty

public void setSkipIfEmpty(boolean tizit)

getIfEmptyText

public java.lang.String getIfEmptyText()
If this text is non-null and iteration is empty, just prints this text instead of going through the iteration. Handy for "None found." - type behavior. If set to an empty string ("") then engine behaves as if skipIfEmpty were set to true.


setIfEmptyText

public void setIfEmptyText(java.lang.String newText)