com.jcoverage.reporting
Class AbstractPage

java.lang.Object
  extended bycom.jcoverage.reporting.AbstractPage
All Implemented Interfaces:
Closeable, Page
Direct Known Subclasses:
JavaFilePage, PackageSummaryPage, ReportSummaryPage

public abstract class AbstractPage
extends java.lang.Object
implements Page

This class provides a skeletal implementation of a Page. Subclasses should override the instantiateLineForCategory(com.jcoverage.reporting.LineCategory) method to return Line implementation instances on demand.


Field Summary
(package private)  java.util.List categories
           
(package private)  java.lang.String label
           
(package private)  java.util.Map lineSetsByCategory
           
(package private) static org.apache.log4j.Logger logger
           
(package private)  Line masterLine
           
(package private)  Report report
           
(package private)  int state
           
 
Constructor Summary
protected AbstractPage(java.lang.String label)
           
 
Method Summary
 void addCategory(LineCategory category)
           
 void addLineReference(Line line, LineCategory category)
          Add a reference to a line.
 void close()
          Call this method to indicate that no further lines will be created for this report and it can be considered immutable from the point-of-view of formatting.
(package private)  void close(java.util.Set set)
           
 Line createLine(LineCategory category)
          Create a new line in the page.
 LineCategory[] getCategories()
          Subclasses should implemented this method to return the categories of lines that are applicable to this report, or else make exclusive use of the addCategory(com.jcoverage.reporting.LineCategory) method.
 java.lang.String getLabel()
           
 java.util.Set getLines(LineCategory category)
          The page can 'contain' any number of categories (tables) which, in turn, contain any number of lines.
(package private)  java.util.Set getLineSetForCategory(LineCategory category)
           
 Line getMasterLine()
           
protected  Line instantiateLineForCategory(LineCategory category)
          Subclasses should override this method to return Line implementation instances on demand.
 boolean isClosed()
           
 Line lookupLineByField(LineCategory category, Column column, java.lang.Object value)
           
 void setMasterLine(Line masterLine)
           
 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

label

java.lang.String label

report

Report report

categories

java.util.List categories

masterLine

Line masterLine

lineSetsByCategory

java.util.Map lineSetsByCategory

state

int state
Constructor Detail

AbstractPage

protected AbstractPage(java.lang.String label)
Method Detail

getLineSetForCategory

java.util.Set getLineSetForCategory(LineCategory category)

createLine

public Line createLine(LineCategory category)
Description copied from interface: Page
Create a new line in the page. Lines can fall into categories, used for tables and sectioning. This information is used by formats, so they can request lines by category.

Specified by:
createLine in interface Page
Returns:
a new line instance, null if no lines match the given category.

addLineReference

public void addLineReference(Line line,
                             LineCategory category)
Description copied from interface: Page
Add a reference to a line. Unlike the Page.createLine(LineCategory) method, no connections are made between this page and line.

Specified by:
addLineReference in interface Page

lookupLineByField

public Line lookupLineByField(LineCategory category,
                              Column column,
                              java.lang.Object value)
Specified by:
lookupLineByField in interface Page

getLines

public java.util.Set getLines(LineCategory category)
Description copied from interface: Page
The page can 'contain' any number of categories (tables) which, in turn, contain any number of lines. This method provides access to those lines.

Specified by:
getLines in interface Page
Returns:
the lines stored in this page against the category, or an empty set. Should never return null.

instantiateLineForCategory

protected Line instantiateLineForCategory(LineCategory category)
Subclasses should override this method to return Line implementation instances on demand.

Parameters:
category - guarenteed not to be null

getCategories

public LineCategory[] getCategories()
Subclasses should implemented this method to return the categories of lines that are applicable to this report, or else make exclusive use of the addCategory(com.jcoverage.reporting.LineCategory) method.

Specified by:
getCategories in interface Page

addCategory

public void addCategory(LineCategory category)
Specified by:
addCategory in interface Page

setMasterLine

public void setMasterLine(Line masterLine)
Specified by:
setMasterLine in interface Page
See Also:
Page.getMasterLine()

getMasterLine

public Line getMasterLine()
Specified by:
getMasterLine in interface Page
Returns:
the line that summarizes this detail page, null if this is not a detail page. The terminology of master and detail comes from the database world where heirarchical reports which show information in a parent-child format are often referred to as master-detail reports.

setReport

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

close

public void close()
           throws ReportingException
Call this method to indicate that no further lines will be created for this report and it can be considered immutable from the point-of-view of formatting.

Specified by:
close in interface Closeable
Throws:
ReportingException

isClosed

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

getLabel

public java.lang.String getLabel()
Specified by:
getLabel in interface Page

close

void close(java.util.Set set)
     throws ReportingException
Throws:
ReportingException