public class Section extends Region implements ElementContainer
Section
class represents the sections of a report.Area
s of type: Report Header, Page Header, Group Header,
Detail, Group Footer, Report Footer and Page Footer.FieldElement
.
To do this you can use the various add methods of this class.ReportComponent.setHeight(int)
and ReportComponent.setWidth(int)
methods for changing it
manually.Vector
, that you
can access with getElementsV()
.
The index of each element is the position in this Vector
object.
You need the index if you want to remove an element (with remove(Element)
).
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEIGHT
Default value of the property 'height'.
|
DETAIL, GROUP_FOOTER, GROUP_HEADER, PAGE_FOOTER, PAGE_HEADER, REPORT_FOOTER, REPORT_HEADER
Modifier and Type | Method and Description |
---|---|
Box |
addBox(int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new
Box to this Section and returns it. |
Box |
addBox(int xpos,
int ypos,
int objwidth,
int objheight,
int y2,
Section endSection)
Adds a new
Box to this Section and returns it. |
Chart2 |
addChart2(ChartStyle style,
int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new chart element to the container and returns it.
|
CrossTab |
addCrossTab(int xpos,
int ypos,
SummaryField field)
Adds the simplest possible cross table (at least on field for summarization) into this
Section and returns it. |
DatabasePicture |
addDatabasePicture(Field field,
int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new
DatabasePicture (e.g. |
FieldElement |
addFieldElement(Field field,
int xpos,
int ypos,
int objwidth,
int objheight)
|
com.inet.report.FormFieldElement |
addFormField(int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new form field element to the container.
|
Line |
addHorizontalLine(int xpos,
int ypos,
int objwidth)
Adds a new horizontal line to the container and returns it.
|
com.inet.report.InteractiveSorting |
addInteractiveSorting(Field field,
int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new InteractiveSorting element to the container.
|
JavaBean |
addJavaBean(java.lang.String className,
int xpos,
int ypos,
int objwidth,
int objheight)
Add a new JavaBean to the container.
|
Picture |
addPicture(int xpos,
int ypos,
int objwidth,
int objheight,
java.lang.String fileName)
Adds a new picture element to the container and returns it.
|
Picture |
addPicture(int xpos,
int ypos,
int objwidth,
int objheight,
java.io.File file)
Adds a new picture element to the container and returns it.
|
Picture |
addPicture(int xpos,
int ypos,
int objwidth,
int objheight,
int[] buffer)
Adds a new picture element to the container and returns it.
|
Picture |
addPicture(int xpos,
int ypos,
int objwidth,
int objheight,
byte[] buffer)
Adds a new picture element to the container and returns it.
|
Picture |
addPicture(int xpos,
int ypos,
int objwidth,
int objheight,
java.awt.image.BufferedImage im)
Adds a new picture element to the container and returns it.
|
SignatureForm |
addSignatureForm(int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new
SignatureForm element to this Section . |
Subreport |
addSubreport(int xpos,
int ypos,
int objwidth,
int objheight,
java.lang.String filename)
Adds a new subreport element with definition from file to the container and returns it.
|
Subreport |
addSubreport(int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new subreport element to the container and returns it.
|
Text |
addText(int xpos,
int ypos,
int objwidth,
int objheight)
Adds a new text element to the container.
|
Line |
addVerticalLine(int xpos,
int ypos,
int objheight)
Adds a new vertical line to the container and returns it.
|
Line |
addVerticalLine(int xpos,
int ypos,
int y2,
Section endSection)
Adds a new vertical line to the container and returns it.
|
int |
cleanForDataExport()
All
Elements that are not FieldElements will be removed from this Section . |
void |
copyContent(Section source)
Copies content and properties of the source section into target section.
|
void |
copyContent(SimpleElementContainer source)
Copies content and properties of the source container into this container.
|
void |
copyProperties(Section source)
Some properties of the source section will be copied to this section.
|
Element[] |
getElements()
Returns an
Array containing all elements in this section. |
java.util.Vector<Element> |
getElementsV()
Returns a
Vector containing all elements in this section. |
java.lang.String |
getName()
Returns the name of the section - i.e.
|
java.lang.Object |
getParent()
Returns the parent
Area of the Section . |
java.util.List<FormulaField> |
getPropertyFormulas()
Returns a list with all property formulas that are set for this report element.
|
Element |
getReportElement(int idx)
Returns a report element.
|
int |
getReportElementsCount()
Counts the number of Report Elements in this section and returns it.
|
java.lang.String |
getSectionNameByNumber(int number)
Generates a name ending usually used for section names.
|
java.util.List<Element> |
getSubComponents()
Returns all
ReportComponent s that are descendants of this one. |
boolean |
getSuppressIfBlank()
Returns the value of the property 'suppress if blank'.
|
FormulaField |
getSuppressIfBlankFormula()
Returns the formula for the property 'suppress if blank'.
|
boolean |
getUnderlayFollow()
Returns the value of the property 'underlay follow'.
|
FormulaField |
getUnderlayFollowFormula()
Returns the formula for the property 'underlay follow'.
|
boolean |
getUseColor()
Returns the value of the property 'useColor'.
|
int |
getWidth()
Returns the width of the section.
|
int |
indexOf()
Returns the current index of this
Section in this Area . |
void |
moveElement(Element elem,
Section dest)
Moves the
Element elem from this Section to the destination Section dest . |
void |
moveElement(Element elem,
SimpleElementContainer dest)
Moves the element
elem from this container to the destination container dest . |
java.lang.String |
paramString()
Returns a string identifying this report component.
|
Element |
pasteElement(java.lang.Object copy)
Paste a copy of an
Element to this Section . |
void |
remove(Element elem)
Removes the given report element from the container.
|
void |
setSuppressIfBlank(boolean newValue)
Sets the value of the property 'suppress if blank'.
|
void |
setSuppressIfBlankFormula(FormulaField newFormula)
Sets the formula for the property 'suppress if blank'.
|
void |
setUnderlayFollow(boolean newValue)
Sets the value of the property 'underlay follow'.
|
void |
setUnderlayFollowFormula(FormulaField newFormula)
Sets the formula for the property 'underlay follow'.
|
void |
setUseColor(boolean newValue)
Sets the value of the property 'useColor'.
|
getAtBottomOfPageFormula, getNewPageAfterFormula, getNewPageBeforeFormula, getResetPageNumberFormula, getSuppressOnDrillDownFormula, getType, isAtBottomOfPage, isHeader, isNewPageAfter, isNewPageBefore, isResetPageNumber, isSuppressOnDrillDown, setAtBottomOfPage, setAtBottomOfPageFormula, setNewPageAfter, setNewPageAfterFormula, setNewPageBefore, setNewPageBeforeFormula, setResetPageNumber, setResetPageNumberFormula, setSuppressOnDrillDown, setSuppressOnDrillDownFormula
getBackColor, getBackColorFormula, getHeight, getKeepTogetherFormula, getSuppressFormula, getX, getY, isKeepTogether, isSuppress, setBackColor, setBackColorFormula, setHeight, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula, setWidth, setX, setY
isDOMParser, parseDOM, parseElement, parseEndElement, parseText
public static final int DEFAULT_HEIGHT
public java.lang.Object getParent() throws java.lang.IllegalStateException
Area
of the Section
.Area
.java.lang.IllegalStateException
- if the type of the section is invalid.public java.lang.String paramString()
paramString
in class ReportComponent
public Element pasteElement(java.lang.Object copy) throws ReportException
Element
to this Section
.
The parameter is not an instance of Element
.
If the Element
needs references to a Field
or a Group
then these objects must exist in this Engine
.
In the other cases a ReportException
will be thrown.
The coordinates on that the Element
will be paste in the Section
are the coordinates of the copied element.pasteElement
in interface ElementContainer
copy
- An object created with the method Element.copy()
.Element
.ReportException
- If the Element
cannot be created because of missing references.Element.copy()
public void moveElement(Element elem, Section dest) throws ReportException
Element elem
from this Section
to the destination Section dest
.elem
- The Element
, which should move to another Section
.dest
- The destination Section
of movement.ReportException
- will thrown if dest
or elem
is null
.Element.setIndex(int)
public java.util.Vector<Element> getElementsV()
Vector
containing all elements in this section. Each element in the returned Vector is an instance of class Element
or an instance of Elements subclasses.getElementsV
in interface SimpleElementContainer
Vector
containing all elements in this section.getElements()
,
Element
public Element[] getElements()
Array
containing all elements in this section. Each field of the Array
contains an instance of class
Element
or an instance of Elements subclasses.getElements
in interface SimpleElementContainer
Array
containing all elements in this Section
.getElementsV()
,
Element
public FieldElement addFieldElement(Field field, int xpos, int ypos, int objwidth, int objheight) throws ReportException
FieldElement
(a dynamic text element based on a Field
) to this Section
and returns it.
Note that for binary fields you need to use the method addDatabasePicture(Field, int, int, int, int)
, since picture
fields are not FieldElement
s.addFieldElement
in interface SimpleElementContainer
field
- The field that should added into Section
. May not be null.xpos
- The x-coordinate of the upper left corner in twips.ypos
- The y-coordinate of the upper left corner in twips.objwidth
- The width of the new FieldElement
in twips.objheight
- The height of the new FieldElement
in twips.FieldElement
or null
if the creation was not successfull.ReportException
- if the value type of the field is binary - use addDatabasePicture(Field, int, int, int, int)
instead.java.lang.IllegalArgumentException
- if the parameters x, y, width or height are negative or the field is nullDatabaseField
,
FormulaField
,
PromptField
,
SummaryField
,
SQLField
,
GroupField
public DatabasePicture addDatabasePicture(Field field, int xpos, int ypos, int objwidth, int objheight)
DatabasePicture
(e.g. Blob) to this Section
and returns it.addDatabasePicture
in interface SimpleElementContainer
field
- Field which valuetype is Field.BINARY and that should be
added to the section. This can be a database field, a formula field, a prompt field or a SQL field.xpos
- x-coordinate of the upper left corner in twips.ypos
- y-coordinate of the upper left corner in twips.objwidth
- Width of the new fieldElement in twips.objheight
- Height of the new fieldElement in twips.public Box addBox(int xpos, int ypos, int objwidth, int objheight)
Box
to this Section
and returns it.addBox
in interface SimpleElementContainer
xpos
- The horizontal offset in twips.ypos
- The vertical offset in twips.objwidth
- The width of the box in twips.objheight
- The height of the box in twips.Box
element or null
if the creation was not successfulljava.lang.IllegalArgumentException
- If the parameter width or height are negative.public Box addBox(int xpos, int ypos, int objwidth, int objheight, int y2, Section endSection)
Box
to this Section
and returns it.addBox
in interface ElementContainer
xpos
- The horizontal offset in twips.ypos
- The vertical offset in twips.objwidth
- The width of the box in twips.objheight
- The minimal height of the box in start section in twips.y2
- The vertical offset of the end point in end sectionendSection
- The section where the box endspublic CrossTab addCrossTab(int xpos, int ypos, SummaryField field)
Section
and returns it. To
make this cross table more complex use the add and append methods in class com.inet.report.CrossTab
.addCrossTab
in interface ElementContainer
xpos
- The x position of the upper left corner of the whole cross table in twips..ypos
- The y position of the upper left corner of the whole cross table in twips..field
- The field to summarize in cross table.java.lang.IllegalArgumentException
- if the parameters x or y are negativeCrossTab
public Chart2 addChart2(ChartStyle style, int xpos, int ypos, int objwidth, int objheight)
BarStyle.BAR2D
for a simple bar chart 2D.
To see which chart types are allowed see the subclasses of ChartStyle
.
Initializes all properties with default values.addChart2
in interface ElementContainer
style
- the style of chart.xpos
- the x offset of the upper left corner in twips.ypos
- the y offset of the upper left corner in twips.objwidth
- the total width of the chart element in twips.objheight
- the total height of the chart element in twips.Chart2
,
ChartStyle
,
BarStyle
,
LineStyle
,
AreaStyle
,
Chart3DStyle
,
PieStyle
,
XYStyle
,
StockStyle
,
ContinuousStyle
,
GanttStyle
,
SimpleElementContainer.remove(Element)
,
SimpleElementContainer.getElements()
public Line addHorizontalLine(int xpos, int ypos, int objwidth)
addHorizontalLine
in interface SimpleElementContainer
xpos
- the horizontal offset of the start point in twips.ypos
- the vertical offset of the start point in twips.objwidth
- the width of the line in twips.public JavaBean addJavaBean(java.lang.String className, int xpos, int ypos, int objwidth, int objheight) throws ReportException
addJavaBean
in interface SimpleElementContainer
className
- The class name of the Java Bean.xpos
- The x-coordinate of the upper left corner in twips.ypos
- The y-coordinate of the upper left corner in twips.objwidth
- The width of the new fieldElement in twips.objheight
- The height of the new fieldElement in twips.ReportException
- if the Java Bean cannot created.public Line addVerticalLine(int xpos, int ypos, int objheight)
addVerticalLine
in interface SimpleElementContainer
xpos
- the horizontal offset of the start point in twips.ypos
- the vertical offset of the start point in twips.objheight
- the height of the line in twips.public Line addVerticalLine(int xpos, int ypos, int y2, Section endSection)
addVerticalLine
in interface ElementContainer
xpos
- The horizontal offset of the start point in twips.ypos
- The vertical offset of the start point in twips.y2
- The vertical offset of the end point in end section in twips.endSection
- The section where the line should end.public Picture addPicture(int xpos, int ypos, int objwidth, int objheight, java.lang.String fileName) throws ReportException
addPicture
in interface SimpleElementContainer
xpos
- The horizontal offset of the start point in twips.ypos
- The vertical offset of the start point in twips.objwidth
- The width of the picture in twipsobjheight
- The height of the picture in twips.fileName
- The absolute or relative to working directory path to the image.ReportException
- will thrown if file
is an unknown picture format.SimpleElementContainer.addPicture(int,int,int,int,java.awt.image.BufferedImage)
,
SimpleElementContainer.addPicture(int,int,int,int,java.io.File)
,
SimpleElementContainer.addPicture(int,int,int,int,byte[])
,
SimpleElementContainer.addPicture(int, int, int, int, int[])
public Picture addPicture(int xpos, int ypos, int objwidth, int objheight, java.io.File file) throws ReportException
addPicture
in interface SimpleElementContainer
xpos
- The horizontal offset of the start point in twips.ypos
- The vertical offset of the start point in twips.objwidth
- The width of the picture in twips.objheight
- The height of the picture in twips.file
- The file object to the image.ReportException
- will thrown if file
is an unknown picture format.SimpleElementContainer.addPicture(int, int, int, int, BufferedImage)
,
SimpleElementContainer.addPicture(int, int, int, int, String)
,
SimpleElementContainer.addPicture(int, int, int, int, byte[])
,
SimpleElementContainer.addPicture(int, int, int, int, int[])
public Picture addPicture(int xpos, int ypos, int objwidth, int objheight, int[] buffer) throws ReportException
addPicture
in interface SimpleElementContainer
xpos
- The horizontal offset of the start point in twips.ypos
- The vertical offset of the start point in twips.objwidth
- The width of the picture in twips.objheight
- The height of the picture in twips.buffer
- A int[] with image header and data.ReportException
- ReportException will thrown if buffer
is an unknown picture format.SimpleElementContainer.addPicture(int, int, int, int, java.awt.image.BufferedImage)
,
SimpleElementContainer.addPicture(int, int, int, int, String)
,
SimpleElementContainer.addPicture(int, int, int, int, byte[])
,
SimpleElementContainer.addPicture(int, int, int, int, File)
,
SimpleElementContainer.addPicture(int,int,int,int,java.io.File)
,
SimpleElementContainer.addPicture(int,int,int,int,String)
public Picture addPicture(int xpos, int ypos, int objwidth, int objheight, byte[] buffer) throws ReportException
addPicture
in interface SimpleElementContainer
xpos
- The horizontal offset of the start point in twips.ypos
- The vertical offset of the start point in twips.objwidth
- The width of the picture in twips.objheight
- The height of the picture in twips.buffer
- A byte[] with image header and data.ReportException
- ReportException will thrown if buffer
is an unknown picture format.SimpleElementContainer.addPicture(int,int,int,int,java.awt.image.BufferedImage)
,
SimpleElementContainer.addPicture(int, int, int, int, String)
,
SimpleElementContainer.addPicture(int,int,int,int,java.io.File)
,
SimpleElementContainer.addPicture(int, int, int, int, int[])
public Picture addPicture(int xpos, int ypos, int objwidth, int objheight, java.awt.image.BufferedImage im) throws ReportException
addPicture
in interface SimpleElementContainer
xpos
- The horizontal offset of the start point in twips.ypos
- The vertical offset of the start point in twips.objwidth
- The width of the picture in twips.objheight
- The height of the picture in twips.im
- The image object.ReportException
- ReportException will thrown if im
is an unknown picture format.SimpleElementContainer.addPicture(int, int, int, int, String)
,
SimpleElementContainer.addPicture(int,int,int,int,java.io.File)
,
SimpleElementContainer.addPicture(int,int,int,int,byte[])
,
SimpleElementContainer.addPicture(int, int, int, int, int[])
public void copyContent(Section source)
source
- The sections thats content and properties should copied.public Subreport addSubreport(int xpos, int ypos, int objwidth, int objheight, java.lang.String filename) throws ReportException, java.net.MalformedURLException, java.io.FileNotFoundException
addSubreport
in interface ElementContainer
xpos
- The x offset of the left upper corner of subreport frame.ypos
- The y offset of the left upper corner of subreport frame.objwidth
- The width of the subreport frame.objheight
- The height of the subreport frame.filename
- The file name of the subreport to insert.ReportException
- if Engine is not initialized or finished.java.net.MalformedURLException
- Thrown to indicate that a malformed URL has occurred.java.io.FileNotFoundException
- If no file for the subreport were found.public Subreport addSubreport(int xpos, int ypos, int objwidth, int objheight)
addSubreport
in interface ElementContainer
xpos
- The x offset of the left upper corner of subreport frame.ypos
- The y offset of the left upper corner of subreport frame.objwidth
- The width of the subreport frame.objheight
- The height of the subreport frame.public Text addText(int xpos, int ypos, int objwidth, int objheight)
addParagraph
method.
The returned text element is empty, that means it contains no paragraph object.addText
in interface SimpleElementContainer
xpos
- the x offset of the text elementypos
- the y offset of the text elementobjwidth
- the width of the text elementobjheight
- the height of the text elementpublic com.inet.report.FormFieldElement addFormField(int xpos, int ypos, int objwidth, int objheight)
addFormField
in interface ElementContainer
xpos
- The x offset of the left upper corner of the form field.ypos
- The y offset of the left upper corner of the form field.objwidth
- The width of the form field.objheight
- The height of the form field.public com.inet.report.InteractiveSorting addInteractiveSorting(Field field, int xpos, int ypos, int objwidth, int objheight)
addInteractiveSorting
in interface ElementContainer
field
- the a group field or a sorting field which sorting should be interactive.xpos
- The x offset of the left upper corner of the form field.ypos
- The y offset of the left upper corner of the form field.objwidth
- The width of the form field.objheight
- The height of the form field.public void remove(Element elem)
remove
in interface SimpleElementContainer
elem
- The Report Element which should be removed from the container (null
is not permitted).public java.lang.String getSectionNameByNumber(int number) throws ReportException
number
- - A number greater than 0; usually the index of the section in the sections set.ReportException
- if number is lesser than 0public java.lang.String getName() throws ReportException
ReportException
- will thrown if Section was not found.public void setSuppressIfBlank(boolean newValue)
newValue
- The new value of the property 'suppress if blank'.public boolean getSuppressIfBlank()
public void setSuppressIfBlankFormula(FormulaField newFormula)
newFormula
- The new formula for the property 'suppress if blank'.public FormulaField getSuppressIfBlankFormula()
public void setUnderlayFollow(boolean newValue)
newValue
- The new value of the property 'underlay follow'.public boolean getUnderlayFollow()
public void setUnderlayFollowFormula(FormulaField newFormula)
newFormula
- The new formula for the property 'underlay follow'.public FormulaField getUnderlayFollowFormula()
public int getReportElementsCount()
getReportElementsCount
in interface SimpleElementContainer
public Element getReportElement(int idx)
getReportElement
in interface SimpleElementContainer
idx
- The 0-based index of the element, which should be returned.FieldElement
,
Line
,
Box
,
Picture
,
DatabasePicture
,
Chart2
,
Subreport
,
CrossTab
,
Text
public int indexOf()
Section
in this Area
.indexOf
in class ReportComponent
java.lang.IllegalStateException
- Thrown if this section was not found in the parent area.public java.util.List<FormulaField> getPropertyFormulas()
ReportComponent
of this one. To get the property formulas for descendant ReportComponent
use ReportComponent.getSubComponents()
getPropertyFormulas
in class Region
public void setUseColor(boolean newValue)
newValue
- The new value of the property 'useColor'.public boolean getUseColor()
public int getWidth()
Engine.getReportProperties().getPaperWidth()-Engine.getReportProperties().getMarginLeft()-Engine.getReportProperties().getMarginRight()
for all main reports.getWidth
in class ReportComponent
public SignatureForm addSignatureForm(int xpos, int ypos, int objwidth, int objheight)
SignatureForm
element to this Section
. This signature element is useful for PDF export, only.addSignatureForm
in interface ElementContainer
xpos
- the x position of the signature form element.ypos
- the y position of the signature form element.objwidth
- the width of the signature form element.objheight
- the height of the signature form element.java.lang.IllegalArgumentException
- if the parameters x, y, width or height are negativepublic void copyProperties(Section source)
source
- section to be copied.public void copyContent(SimpleElementContainer source)
copyContent
in interface ElementContainer
source
- The container thats content and properties should copied.public void moveElement(Element elem, SimpleElementContainer dest) throws ReportException
elem
from this container to the destination container dest
.moveElement
in interface ElementContainer
elem
- The element, which should move to another container.dest
- The destination container of movement.ReportException
- will thrown if dest
or elem
is
null
.Element.setIndex(int)
public int cleanForDataExport()
Elements
that are not FieldElements
will be removed from this Section
.
All suppressed elements apart from FormulaFields
will be removed too.
All remaining elements will be sorted on their x position.public java.util.List<Element> getSubComponents()
ReportComponent
s that are descendants of this one. E.G. this will return all Element
of a Section
. But it's as well useful for CrossTab
s or Text
elements which have
additional elements.getSubComponents
in class ReportComponent
null
if the component has no descendantsCopyright © 1999-2020 by i-net software GmbH