Class Section
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.Element
-
- org.pentaho.reporting.engine.classic.core.Section
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Element>
,DataTarget
,ReportElement
- Direct Known Subclasses:
AbstractReportDefinition
,Band
,Group
,GroupBody
,ReportDefinitionImpl
public abstract class Section extends Element implements Iterable<Element>
A section is a small-scale band that allows to access the child elements but does not define how childs get added or organized in the section. Defining a sensible order is left to the subclass-implementation.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.pentaho.reporting.engine.classic.core.Element
ANONYMOUS_ELEMENT_PREFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Section()
Default Constructor.protected
Section(InstanceID id)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Section
clone()
Clones this Element, the datasource and the private stylesheet of this Element.Section
derive(boolean preserveElementInstanceIds)
Creates a deep copy of this element and regenerates all instance-ids.ElementStyleSheet
getDefaultStyleSheet()
Creates the global stylesheet for this element type.abstract Element
getElement(int index)
Returns the element stored add the given index.abstract int
getElementCount()
Returns the number of elements in this section.Iterator<Element>
iterator()
protected void
registerAsChild(Element element)
protected abstract void
removeElement(Element element)
Removes an element from the section.abstract void
setElementAt(int position, Element element)
protected void
unregisterAsChild(Element element)
protected boolean
unregisterParent(Element element)
Unregisters the given element from its parent.protected void
validateLooping(Element element)
Checks whether the element given is a parent of this section.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.Element
copyAttributes, copyInto, derive, getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeExpressions, getAttributeNames, getAttributeNamespaces, getAttributes, getAttributeTyped, getChangeTracker, getChildElementByType, getChildElementsByName, getChildElementsByType, getComputedStyle, getContentBase, getDataSource, getDefinitionSource, getElementContext, getElementType, getElementTypeName, getFirstAttribute, getHRefTarget, getId, getMasterReport, getMetaData, getName, getObjectID, getParent, getParentSection, getReportDefinition, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, isDynamicContent, isVisible, notifyElement, notifyNodeChildAdded, notifyNodeChildRemoved, notifyNodePropertiesChanged, notifyNodePropertiesChanged, notifyNodeStructureChanged, setAttribute, setAttribute, setAttributeExpression, setChangeTracker, setComputedStyle, setDataSource, setDynamicContent, setElementType, setHRefTarget, setId, setName, setParent, setStyleExpression, setVisible, toString, updateChangedFlagInternal, updateInternalChangeFlag
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Section
protected Section()
Default Constructor.
-
Section
protected Section(InstanceID id)
-
-
Method Detail
-
getDefaultStyleSheet
public ElementStyleSheet getDefaultStyleSheet()
Creates the global stylesheet for this element type. The global stylesheet is an immutable stylesheet that provides reasonable default values for some of the style keys. The global default stylesheet is always the last stylesheet that will be queried for values.- Specified by:
getDefaultStyleSheet
in interfaceReportElement
- Overrides:
getDefaultStyleSheet
in classElement
- Returns:
- the global stylesheet.
-
getElement
public abstract Element getElement(int index)
Returns the element stored add the given index.- Parameters:
index
- the element position within this section- Returns:
- the element
- Throws:
IndexOutOfBoundsException
- if the index is invalid.
-
getElementCount
public abstract int getElementCount()
Returns the number of elements in this section.- Returns:
- the number of elements of this section.
-
unregisterParent
protected boolean unregisterParent(Element element)
Unregisters the given element from its parent. If the element is already a direct child of this section, this operation does nothing and returns 'true' to indicate that all the work is already done. This is a helper function and not meant to be used by the grand public.- Parameters:
element
- the element to be unregistered from its current parent.- Returns:
- true, if the element is a child of this section, false otherwise.
-
validateLooping
protected void validateLooping(Element element)
Checks whether the element given is a parent of this section. Adding that element to the section would cause infinite loops later, so we prevent it early in the game.- Parameters:
element
- the element to be checked for loops.
-
setElementAt
public abstract void setElementAt(int position, Element element)
-
removeElement
protected abstract void removeElement(Element element)
Removes an element from the section.- Parameters:
element
- the element to be section.- Throws:
NullPointerException
- if the given element is null.
-
unregisterAsChild
protected void unregisterAsChild(Element element)
-
registerAsChild
protected void registerAsChild(Element element)
-
derive
public Section derive(boolean preserveElementInstanceIds)
Description copied from class:Element
Creates a deep copy of this element and regenerates all instance-ids.- Overrides:
derive
in classElement
- 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.
-
clone
public Section clone()
Description copied from class:Element
Clones this Element, the datasource and the private stylesheet of this Element. The clone does no longer have a parent, as the old parent would not recognize that new object anymore.- Specified by:
clone
in interfaceDataTarget
- Overrides:
clone
in classElement
- Returns:
- a clone of this Element.
-
-