Style Intelligence v12.0

inetsoft.report
Class SectionBand

java.lang.Object
  extended by inetsoft.report.FixedContainer
      extended by inetsoft.report.SectionBand
All Implemented Interfaces:
Serializable, Cloneable

public class SectionBand
extends FixedContainer

A SectionBand contains the elements in a section frame. The section frame always takes the entire page width, with the specified height. All elements in a frame are drawn at fixed position and size relative to the frame.

A section band can be declared as 'Shrink to Fit'. If this is true, the height of the band could shrink if the elements in the band does not use its occupied space. This is normally used to handle elements with wide range of size. Those elements can be allocated a large size at design time. The band will dynamically adjust its height to adopt to the actual element size.

A section band can also contain a subreport. A subreport is a complete report embedded inside a section. Section band fields can be used to supply subreport parameter values. The subreport is printed inside a band. The band automatically grows with the subreport, and could potentially span across multiple pages.

See Also:
Serialized Form

Nested Class Summary
static class SectionBand.Separator
          Separator is used for describe a vertical seperator in section.
 
Field Summary
 
Fields inherited from class inetsoft.report.FixedContainer
parent
 
Constructor Summary
SectionBand(ReportSheet report)
          Create a section band.
 
Method Summary
 String addSubreport(ReportSheet subreport, String[][] binding, Rectangle bounds)
          Add a subreport to this section band.
 String addText(String binding, String text, Rectangle bounds)
          Add a text element to the document.
 String addTextBox(String binding, String text, int border, int textalign, Rectangle bounds)
          Add a text box to the document.
 Object clone()
           
 void collapse()
          Collapse the band.
 void expand()
          Expand the band.
 void forceBreakable()
          Force the band to be breakable.
 Color getBackground()
          Return the section band background.
 String getBinding(String id)
          Get the binding of a field.
 int getBottomBorder()
          Get the section band bottom border style.
 Color getBottomBorderColor()
          Get the section band bottom border color.
 GroupableCellBinding getCellBinding(String id)
          Get cell binding.
 Enumeration getFields()
          Get the names of the fields bound to elements in this band.
 float getHeight()
          Get the height of the frame.
 int getLeftBorder()
          Get the section band left border style.
 Color getLeftBorderColor()
          Get the section band left border color.
 int getRightBorder()
          Get the section band right border style.
 Color getRightBorderColor()
          Get the section band right border color.
 int getTopBorder()
          Get the section band top border style.
 Color getTopBorderColor()
          Get the section band top border color.
 Object getValue(String id)
          Get the raw value of an element.
 boolean isAtBottom()
          Check if this section band should be printed at the bottom of a page.
 boolean isBound(String field)
          Check if a field is ever bound in this section band.
 boolean isBreakable()
          Check if this band can be broken into regions across page boundary.
 boolean isCollapsed()
          Check whether the band is collapsed.
 boolean isForceBreakable()
          Check whether the band was force to be broken.
 boolean isForceNewPage()
          Check if force a new page before or after this band is printed.
 boolean isKeepTogether()
          Check whether to keep group bands together.
 boolean isOrphanControl()
          Check the current widow/orphan control setting.
 boolean isPageAfter()
          Check if a new page should be advanced to after this band is printed.
 boolean isPageBefore()
          Check if this band should always start at the top of a page.
 boolean isPrintable()
          Check if this band is visible.
 boolean isRepeatHeader()
          Check if this band should be repeated at top of every page the group is printed.
 boolean isSheetAfter()
          Check if a new sheet should be advanced to after this band is export.
 boolean isSheetBefore()
          Check if this band should always start at the top of a sheet.
 boolean isShrinkToFit()
          Get the shrink to fit option.
 boolean isSuppressBlank()
          Check if blank section band is suppressed.
 boolean isUnderlay()
          Check if this band should underlay the subsequent bands.
 boolean isVisible()
          Check if this band is visible.
 void removeAllElements()
          Remove all elements.
 void removeAllValues()
          Remove all field values stored in the band.
 void removeElement(String id)
          Remove the specified element.
 void reset()
          Reset the internal state so it's ready for next printing.
 void reset(boolean continued)
          This method selectively calls reset() only when a band is continued on the next page.
 void resetForceBreakable()
          Reset the band to not be force broken.
 void setAtBottom(boolean bottom)
          Set whether this section band should be printed at the bottom of a page.
 void setBackground(Color bg)
          Set the section band background.
 void setBinding(String id, String field)
          Set the binding of a field element.
 void setBottomBorder(int border)
          Set the section band bottom border line style.
 void setBottomBorderColor(Color border)
          Set the section band bottom border line color.
 void setBreakable(boolean breakable)
          Control if a band can span across pages.
 void setCellBinding(String id, GroupableCellBinding binding)
          Set binding for the element.
 void setElement(int idx, ReportElement elem)
          Replace an element at the specified position.
 void setForceNewPage(boolean force)
          Set whether force a new page before or after this band is printed.
 void setHeight(float inch)
          Set the frame height.
 void setKeepTogether(boolean keepTogether)
          Set whether to keep group bands together.
 void setLeftBorder(int border)
          Set the section band left border line style.
 void setLeftBorderColor(Color border)
          Set the section band left border line color.
 void setOrphanControl(boolean orphan)
          Set the section widow/orphan control option.
 void setPageAfter(boolean pg)
          Set whether a new page should be advanced to after this band is printed.
 void setPageBefore(boolean pg)
          Set whether a new page should be advanced to before this band is printed.
 void setPresenter(String id, Presenter presenter)
          Set a presenter for an element.
 void setRepeatHeader(boolean flag)
          Set whether this band should be repeated at top of every page.
 void setRightBorder(int border)
          Set the section band right border line style.
 void setRightBorderColor(Color border)
          Set the section band right border line color.
 void setSheetAfter(boolean sheetAfter)
          Set whether a new sheet should be advanced to after this band is export.
 void setSheetBefore(boolean sheetBefore)
          Set whether a new sheet should be advanced to before this band is export.
 void setShrinkToFit(boolean shrink)
          Set shrink to fit option.
 void setSuppressBlank(boolean suppressBlank)
          Set suppress blank section band option.
 void setTopBorder(int border)
          Set the section band top border line style.
 void setTopBorderColor(Color border)
          Set the section band top border line color.
 void setUnderlay(boolean underlay)
          Set whether this band should underlay the subsequent bands.
 void setValue(String id, Object val)
          Save the original value of an element.
 void setVisible(boolean vis)
          Show or hide this band.
 String toString()
          Get the string representation.
 
Methods inherited from class inetsoft.report.FixedContainer
addBean, addBullet, addBullet, addChart, addComponent, addElement, addElement, addForm, addImage, addPainter, addSeparator, addShape, addTab, addTable, addText, addText, addTextBox, addTextBox, addTextBox, addTOC, elements, elements, getBounds, getElement, getElement, getElementCount, getElementIndex, getElementIndex, getPrintBounds, getReport, getShape, getShapeCount, getShapeIndex, getVSeparator, getVSeparators, removeElement, removeShape, setBounds, setPrintBounds, setReport, setVSeparator, setVSeparators
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SectionBand

public SectionBand(ReportSheet report)
Create a section band. The report must be the report where the section band will be used.

Parameters:
report - the report this band is associated with.
Method Detail

getHeight

public float getHeight()
Get the height of the frame.

Returns:
height in inches.

setHeight

public void setHeight(float inch)
Set the frame height.

Parameters:
inch - frame height in inches.

isShrinkToFit

public boolean isShrinkToFit()
Get the shrink to fit option.


setShrinkToFit

public void setShrinkToFit(boolean shrink)
Set shrink to fit option. If this is set, the band is shrunk to fit the contents in the band. This can be used to allow optional multiple line fields. The fields in the band can be set to their maximum size during design. The band will adjust itself to fit the actual contents in the fields.


isRepeatHeader

public boolean isRepeatHeader()
Check if this band should be repeated at top of every page the group is printed. This flag is only recognized for header bands.


setRepeatHeader

public void setRepeatHeader(boolean flag)
Set whether this band should be repeated at top of every page.


isUnderlay

public boolean isUnderlay()
Check if this band should underlay the subsequent bands.


setUnderlay

public void setUnderlay(boolean underlay)
Set whether this band should underlay the subsequent bands.


isAtBottom

public boolean isAtBottom()
Check if this section band should be printed at the bottom of a page.


setAtBottom

public void setAtBottom(boolean bottom)
Set whether this section band should be printed at the bottom of a page.


isKeepTogether

public boolean isKeepTogether()
Check whether to keep group bands together.


setKeepTogether

public void setKeepTogether(boolean keepTogether)
Set whether to keep group bands together. This is only used on group header bands.


setOrphanControl

public void setOrphanControl(boolean orphan)
Set the section widow/orphan control option. If set, no single group header or footer is printed on the page by itself.

Parameters:
orphan - true to eliminate widow/orphan header/footer.

isOrphanControl

public boolean isOrphanControl()
Check the current widow/orphan control setting.

Returns:
widow/orphan control option.

isSuppressBlank

public boolean isSuppressBlank()
Check if blank section band is suppressed.


setSuppressBlank

public void setSuppressBlank(boolean suppressBlank)
Set suppress blank section band option. A band is considered blank if all fields (from the corresponding row) are null or blank string.


isBreakable

public boolean isBreakable()
Check if this band can be broken into regions across page boundary.

Returns:
true if band can span across pages. Default to true.

setBreakable

public void setBreakable(boolean breakable)
Control if a band can span across pages.

Parameters:
breakable - true to enable spanning across pages.

getBinding

public String getBinding(String id)
Get the binding of a field.

Parameters:
id - field element ID.
Returns:
data column name the field is bound to.

setBinding

public void setBinding(String id,
                       String field)
Set the binding of a field element. Binding defines the data column to band field mapping. When this band is printed, field values are retrieved from the specified columns in the table.

Parameters:
id - element ID.
field - binding field.

setCellBinding

public void setCellBinding(String id,
                           GroupableCellBinding binding)
Set binding for the element.


getCellBinding

public GroupableCellBinding getCellBinding(String id)
Get cell binding.


isBound

public boolean isBound(String field)
Check if a field is ever bound in this section band.

Returns:
true is the field is bound in this band.

removeAllElements

public void removeAllElements()
Remove all elements.

Overrides:
removeAllElements in class FixedContainer

getValue

public Object getValue(String id)
Get the raw value of an element. This value may be different from the value in the element because it's not formatted.


setValue

public void setValue(String id,
                     Object val)
Save the original value of an element. This does not bind the value to the element, but save it so later it can be retrieved.


getFields

public Enumeration getFields()
Get the names of the fields bound to elements in this band. The field values can be accessed using getValue().


removeAllValues

public void removeAllValues()
Remove all field values stored in the band.


isVisible

public boolean isVisible()
Check if this band is visible.


setVisible

public void setVisible(boolean vis)
Show or hide this band.

Parameters:
vis - false to hide this band.

isPrintable

public boolean isPrintable()
Check if this band is visible.


isPageBefore

public boolean isPageBefore()
Check if this band should always start at the top of a page.


setPageBefore

public void setPageBefore(boolean pg)
Set whether a new page should be advanced to before this band is printed.


isPageAfter

public boolean isPageAfter()
Check if a new page should be advanced to after this band is printed.


setPageAfter

public void setPageAfter(boolean pg)
Set whether a new page should be advanced to after this band is printed.


isSheetBefore

public boolean isSheetBefore()
Check if this band should always start at the top of a sheet.


setSheetBefore

public void setSheetBefore(boolean sheetBefore)
Set whether a new sheet should be advanced to before this band is export.


isSheetAfter

public boolean isSheetAfter()
Check if a new sheet should be advanced to after this band is export.


setSheetAfter

public void setSheetAfter(boolean sheetAfter)
Set whether a new sheet should be advanced to after this band is export.


isForceNewPage

public boolean isForceNewPage()
Check if force a new page before or after this band is printed.


setForceNewPage

public void setForceNewPage(boolean force)
Set whether force a new page before or after this band is printed.


getBackground

public Color getBackground()
Return the section band background.


setBackground

public void setBackground(Color bg)
Set the section band background. The band is transparent if the background is null.


getTopBorder

public int getTopBorder()
Get the section band top border style. The style is one of the line styes defined in StyleConstants.


setTopBorder

public void setTopBorder(int border)
Set the section band top border line style.


getLeftBorder

public int getLeftBorder()
Get the section band left border style. The style is one of the line styes defined in StyleConstants.


setLeftBorder

public void setLeftBorder(int border)
Set the section band left border line style.


getBottomBorder

public int getBottomBorder()
Get the section band bottom border style. The style is one of the line styes defined in StyleConstants.


setBottomBorder

public void setBottomBorder(int border)
Set the section band bottom border line style.


getRightBorder

public int getRightBorder()
Get the section band right border style. The style is one of the line styes defined in StyleConstants.


setRightBorder

public void setRightBorder(int border)
Set the section band right border line style.


getTopBorderColor

public Color getTopBorderColor()
Get the section band top border color.


setTopBorderColor

public void setTopBorderColor(Color border)
Set the section band top border line color.


getLeftBorderColor

public Color getLeftBorderColor()
Get the section band left border color.


setLeftBorderColor

public void setLeftBorderColor(Color border)
Set the section band left border line color.


getBottomBorderColor

public Color getBottomBorderColor()
Get the section band bottom border color.


setBottomBorderColor

public void setBottomBorderColor(Color border)
Set the section band bottom border line color.


getRightBorderColor

public Color getRightBorderColor()
Get the section band right border color.


setRightBorderColor

public void setRightBorderColor(Color border)
Set the section band right border line color.


addText

public String addText(String binding,
                      String text,
                      Rectangle bounds)
Add a text element to the document. The text string can be a simple string, or contains multiple lines separated by the newline character.

Parameters:
binding - the column the element is bound to.
text - text string.
Returns:
element id.

addTextBox

public String addTextBox(String binding,
                         String text,
                         int border,
                         int textalign,
                         Rectangle bounds)
Add a text box to the document. A text box is a standalone area on the document that contains a text string. It has a border around by default. The text box element is similar to the painter elements in that they both use the painter layout and wrapping options. The current setting of the painter layout and wrapping are used by the text box elements as well.

Parameters:
binding - the column the element is bound to.
text - text content.
border - border line style. One of the line styles defined in the StyleConstants class.
textalign - text alignment within the box.
Returns:
element id.

addSubreport

public String addSubreport(ReportSheet subreport,
                           String[][] binding,
                           Rectangle bounds)
Add a subreport to this section band.

Parameters:
subreport - subreport object.
binding - this is a two dimensional array. Each row in the array must be a two element pair. The first value in the pair is the name of a subreport parameter, the second value is a name of a table column bound to this band, or the name of an element in this band. The column or element value is used as the corresponding parameter value.

setPresenter

public void setPresenter(String id,
                         Presenter presenter)
Set a presenter for an element. The presenter will be used to draw the value bound to that element at runtime.


removeElement

public void removeElement(String id)
Remove the specified element.

Parameters:
id - element id.

setElement

public void setElement(int idx,
                       ReportElement elem)
Replace an element at the specified position.

Overrides:
setElement in class FixedContainer

clone

public Object clone()
Overrides:
clone in class FixedContainer

expand

public void expand()
Expand the band.


collapse

public void collapse()
Collapse the band.


isCollapsed

public boolean isCollapsed()
Check whether the band is collapsed.


forceBreakable

public void forceBreakable()
Force the band to be breakable.


resetForceBreakable

public void resetForceBreakable()
Reset the band to not be force broken.


isForceBreakable

public boolean isForceBreakable()
Check whether the band was force to be broken.


reset

public void reset(boolean continued)
This method selectively calls reset() only when a band is continued on the next page.

Parameters:
continued - Specifies if continued at top of next page

reset

public void reset()
Reset the internal state so it's ready for next printing.

Overrides:
reset in class FixedContainer

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.