|
|||||||||
| Home >> All >> jbreport >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jbreport.core
Class AbstractReportElement

java.lang.Objectjbreport.core.AbstractReportElement
- All Implemented Interfaces:
- java.lang.Cloneable, jbreport.ReportElement, Traversable, XMLAware
- Direct Known Subclasses:
- Fragment, Include, NullReportStylesheet, QueryBoundResult, ReportCompositeImpl, ReportSectionImpl, SectionBreak, TableRow
- public abstract class AbstractReportElement
- extends java.lang.Object
- implements java.lang.Cloneable, jbreport.ReportElement, Traversable, XMLAware
- extends java.lang.Object
This provides default implementations of all the interfaces that are implemented by most elements that exist as part of the report framework.
- Version:
- $Revision: 1.1 $
| Field Summary | |
protected java.lang.String |
attrType
The type declared as an attribute with the declaration of the xml element. |
protected java.lang.String |
cdata
The character data that existed as part of the element definition |
protected java.lang.String |
className
The declared style class - can be null |
protected java.lang.String |
elementType
The type of xml *element* that this instance represents. |
(package private) jbreport.ReportElementFactory |
factory
The factory that defined this report element instance. |
protected java.lang.String |
name
The name of this report element |
private jbreport.ReportElement |
parent
The parent of this instance |
(package private) XMLHandler |
xmlHandler
The xml handler instance that was responsible for causing this element to be created. |
| Fields inherited from interface jbreport.ReportElement |
DEEP, SHALLOW |
| Constructor Summary | |
AbstractReportElement()
|
|
| Method Summary | |
void |
accept(ReportVisitor visitor,
ReportVisitorState state)
This defines the operation that the Traversable instance must perform at each node in the traversal. |
protected static void |
assert(boolean condition,
java.lang.String msg)
Assert that the given statement is not false, throw an error if it is false. |
protected static void |
assertNotNull(java.lang.Object obj,
java.lang.String objName)
Assert that the given object instance is not null. |
java.util.Iterator |
boundParameters()
Returns an iterator of all the bound parameters that exist within this section |
void |
breakEventNotify(jbreport.util.ReportBreak source,
java.lang.Object type)
This will notify the element that a break event has happened, and will give the element a chance to do some work. |
protected java.lang.Object |
clone()
Enable cloning of this instance so that the copy() methods
can be implemented. |
jbreport.ReportElement |
copy()
This is the same as calling copy(SHALLOW); |
jbreport.ReportElement |
copy(boolean deep)
This will copy (clone) the current element, returning the copied element. |
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 |
getElement(java.lang.String property)
Returns the ReportElement that exists as part of this element. |
jbreport.ReportElementFactory |
getFactory()
Returns the ElementFactory that created this instance. |
java.util.List |
getList(java.lang.String property)
Returns the List instance for the given property name. |
java.lang.String |
getName()
Returns the name of this report element if it has one. |
jbreport.ReportElement |
getParent()
Returns the parent of this element. |
jbreport.Repository |
getRepository()
Returns the repository in which this instance is defined. |
java.lang.String |
getString(java.lang.String property,
java.lang.String defaultValue)
Returns the string value for the requested property. |
jbreport.ReportStylesheet |
getStylesheet()
This will return the stylesheet instance for this ReportElement instance. |
java.lang.String |
getType()
Returns the type of this report element. |
java.util.Iterator |
inOrderIterator()
Returns an iterator suitable for an inOrder iteration over the hierarchy. |
void |
inOrderTraverse(ReportVisitor visitor)
Traverse the tree using an in-order iterator, and call the accept method on each element in the traversal. |
void |
loadData()
This will initiate the loading of the data into the report. |
java.util.Iterator |
postOrderIterator()
Returns an iterator suitable for a postOrder iteration over the hierarchy. |
void |
postOrderTraverse(ReportVisitor visitor)
Traverse the tree using a post-order iterator, and call the accept method on each element in the traversal. |
void |
preLoadData()
This method is called prior to the data actually being loaded into the report. |
java.util.Iterator |
preOrderIterator()
Returns an iterator suitable for a preOrder iteration over the hierarchy. |
void |
preOrderTraverse(ReportVisitor visitor)
Traverse the tree using a pre-order iterator, and call the accept method on each element in the traversal. |
void |
setParent(jbreport.ReportElement parent)
This will set the parent of this element to that given. |
void |
setString(java.lang.String property,
java.lang.String value)
Sets the value of the given property to that given. |
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 java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
name
protected java.lang.String name
- The name of this report element
elementType
protected java.lang.String elementType
- The type of xml *element* that this instance represents. This is
normally used by external packages while traversing the tree.
attrType
protected java.lang.String attrType
- The type declared as an attribute with the declaration of the xml
element. Thus for
, elementType is query, and attrType is jdbc.
cdata
protected java.lang.String cdata
- The character data that existed as part of the element definition
className
protected java.lang.String className
- The declared style class - can be null
factory
jbreport.ReportElementFactory factory
- The factory that defined this report element instance.
xmlHandler
XMLHandler xmlHandler
- The xml handler instance that was responsible for causing this element
to be created. Note that this is not necessarily always set, so the
onus is on the programmer to check for null.
parent
private jbreport.ReportElement parent
- The parent of this instance
| Constructor Detail |
AbstractReportElement
public AbstractReportElement()
| Method Detail |
getName
public java.lang.String getName()
- Description copied from interface:
jbreport.ReportElement - Returns the name of this report element if it has one. If it is not named
null is returned.
- Specified by:
getNamein interfacejbreport.ReportElement
getRepository
public jbreport.Repository getRepository()
- Description copied from interface:
jbreport.ReportElement - Returns the repository in which this instance is defined. In the case
of the repository, return itself. ie. This method should never return
null.
- Specified by:
getRepositoryin interfacejbreport.ReportElement
assert
protected static void assert(boolean condition,
java.lang.String msg)
- Assert that the given statement is not false, throw an error if it is
false.
assertNotNull
protected static void assertNotNull(java.lang.Object obj, java.lang.String objName)
- Assert that the given object instance is not null. This is normally
used to check arguments passed into a method, and will throw a
different exception to that thrown by the assert method.
breakEventNotify
public void breakEventNotify(jbreport.util.ReportBreak source, java.lang.Object type) throws jbreport.ReportException
- This will notify the element that a break event has happened, and will
give the element a chance to do some work.
clone
protected java.lang.Object clone()
- Enable cloning of this instance so that the
copy()methods can be implemented. This is made protected, as we need to encourage the use of the copy methods for the actual work.
copy
public jbreport.ReportElement copy()
- Description copied from interface:
jbreport.ReportElement - This is the same as calling
copy(SHALLOW);- Specified by:
copyin interfacejbreport.ReportElement
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:
copyin interfacejbreport.ReportElement
getElement
public jbreport.ReportElement getElement(java.lang.String property)
- Description copied from interface:
jbreport.ReportElement - Returns the ReportElement that exists as part of this element. This is
used in to fetch parts of elements that don't have a specific interface
defined for them.
- Specified by:
getElementin interfacejbreport.ReportElement
getString
public java.lang.String getString(java.lang.String property, java.lang.String defaultValue) throws jbreport.ReportException
- Description copied from interface:
jbreport.ReportElement - Returns the string value for the requested property.
- Specified by:
getStringin interfacejbreport.ReportElement
getStylesheet
public jbreport.ReportStylesheet getStylesheet() throws jbreport.ReportException
- Description copied from interface:
jbreport.ReportElement - This will return the stylesheet instance for this ReportElement instance.
Should the document to which the element belongs not be declared as
having a stylesheet, return an instance from which all requests for
styles will return null.
We don't provide a method to to fetch an actual style value, as this would imply either a stylesheet lookup for every value, or storing the reference in the concrete implementation. Both of these would be relatively expensive.
- Specified by:
getStylesheetin interfacejbreport.ReportElement
boundParameters
public java.util.Iterator boundParameters() throws jbreport.ReportException
- Description copied from interface:
jbreport.ReportElement - Returns an iterator of all the bound parameters that exist within this
section
- Specified by:
boundParametersin interfacejbreport.ReportElement
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:
getBoundParamValuein interfacejbreport.ReportElement
setString
public void setString(java.lang.String property, java.lang.String value) throws jbreport.ReportException
- Description copied from interface:
jbreport.ReportElement - Sets the value of the given property to that given.
- Specified by:
setStringin interfacejbreport.ReportElement
getList
public java.util.List getList(java.lang.String property)
- Description copied from interface:
jbreport.ReportElement - Returns the List instance for the given property name.
- Specified by:
getListin interfacejbreport.ReportElement
getType
public java.lang.String getType()
- Description copied from interface:
jbreport.ReportElement - Returns the type of this report element. This is useful for debugging a
report tree.
- Specified by:
getTypein interfacejbreport.ReportElement
getFactory
public jbreport.ReportElementFactory getFactory()
- Description copied from interface:
jbreport.ReportElement - Returns the ElementFactory that created this instance.
- Specified by:
getFactoryin interfacejbreport.ReportElement
getParent
public jbreport.ReportElement getParent()
- Description copied from interface:
jbreport.ReportElement - Returns the parent of this element. This will return null if the element
does not have a parent - ie. it is at the top of the report tree
- Specified by:
getParentin interfacejbreport.ReportElement
setParent
public void setParent(jbreport.ReportElement parent)
- Description copied from interface:
jbreport.ReportElement - This will set the parent of this element to that given. If the given
parent is null, it implies that this element is at the top of the tree.
- Specified by:
setParentin interfacejbreport.ReportElement
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:
loadDatain interfacejbreport.ReportElement
preLoadData
public void preLoadData()
throws jbreport.ReportException
- This method is called prior to the data actually being loaded into the
report. It is currently used by the Group element to create a template
which is later copied on every break.
updateData
public void updateData(jbreport.data.QueryResult queryResult) throws jbreport.ReportException
- This is called for every successful
next()method call on the QueryResult contained by a group.
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:
xmlInitializein interfacejbreport.ReportElement
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:
xmlEndin interfacejbreport.ReportElement
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:
xmlEndChildin interfacejbreport.ReportElement
preOrderIterator
public java.util.Iterator preOrderIterator()
- Description copied from interface:
Traversable - Returns an iterator suitable for a preOrder iteration over the hierarchy.
The order of this iterator is to visit the root, visit the left subtree, visit the right subtree.
- Specified by:
preOrderIteratorin interfaceTraversable
postOrderIterator
public java.util.Iterator postOrderIterator()
- Description copied from interface:
Traversable - Returns an iterator suitable for a postOrder iteration over the
hierarchy.
The order of this iterator is to visit the left subtree, visit the right subtree, visit the root.
- Specified by:
postOrderIteratorin interfaceTraversable
inOrderIterator
public java.util.Iterator inOrderIterator()
- Description copied from interface:
Traversable - Returns an iterator suitable for an inOrder iteration over the hierarchy.
The order of this iterator is to visit the left subtree, visit the root, visit the right subtree.
- Specified by:
inOrderIteratorin interfaceTraversable
preOrderTraverse
public void preOrderTraverse(ReportVisitor visitor) throws jbreport.ReportException
- Description copied from interface:
Traversable - Traverse the tree using a pre-order iterator, and call the
acceptmethod on each element in the traversal.- Specified by:
preOrderTraversein interfaceTraversable
postOrderTraverse
public void postOrderTraverse(ReportVisitor visitor) throws jbreport.ReportException
- Description copied from interface:
Traversable - Traverse the tree using a post-order iterator, and call the
acceptmethod on each element in the traversal.- Specified by:
postOrderTraversein interfaceTraversable
inOrderTraverse
public void inOrderTraverse(ReportVisitor visitor) throws jbreport.ReportException
- Description copied from interface:
Traversable - Traverse the tree using an in-order iterator, and call the
acceptmethod on each element in the traversal.- Specified by:
inOrderTraversein interfaceTraversable
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
Sectionthe method on this node should be as follows.public void accept(ReportVisitor visitor, ReportVisitorState state) throws ReportException { visitor.visitSection(this, state); }- Specified by:
acceptin interfaceTraversable
|
|||||||||
| Home >> All >> jbreport >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
jbreport.core.AbstractReportElement