|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.report.Element
org.jfree.report.Band
A report band is a collection which can contain other Report-Elements. A band contains a list of elements to be displayed, and represents one section of a report (the report header or footer, the page header or footer, the group header or footer, or the items within a group).
The elements in a report band can contain fixed values, field values from the dataset, or function values. The elements are not required to have unique names.
This implementation is not synchronized, to take care that you externally synchronize it when using multiple threads.
A band's contents should not be modified after the report processing starts, so don't add Elements to the band's contained in or aquired from an report-state.
Bands contain a master stylesheet for all element contained in that band. This StyleSheet is registered in the child when the element is added to the band.
Bands now extend the Element-class, so it is possible to stack bands into another band. Trying to add a parent of an band as child to the band, will result in an exception.
Field Summary | |
static java.lang.String |
ANONYMOUS_BAND_PREFIX
The prefix for anonymous bands, bands without an userdefined name. |
static java.lang.String |
CONTENT_TYPE
the defined content type for the band. |
Fields inherited from class org.jfree.report.Element |
ANONYMOUS_ELEMENT_PREFIX |
Constructor Summary | |
Band()
Constructs a new band (initially empty). |
|
Band(boolean pagebreakBefore,
boolean pagebreakAfter)
Constructs a new band with the given pagebreak attributes. |
Method Summary | |
void |
addElement(Element element)
Adds a report element to the band. |
void |
addElement(int position,
Element element)
Adds a report element to the band. |
void |
addElements(java.util.Collection elements)
Adds a collection of elements to the band. |
java.lang.Object |
clone()
Clones this band and all elements contained in this band. |
ElementStyleSheet |
getBandDefaults()
Returns the default style sheet for all children of this band. |
java.lang.String |
getContentType()
Returns the content type of the element. |
Element |
getElement(int index)
Returns the element stored add the given index. |
Element |
getElement(java.lang.String name)
Returns the first element in the list that is registered by the given name. |
Element[] |
getElementArray()
Returns an array of the elements in the band. |
int |
getElementCount()
Returns the number of elements in this band. |
java.util.List |
getElements()
Returns all child-elements of this band as immutable list. |
BandLayoutManager |
getLayout()
Returns the layout manager for the band. |
protected void |
handleRegisterStyleSheetCollection()
Handles the registration of the stylesheet collection. |
protected void |
handleUnregisterStyleSheetCollection()
Handles the unregistration of the stylesheet collection. |
void |
invalidateLayout()
Invalidates the layout. |
boolean |
isPagebreakAfterPrint()
Returns, whether the page layout manager should perform a pagebreak before this page is printed. |
boolean |
isPagebreakBeforePrint()
Returns, whether the page layout manager should perform a pagebreak before this page is printed. |
void |
removeElement(Element e)
Removes an element from the band. |
void |
setLayout(BandLayoutManager layoutManager)
Sets the band layout manager. |
void |
setPagebreakAfterPrint(boolean pagebreakAfterPrint)
Defines, whether the page layout manager should perform a pagebreak before this page is printed. |
void |
setPagebreakBeforePrint(boolean pagebreakBeforePrint)
Defines, whether the page layout manager should perform a pagebreak before this page is printed. |
java.lang.String |
toString()
Returns a string representation of the band and all the elements it contains, useful mainly for debugging purposes. |
void |
updateStyleSheetCollection(StyleSheetCollection sc)
Updates the stylesheet collection for this element and all substylesheets. |
Methods inherited from class org.jfree.report.Element |
getDataSource, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getStyle, getStyleSheetCollection, getTreeLock, getValue, isDynamicContent, isLayoutCacheable, isVisible, registerStyleSheetCollection, setDataSource, setDynamicContent, setLayoutCacheable, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setVisible, unregisterStyleSheetCollection |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String CONTENT_TYPE
public static final java.lang.String ANONYMOUS_BAND_PREFIX
Constructor Detail |
public Band()
public Band(boolean pagebreakBefore, boolean pagebreakAfter)
pagebreakAfter
- defines, whether a pagebreak should be done
after that band was printed.pagebreakBefore
- defines, whether a pagebreak should be done
before that band gets printed.Method Detail |
public BandLayoutManager getLayout()
public void setLayout(BandLayoutManager layoutManager)
layoutManager
- the layout manager.public ElementStyleSheet getBandDefaults()
public void addElement(Element element)
element
- the element (null
not permitted).
java.lang.NullPointerException
- if the element is null
or contains null
values.public void addElement(int position, Element element)
position
- the position where to insert the elementelement
- the element that should be added
java.lang.NullPointerException
- if the given element is null
java.lang.IllegalArgumentException
- if the position is invalid, either negative or
greater than the number of elements in this band.public void addElements(java.util.Collection elements)
elements
- the element collection.
java.lang.NullPointerException
- if the collection given is null
or
the collection contains null
elements.public Element getElement(java.lang.String name)
name
- the element name.
null
if there is no
such element.
java.lang.NullPointerException
- if the given name is null.public void removeElement(Element e)
You should not use this method on a band acquired from a ReportState
or
Function
.
e
- the element to be removed.public java.util.List getElements()
public int getElementCount()
public Element[] getElementArray()
public Element getElement(int index)
index
- the element position within this band
java.lang.IndexOutOfBoundsException
- if the index is invalid.public java.lang.String toString()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface DataTarget
clone
in class Element
java.lang.CloneNotSupportedException
- if this band or an element contained in this band does not
support cloning.public java.lang.String getContentType()
getContentType
in class Element
public void invalidateLayout()
protected void handleUnregisterStyleSheetCollection()
handleUnregisterStyleSheetCollection
in class Element
protected void handleRegisterStyleSheetCollection()
handleRegisterStyleSheetCollection
in class Element
public void updateStyleSheetCollection(StyleSheetCollection sc) throws InvalidStyleSheetCollectionException
If you don't call this function after cloning prepare to be doomed. This method will replace all inherited stylesheets with clones from the stylesheet collection.
updateStyleSheetCollection
in class Element
sc
- the stylesheet collection that contains the updated information and
that should be assigned with that element.
java.lang.NullPointerException
- if the given stylesheet collection is null.
InvalidStyleSheetCollectionException
- if there is an other stylesheet collection already registered with that element.public boolean isPagebreakBeforePrint()
public void setPagebreakBeforePrint(boolean pagebreakBeforePrint)
pagebreakBeforePrint
- set to true, if to force a pagebreak before
this band is printed, false otherwisepublic boolean isPagebreakAfterPrint()
public void setPagebreakAfterPrint(boolean pagebreakAfterPrint)
pagebreakAfterPrint
- set to true, if to force a pagebreak before
this band is printed, false otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |