Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.dghda.kent
Class ReportTemplate  view ReportTemplate download ReportTemplate.java

java.lang.Object
  extended bycom.dghda.kent.ReportTemplate

public class ReportTemplate
extends java.lang.Object

This class provides a convenient method of creating a report template. Report templates are based on report templates in the Kugar reporting tool (a part of the KOffice suite). The main difference is these templates are not primarily designed for exact positioning, and are not as sophisticated.


Field Summary
static int DEFAULT_PAGE_LENGTH
          The default page length.
private  java.util.ArrayList m_Body
           
private  java.util.ArrayList m_PageFooter
           
private  java.util.ArrayList m_PageHeader
           
private  int m_PageLength
           
private  java.util.ArrayList m_ReportFooter
           
private  java.util.ArrayList m_ReportHeader
           
private  ReportTemplateText m_Subtitle
           
private  ReportTemplateText m_Title
           
static java.lang.String TEMPLATE_DTD
          The name of the report template DTD.
 
Constructor Summary
protected ReportTemplate()
          Constructs a new empty report template.
  ReportTemplate(ReportTemplateText title)
          Constructs a new report template.
  ReportTemplate(ReportTemplateText title, ReportTemplateText subtitle)
          Constructs a new report template.
  ReportTemplate(java.lang.String title)
          Constructs a new report template using default settings for the title.
  ReportTemplate(java.lang.String title, java.lang.String subtitle)
          Constructs a new report template using default settings for the title and subtitle.
 
Method Summary
 void addDataSet(ReportTemplateDataSet dataSet)
          Adds the given data set to the report's body.
 void addPageFooterText(ReportTemplateText text)
          Adds the given text to the page footer.
 void addPageHeaderText(ReportTemplateText text)
          Adds the given text to the page header.
 void addReportFooterText(ReportTemplateText text)
          Adds the given text to the report footer.
 void addText(ReportTemplateText text)
          Adds the given text to the report's body.
 void addText(java.lang.String text)
          Adds the given text to the report's body with default settings.
protected  void addTextElements(java.lang.StringBuffer buffer, java.util.Iterator i, int indent)
           
static ReportTemplate constructReportTemplate(ReportEngine engine, java.lang.String template)
          Constructs a report template object from the given XML document.
protected static void constructTextElements(java.util.List list, org.w3c.dom.Element elem)
           
 java.util.Iterator getBodyIterator()
          Returns an iterator that will iterate over the contents of the template's body.
 java.util.Iterator getPageFooterIterator()
          Returns an iterator that will iterate over the text contents of the page footer.
 java.util.Iterator getPageHeaderIterator()
          Returns an iterator that will iterate over the contents of the page header.
 int getPageLength()
          Returns the report's page length.
 java.util.Iterator getReportFooterIterator()
          Returns an iterator that will iterate over the contents of the report footer.
 java.util.Iterator getReportHeaderIterator()
          Returns an iterator that will iterate over the contents of the report header.
 java.lang.String getSubtitle()
          Returns the report's sub-title, or null if it doesn't have one.
 java.lang.String getTemplate()
          Returns the report template document.
 java.lang.String getTitle()
          Returns the report's title.
 void setPageLength(int pageLength)
          Sets the page length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PAGE_LENGTH

public static final int DEFAULT_PAGE_LENGTH
The default page length.

See Also:
Constant Field Values

TEMPLATE_DTD

public static final java.lang.String TEMPLATE_DTD
The name of the report template DTD.

See Also:
Constant Field Values

m_Title

private ReportTemplateText m_Title

m_Subtitle

private ReportTemplateText m_Subtitle

m_ReportHeader

private java.util.ArrayList m_ReportHeader

m_PageHeader

private java.util.ArrayList m_PageHeader

m_Body

private java.util.ArrayList m_Body

m_PageFooter

private java.util.ArrayList m_PageFooter

m_ReportFooter

private java.util.ArrayList m_ReportFooter

m_PageLength

private int m_PageLength
Constructor Detail

ReportTemplate

protected ReportTemplate()
Constructs a new empty report template.


ReportTemplate

public ReportTemplate(java.lang.String title)
Constructs a new report template using default settings for the title.


ReportTemplate

public ReportTemplate(java.lang.String title,
                      java.lang.String subtitle)
Constructs a new report template using default settings for the title and subtitle.


ReportTemplate

public ReportTemplate(ReportTemplateText title)
Constructs a new report template.


ReportTemplate

public ReportTemplate(ReportTemplateText title,
                      ReportTemplateText subtitle)
Constructs a new report template.

Method Detail

constructReportTemplate

public static ReportTemplate constructReportTemplate(ReportEngine engine,
                                                     java.lang.String template)
                                              throws org.xml.sax.SAXException,
                                                     javax.xml.parsers.ParserConfigurationException
Constructs a report template object from the given XML document.


getTitle

public java.lang.String getTitle()
Returns the report's title.


getSubtitle

public java.lang.String getSubtitle()
Returns the report's sub-title, or null if it doesn't have one.


setPageLength

public void setPageLength(int pageLength)
Sets the page length. The page header and footer will be printed after this many lines.


getPageLength

public int getPageLength()
Returns the report's page length. If there is no page header, or there is no page length specified, the default value of 30 will be returned.


addPageHeaderText

public void addPageHeaderText(ReportTemplateText text)
Adds the given text to the page header.


addDataSet

public void addDataSet(ReportTemplateDataSet dataSet)
Adds the given data set to the report's body.


addText

public void addText(java.lang.String text)
Adds the given text to the report's body with default settings.


addText

public void addText(ReportTemplateText text)
Adds the given text to the report's body.


addPageFooterText

public void addPageFooterText(ReportTemplateText text)
Adds the given text to the page footer.


addReportFooterText

public void addReportFooterText(ReportTemplateText text)
Adds the given text to the report footer.


getReportHeaderIterator

public java.util.Iterator getReportHeaderIterator()
Returns an iterator that will iterate over the contents of the report header. Items returned will be ReportTemplateText objects.


getPageHeaderIterator

public java.util.Iterator getPageHeaderIterator()
Returns an iterator that will iterate over the contents of the page header. Items returned will be ReportTemplateText objects.


getBodyIterator

public java.util.Iterator getBodyIterator()
Returns an iterator that will iterate over the contents of the template's body. Items returned will be either ReportTemplateText or ReportTemplateDataSet objects.


getPageFooterIterator

public java.util.Iterator getPageFooterIterator()
Returns an iterator that will iterate over the text contents of the page footer. Items returned will be ReportTemplateText objects.


getReportFooterIterator

public java.util.Iterator getReportFooterIterator()
Returns an iterator that will iterate over the contents of the report footer. Items returned will be ReportTemplateText objects.


getTemplate

public java.lang.String getTemplate()
Returns the report template document.


addTextElements

protected void addTextElements(java.lang.StringBuffer buffer,
                               java.util.Iterator i,
                               int indent)

constructTextElements

protected static void constructTextElements(java.util.List list,
                                            org.w3c.dom.Element elem)
                                     throws org.xml.sax.SAXException