| Method from org.jfree.report.Band Detail: |
public void addElement(Element element) {
addElement(getElementCount(), element);
}
Adds a report element to the band. |
public void addElement(int position,
Element element) {
if (position < 0)
{
throw new IllegalArgumentException("Position < 0");
}
if (position > getElementCount())
{
throw new IllegalArgumentException("Position < 0");
}
if (element == null)
{
throw new NullPointerException("Band.addElement(...): element is null.");
}
validateLooping(element);
if (unregisterParent(element))
{
return;
}
if (allElements == null)
{
allElements = new ArrayList();
}
// add the element, update the childs Parent and the childs stylesheet.
allElements.add(position, element);
allElementsCached = null;
// then add the parents, or the band's parent will be unregistered ..
registerAsChild(element);
}
Adds a report element to the band. The element will be inserted at the specified position. |
public void addElements(Collection elements) {
if (elements == null)
{
throw new NullPointerException("Band.addElements(...): collection is null.");
}
final Iterator iterator = elements.iterator();
while (iterator.hasNext())
{
final Element element = (Element) iterator.next();
addElement(element);
}
}
Adds a collection of elements to the band. |
public void clear() {
final Element[] elements = internalGetElementArray();
for (int i = 0; i < elements.length; i++)
{
final Element element = elements[i];
removeElement(element);
}
}
|
public Object clone() throws CloneNotSupportedException {
final Band b = (Band) super.clone();
if (allElements != null)
{
final int elementSize = allElements.size();
b.allElements = (ArrayList) allElements.clone();
b.allElements.clear();
b.allElementsCached = new Element[elementSize];
if (allElementsCached != null)
{
for (int i = 0; i < elementSize; i++)
{
final Element eC = (Element) allElementsCached[i].clone();
b.allElements.add(eC);
b.allElementsCached[i] = eC;
eC.setParent(b);
}
}
else
{
for (int i = 0; i < elementSize; i++)
{
final Element e = (Element) allElements.get(i);
final Element eC = (Element) e.clone();
b.allElements.add(eC);
b.allElementsCached[i] = eC;
eC.setParent(b);
}
}
}
return b;
}
Clones this band and all elements contained in this band. After the cloning the band is no longer connected to a
report definition. |
protected ElementDefaultStyleSheet createGlobalDefaultStyle() {
return BandDefaultStyleSheet.getBandDefaultStyle();
}
Returns the global stylesheet for all bands. This stylesheet provides the predefined default values for some of the
stylekeys. |
public Element getElement(String name) {
if (name == null)
{
throw new NullPointerException("Band.getElement(...): name is null.");
}
final Element[] elements = internalGetElementArray();
final int elementsSize = elements.length;
for (int i = 0; i < elementsSize; i++)
{
final Element e = elements[i];
final String elementName = e.getName();
if (elementName != null)
{
if (elementName.equals(name))
{
return e;
}
}
}
return null;
}
|
public ReportElement getElement(int index) {
if (allElements == null)
{
throw new IndexOutOfBoundsException("This index is invalid.");
}
return (ReportElement) allElements.get(index);
}
Returns the element stored add the given index. |
public Element[] getElementArray() {
return (Element[]) internalGetElementArray().clone();
}
Returns an array of the elements in the band. If the band is empty, an empty array is returned.
Implementation note: The array returned is a copy of the internal backend. Any modification of the array will
no longer result in modifications of the internal object state. To avoid unneccessary object creations, you can
use the Band#unsafeGetElementArray() method now. |
public int getElementCount() {
if (allElements == null)
{
return 0;
}
return allElements.size();
}
Returns the number of elements in this band. |
public boolean isPagebreakAfterPrint() {
return getStyle().getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_AFTER);
}
Returns, whether the page layout manager should perform a pagebreak before this page is printed. This will have no
effect on empty pages or if the band is no root-level band. |
public boolean isPagebreakBeforePrint() {
return getStyle().getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE);
}
Returns, whether the page layout manager should perform a pagebreak before this page is printed. This will have no
effect on empty pages or if the band is no root-level band. |
public void removeElement(Element e) {
if (e == null)
{
throw new NullPointerException();
}
if (e.getParentSection() != this)
{
// this is none of my childs, ignore the request ...
return;
}
if (allElements == null)
{
return;
}
e.setParent(null);
allElements.remove(e);
allElementsCached = null;
}
Removes an element from the band. |
public void setPagebreakAfterPrint(boolean pagebreakAfterPrint) {
getStyle().setBooleanStyleProperty(BandStyleKeys.PAGEBREAK_AFTER, pagebreakAfterPrint);
}
Defines, whether the page layout manager should perform a pagebreak before this page is printed. This will have no
effect on empty pages or if the band is no root-level band. |
public void setPagebreakBeforePrint(boolean pagebreakBeforePrint) {
getStyle().setBooleanStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE, pagebreakBeforePrint);
}
Defines, whether the page layout manager should perform a pagebreak before this page is printed. This will have no
effect on empty pages or if the band is no root-level band. |
public String toString() {
final StringBuffer b = new StringBuffer(100);
b.append(this.getClass().getName());
b.append("={name=\"");
b.append(getName());
b.append("\", size=\"");
b.append(getElementCount());
b.append("\"}");
return b.toString();
}
Returns a string representation of the band, useful mainly for debugging
purposes. |
public final Element[] unsafeGetElementArray() {
return internalGetElementArray();
}
|