org.pentaho.reporting.engine.classic.core
Class Group

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.Element
      extended by org.pentaho.reporting.engine.classic.core.Section
          extended by org.pentaho.reporting.engine.classic.core.Group
All Implemented Interfaces:
Serializable, Cloneable, DataTarget, ReportElement
Direct Known Subclasses:
CrosstabColumnGroup, CrosstabGroup, CrosstabOtherGroup, CrosstabRowGroup, RelationalGroup

public abstract class Group
extends Section

A report group. Reports can contain any number of (nested) groups. The order of the fields is not important. If the group does not contain any fields, the group spans the whole report from the first to the last row (such a group is called the default group).

The group's field list should not be modified after the group was added to the group list, or the results are undefined.

Groups of the same GroupList must have a subgroup relation. The designated child group must contain all fields of the direct parent plus at least one new field. There is no requirement, that the referenced field actually exists, if it doesn't, null is assumed as field value.

It is recommended that the name of the group is unique within the report. The name will not be used internally to identify the group, but most functions depend on a recognizable group name to identify the group to be processed.

Author:
David Gilbert, Thomas Morgner
See Also:
GroupList, Serialized Form

Field Summary
static String ANONYMOUS_GROUP_PREFIX
          The internal constant to mark anonymous group names.
 
Fields inherited from class org.pentaho.reporting.engine.classic.core.Element
ANONYMOUS_ELEMENT_PREFIX
 
Method Summary
 Object clone()
          Clones this Element.
 Element derive(boolean preserveElementInstanceIds)
          Creates a deep copy of this element and regenerates all instance-ids.
 GroupBody getBody()
           
 ReportElement getElement(int index)
          Returns the element stored add the given index.
 int getElementCount()
          Returns the number of elements in this section.
 GroupFooter getFooter()
          Returns the group footer.
 GroupHeader getHeader()
          Returns the group header.
abstract  boolean isGroupChange(DataRow dataRow)
           
 void setBody(GroupBody body)
           
 void setElementAt(int index, Element element)
           
 void setFooter(GroupFooter footer)
          Sets the footer for the group.
 void setHeader(GroupHeader header)
          Sets the header for the group.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.Element
derive, getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeNames, getAttributeNamespaces, getAttributes, getChangeTracker, getContentBase, getDataSource, getDefinitionSource, getElementType, getElementTypeName, getHRefTarget, getId, getMetaData, getName, getObjectID, getParent, getParentSection, getReportDefinition, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, getValue, isDynamicContent, isVisible, notifyNodeChildAdded, notifyNodeChildRemoved, notifyNodePropertiesChanged, notifyNodePropertiesChanged, notifyNodeStructureChanged, setAttribute, setAttribute, setAttributeExpression, setDataSource, setDynamicContent, setElementType, setHRefTarget, setId, setName, setStyleExpression, setVisible, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANONYMOUS_GROUP_PREFIX

public static final String ANONYMOUS_GROUP_PREFIX
The internal constant to mark anonymous group names.

See Also:
Constant Field Values
Method Detail

getHeader

public GroupHeader getHeader()
Returns the group header.

The group header is a report band that contains elements that should be printed at the start of a group.

Returns:
the group header.

setHeader

public void setHeader(GroupHeader header)
Sets the header for the group.

Parameters:
header - the header (null not permitted).
Throws:
NullPointerException - if the given header is null

getBody

public GroupBody getBody()

setBody

public void setBody(GroupBody body)

getFooter

public GroupFooter getFooter()
Returns the group footer.

Returns:
the footer.

setFooter

public void setFooter(GroupFooter footer)
Sets the footer for the group.

Parameters:
footer - the footer (null not permitted).
Throws:
NullPointerException - if the given footer is null.

clone

public Object clone()
             throws CloneNotSupportedException
Clones this Element.

Specified by:
clone in interface DataTarget
Overrides:
clone in class Element
Returns:
a clone of this element.
Throws:
CloneNotSupportedException - should never be thrown.

derive

public Element derive(boolean preserveElementInstanceIds)
               throws CloneNotSupportedException
Description copied from class: Element
Creates a deep copy of this element and regenerates all instance-ids.

Overrides:
derive in class Element
Parameters:
preserveElementInstanceIds - defines whether this call generates new instance-ids for the derived elements. Instance-IDs are used by the report processor to recognize reoccurring elements and must not changed within the report run. Outside of the report processors new instance ids should be generated at all times to separate instances and to make them uniquely identifiable.
Returns:
the copy of the element.
Throws:
CloneNotSupportedException

isGroupChange

public abstract boolean isGroupChange(DataRow dataRow)

getElementCount

public int getElementCount()
Description copied from class: Section
Returns the number of elements in this section.

Specified by:
getElementCount in class Section
Returns:
the number of elements of this section.

getElement

public ReportElement getElement(int index)
Description copied from class: Section
Returns the element stored add the given index.

Specified by:
getElement in class Section
Parameters:
index - the element position within this section
Returns:
the element

setElementAt

public void setElementAt(int index,
                         Element element)
Specified by:
setElementAt in class Section