com.jcoverage.reporting
Class AbstractLine

java.lang.Object
  extended bycom.jcoverage.reporting.AbstractLine
All Implemented Interfaces:
Closeable, Line
Direct Known Subclasses:
JavaFileLine, OverallSummaryLine, ReportSummaryPackageLine

public class AbstractLine
extends java.lang.Object
implements Line

This class provides a skeletal implementation of a Line. Subclasses should override the instantiateDetailPage() method if the line provides a deeper detail page.


Field Summary
(package private)  LineCategory category
           
(package private)  Page detailPage
           
(package private)  java.util.Map fieldsByColumn
           
(package private) static org.apache.log4j.Logger logger
           
(package private)  Page owner
           
(package private)  Report report
           
(package private)  int state
           
 
Constructor Summary
AbstractLine()
           
 
Method Summary
protected  void assertValidColumnForCategory(Column column)
           
 void close()
          Call this method when you are done adding detail.
 Page getDetailPage()
          Get the detail page if one exists.
 java.lang.Object getField(Column column)
          Get the field value for a given column.
 Page getOwner()
           
protected  Page instantiateDetailPage()
          Subclasses should override this method if the line has information in a detail page.
 boolean isClosed()
           
 Page openDetailPage()
          This method signifies more detail is available for this line in a separate page.
 void setCategory(LineCategory category)
          Instances of this class should record their category if they want to validate values of fields set with the setField() methods.
 void setField(Column column, boolean value)
           
 void setField(Column column, double value)
           
 void setField(Column column, int value)
           
 void setField(Column column, java.lang.Object value)
          Set a piece of information against this line.
 void setOwner(Page owner)
          Set the page that own's this line, in other words, the master page.
 void setReport(Report report)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger

report

Report report

owner

Page owner

detailPage

Page detailPage

category

LineCategory category

fieldsByColumn

java.util.Map fieldsByColumn

state

int state
Constructor Detail

AbstractLine

public AbstractLine()
Method Detail

openDetailPage

public Page openDetailPage()
Description copied from interface: Line
This method signifies more detail is available for this line in a separate page.

Specified by:
openDetailPage in interface Line
Returns:
a new page, ready for lines of more detailed information to be added.

setOwner

public void setOwner(Page owner)
Set the page that own's this line, in other words, the master page.

Specified by:
setOwner in interface Line

getOwner

public Page getOwner()
Specified by:
getOwner in interface Line

setReport

public void setReport(Report report)
Specified by:
setReport in interface Line

setCategory

public void setCategory(LineCategory category)
Description copied from interface: Line
Instances of this class should record their category if they want to validate values of fields set with the setField() methods.

Reports that are not derived from AbstractPage, or override AbstractPage.createLine(LineCategory) should always call this method on newly created Line instances they create.

Specified by:
setCategory in interface Line

getDetailPage

public Page getDetailPage()
Description copied from interface: Line
Get the detail page if one exists. This method does not create a detail page, if you want to do this you should use Line.openDetailPage().

Specified by:
getDetailPage in interface Line

setField

public void setField(Column column,
                     java.lang.Object value)
Set a piece of information against this line.

Specified by:
setField in interface Line
Parameters:
value - the value of the field. Again, this must be of the correct type as determined by the category.

setField

public void setField(Column column,
                     int value)
Specified by:
setField in interface Line

setField

public void setField(Column column,
                     double value)
Specified by:
setField in interface Line

setField

public void setField(Column column,
                     boolean value)
Specified by:
setField in interface Line

instantiateDetailPage

protected Page instantiateDetailPage()
Subclasses should override this method if the line has information in a detail page.


getField

public java.lang.Object getField(Column column)
                          throws java.lang.IllegalArgumentException
Get the field value for a given column.

Specified by:
getField in interface Line
Parameters:
column - the given column.
Returns:
null if no value has been set for the given column.
Throws:
java.lang.IllegalArgumentException - if the column is not known to this line's category.

close

public void close()
           throws ReportingException
Description copied from interface: Closeable
Call this method when you are done adding detail. The object is considered immutable and ready for formatting. This method ensures that all outstanding detail objects have been closed before exiting.

Specified by:
close in interface Closeable
Throws:
ReportingException

isClosed

public boolean isClosed()
Specified by:
isClosed in interface Closeable

assertValidColumnForCategory

protected void assertValidColumnForCategory(Column column)
                                     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException