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

Quick Search    Search Deep

jbreport.core
Class ReportSectionImpl  view ReportSectionImpl download ReportSectionImpl.java

java.lang.Object
  extended byjbreport.core.AbstractReportElement
      extended byjbreport.core.ReportSectionImpl
All Implemented Interfaces:
java.lang.Cloneable, jbreport.ReportElement, jbreport.ReportSection, Traversable, XMLAware
Direct Known Subclasses:
Document

public class ReportSectionImpl
extends AbstractReportElement
implements jbreport.ReportSection

This is the default implementation of a ReportSection instance. It is made public as classes in other packages might need to implement the ReportSection interface.

Version:
$Revision: 1.1 $

Field Summary
private  jbreport.ReportElement bodyElement
          The body element of this instance.
private  java.util.Map boundParams
          The mapping of bound parameters
private  boolean createdGroupElement
          Did this element create a group element implicitly?
private  jbreport.ReportElement footerElement
          The footer element of this instance.
private  jbreport.ReportElement headerElement
          The header element of this instance
private  java.util.Collection renderers
          The renderers that have been attached to this section
 
Fields inherited from class jbreport.core.AbstractReportElement
attrType, cdata, className, elementType, factory, name, xmlHandler
 
Fields inherited from interface jbreport.ReportSection
HTMLRenderer
 
Fields inherited from interface jbreport.ReportElement
DEEP, SHALLOW
 
Constructor Summary
ReportSectionImpl()
           
 
Method Summary
 void accept(ReportVisitor visitor, ReportVisitorState state)
          This defines the operation that the Traversable instance must perform at each node in the traversal.
 void addRenderer(java.lang.String rendererType, java.io.PrintWriter output)
          Add another renderer that will be used during traversal of the report.
 jbreport.ReportElement copy(boolean deep)
          This will copy (clone) the current element, returning the copied element.
 jbreport.ReportElement getBody()
          Returns the body element of this section
 java.lang.String getBoundParamValue(java.lang.String paramName)
          Returns the value of the bound parameter, null if no parameter of that name was found
 jbreport.ReportElement getFooter()
          Returns the footer element of this section
 jbreport.ReportElement getHeader()
          Returns the header element of this section.
 void loadData()
          This will initiate the loading of the data into the report.
 void render()
          Render the report using the given renderers.
 void setBody(jbreport.ReportElement elem)
          Adds a body element to this element.
 void setBoundParamValue(java.lang.String paramName, java.lang.String value)
          This will create a binding that will be used during report creation to substitute a variable with the given parameter.
 void setFooter(jbreport.ReportElement elem)
          Adds a footer element to this element.
 void setHeader(jbreport.ReportElement elem)
          Adds a header element to this element.
 void updateData(jbreport.data.QueryResult queryResult)
          This is called for every successful next() method call on the QueryResult contained by a group.
 void xmlEnd(java.lang.String cdata)
          This should mark the end of the element definition using xml.
 void xmlEndChild(jbreport.ReportElement elem)
          This method is called for every child element that is defined during xml tree traversal.
 void xmlInitialize(java.lang.String localName, org.xml.sax.Attributes attributes)
          This should initialize the instance with data obtained during the traversal of an xml tree.
 
Methods inherited from class jbreport.core.AbstractReportElement
assert, assertNotNull, boundParameters, breakEventNotify, clone, copy, getElement, getFactory, getList, getName, getParent, getRepository, getString, getStylesheet, getType, inOrderIterator, inOrderTraverse, postOrderIterator, postOrderTraverse, preLoadData, preOrderIterator, preOrderTraverse, setParent, setString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jbreport.ReportElement
boundParameters, copy, getElement, getFactory, getList, getName, getParent, getRepository, getString, getStylesheet, getType, setParent, setString
 

Field Detail

headerElement

private jbreport.ReportElement headerElement
The header element of this instance


bodyElement

private jbreport.ReportElement bodyElement
The body element of this instance.


footerElement

private jbreport.ReportElement footerElement
The footer element of this instance.


createdGroupElement

private boolean createdGroupElement
Did this element create a group element implicitly?


boundParams

private java.util.Map boundParams
The mapping of bound parameters


renderers

private java.util.Collection renderers
The renderers that have been attached to this section

Constructor Detail

ReportSectionImpl

public ReportSectionImpl()
Method Detail

addRenderer

public void addRenderer(java.lang.String rendererType,
                        java.io.PrintWriter output)
Description copied from interface: jbreport.ReportSection
Add another renderer that will be used during traversal of the report.

Specified by:
addRenderer in interface jbreport.ReportSection

render

public void render()
            throws jbreport.ReportException
Description copied from interface: jbreport.ReportSection
Render the report using the given renderers.

