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

Quick Search    Search Deep

jbreport.core
Class SectionBreak  view SectionBreak download SectionBreak.java

java.lang.Object
  extended byjbreport.core.AbstractReportElement
      extended byjbreport.core.SectionBreak
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, jbreport.util.ReportBreak, jbreport.ReportElement, Traversable, XMLAware

class SectionBreak
extends AbstractReportElement
implements jbreport.util.ReportBreak

This provides for breaking a section into sub-sections based on various events.

Version:
$Revision: 1.1 $

Field Summary
private  java.lang.String breakEvent
          The type of event that will trigger this break
private  java.lang.String id
          The QueryResult variable that will be checked
private  java.lang.String queryName
          The query that this is attached to
private  java.lang.String value
          The current value of the condition variable
 
Fields inherited from class jbreport.core.AbstractReportElement
attrType, cdata, className, elementType, factory, name, xmlHandler
 
Fields inherited from interface jbreport.ReportElement
DEEP, SHALLOW
 
Constructor Summary
(package private) SectionBreak()
           
 
Method Summary
 void accept(ReportVisitor visitor, ReportVisitorState state)
          This defines the operation that the Traversable instance must perform at each node in the traversal.
 int compareTo(java.lang.Object obj)
          Compares this object with another, and returns a numerical result based on the comparison.
 java.lang.String getBreakEvent()
          Returns the event for which the condition will become true.
private static int getDepth(SectionBreak sb)
           
 java.lang.String getQueryName()
           
 boolean isConditionTrue(java.lang.Object helper)
          This determines if the given condition has been met by this instance.
 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, copy, getBoundParamValue, getElement, getFactory, getList, getName, getParent, getRepository, getString, getStylesheet, getType, inOrderIterator, inOrderTraverse, loadData, postOrderIterator, postOrderTraverse, preLoadData, preOrderIterator, preOrderTraverse, setParent, setString, updateData, xmlEnd, xmlEndChild
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

breakEvent

private java.lang.String breakEvent
The type of event that will trigger this break


value

private java.lang.String value
The current value of the condition variable


id

private java.lang.String id
The QueryResult variable that will be checked


queryName

private java.lang.String queryName
The query that this is attached to

Constructor Detail

SectionBreak

SectionBreak()
Method Detail

getQueryName

public java.lang.String getQueryName()

getBreakEvent

public java.lang.String getBreakEvent()
Description copied from interface: jbreport.util.ReportBreak
Returns the event for which the condition will become true.

Specified by:
getBreakEvent in interface jbreport.util.ReportBreak

isConditionTrue

public boolean isConditionTrue(java.lang.Object helper)
                        throws jbreport.ReportException
Description copied from interface: jbreport.util.ReportBreak
This determines if the given condition has been met by this instance.

Specified by:
isConditionTrue in interface jbreport.util.ReportBreak

compareTo

public int compareTo(java.lang.Object obj)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

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

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

getDepth

private static int getDepth(SectionBreak sb)