Specified by:
render in interface jbreport.ReportSection

setBoundParamValue

public void setBoundParamValue(java.lang.String paramName,
                               java.lang.String value)
Description copied from interface: jbreport.ReportSection
This will create a binding that will be used during report creation to substitute a variable with the given parameter.

Specified by:
setBoundParamValue in interface jbreport.ReportSection

getBoundParamValue

public java.lang.String getBoundParamValue(java.lang.String paramName)
Description copied from interface: jbreport.ReportElement
Returns the value of the bound parameter, null if no parameter of that name was found

Specified by:
getBoundParamValue in interface jbreport.ReportElement
Overrides:
getBoundParamValue in class AbstractReportElement

setHeader

public void setHeader(jbreport.ReportElement elem)
Description copied from interface: jbreport.ReportSection
Adds a header element to this element. Some element types might not allow children.

Specified by:
setHeader in interface jbreport.ReportSection

getHeader

public jbreport.ReportElement getHeader()
Description copied from interface: jbreport.ReportSection
Returns the header element of this section.

Specified by:
getHeader in interface jbreport.ReportSection

setBody

public void setBody(jbreport.ReportElement elem)
Description copied from interface: jbreport.ReportSection
Adds a body element to this element. Some element types might not allow children.

Specified by:
setBody in interface jbreport.ReportSection

getBody

public jbreport.ReportElement getBody()
Description copied from interface: jbreport.ReportSection
Returns the body element of this section

Specified by:
getBody in interface jbreport.ReportSection

setFooter

public void setFooter(jbreport.ReportElement elem)
Description copied from interface: jbreport.ReportSection
Adds a footer element to this element. Some element types might not allow children.

Specified by:
setFooter in interface jbreport.ReportSection

getFooter

public jbreport.ReportElement getFooter()
Description copied from interface: jbreport.ReportSection
Returns the footer element of this section

Specified by:
getFooter in interface jbreport.ReportSection

copy

public jbreport.ReportElement copy(boolean deep)
Description copied from interface: jbreport.ReportElement
This will copy (clone) the current element, returning the copied element.

Should the deep parameter be set, the children of this element are cloned as well, otherwise, the references are copied. This is not strictly true, as there might be classes of elements where a clone does not make sense.

Specified by:
copy in interface jbreport.ReportElement
Overrides:
copy in class AbstractReportElement

loadData

public void loadData()
              throws jbreport.ReportException
Description copied from interface: jbreport.ReportElement
This will initiate the loading of the data into the report.

Specified by:
loadData in interface jbreport.ReportElement
Overrides:
loadData in class AbstractReportElement

updateData

public void updateData(jbreport.data.QueryResult queryResult)
                throws jbreport.ReportException
Description copied from class: AbstractReportElement
This is called for every successful next() method call on the QueryResult contained by a group.

Overrides:
updateData in class AbstractReportElement

xmlInitialize

public void xmlInitialize(java.lang.String localName,
                          org.xml.sax.Attributes attributes)
                   throws jbreport.ReportException
Description copied from interface: jbreport.ReportElement
This should initialize the instance with data obtained during the traversal of an xml tree. The child-parent relationship is catered for with the xmlEndChild() method.

Specified by:
xmlInitialize in interface jbreport.ReportElement
Overrides:
xmlInitialize in class AbstractReportElement

xmlEnd

public void xmlEnd(java.lang.String cdata)
            throws jbreport.ReportException
Description copied from interface: jbreport.ReportElement
This should mark the end of the element definition using xml. It will return the character data that was found during parsing to the element.

Specified by:
xmlEnd in interface jbreport.ReportElement
Overrides:
xmlEnd in class AbstractReportElement

xmlEndChild

public void xmlEndChild(jbreport.ReportElement elem)
                 throws jbreport.ReportException
Description copied from interface: jbreport.ReportElement
This method is called for every child element that is defined during xml tree traversal. In order to preserve the tree, it will only be called at the end of the child definition.

Specified by:
xmlEndChild in interface jbreport.ReportElement
Overrides:
xmlEndChild in class AbstractReportElement

accept

public void accept(ReportVisitor visitor,
                   ReportVisitorState state)
            throws jbreport.ReportException
Description copied from interface: Traversable
This defines the operation that the Traversable instance must perform at each node in the traversal. It should be coded such that it calls an appropriate method on the ReportVisitor instance. Should an appropriate method not exist, one should be coded.

The accept method should not recurse into its children, it is the contract of the iterator to perform that function.

eg:- For node type Section the method on this node should be as follows.

   public void accept(ReportVisitor visitor, ReportVisitorState state) 
      throws ReportException {
      visitor.visitSection(this, state);
   }

Specified by:
accept in interface Traversable
Overrides:
accept in class AbstractReportElement