i-net Clear Reports

com.inet.report
Class Subreport

java.lang.Object
  extended by com.inet.report.ReportComponent
      extended by com.inet.report.Element
          extended by com.inet.report.AbstractFontElement
              extended by com.inet.report.Subreport
All Implemented Interfaces:
BorderProperties, FontProperties, GeneralProperties, NodeParser, com.inet.report.ReferenceHolder, SubreportProperties, TextProperties, java.io.Serializable, java.lang.Cloneable

public class Subreport
extends AbstractFontElement
implements SubreportProperties, TextProperties, com.inet.report.ReferenceHolder

Engines cannot hold more than one datasource, so if you need a report that uses data from two or more datasources, you have to use Subreport objects in the report.

Example:
You have one database to store private data of your employees. In another database (a table in the same database should also work, but no subreports are required here) you store the sales of each of your shops. So, if you want to create a report, that displays all sales according to the employee you have to create some fields in the main report that shows the employees and a subreport that have some fields to show the sales. To realise the representation of sales according to employees insert a SubreportLink using the employee id field in the main report (i.e. Employees.Id) and the employee id in the subreport (i.e. Sales.Employee-Id). Now each employee will be followed by its sales, where the sales were shown in a single object - the Subreport object.

This class is part of the RDC.

See Also:
SubreportLink, Engine, Section.addSubreport(int, int, int, int, String), Section.addSubreport(int, int, int, int), Section.remove(Element), Section.getElements(), Section.getElementsV(), Serialized Form

Field Summary
 
Fields inherited from class com.inet.report.Element
BOX, CHART, CROSSTAB, CROSSTABCELL, CROSSTABCOLUMN, CROSSTABROW, CROSSTABSECTION, DATABASE_PICTURE, FIELD, FIELDPART, JAVABEAN, LINE, PARAGRAPH, PICTURE, SIGNATURE, SUBREPORT, TEXT, TEXTPART
 
Fields inherited from interface com.inet.report.TextProperties
GLYPH_DEFAULT, GLYPH_DOWN, GLYPH_LEFT, GLYPH_RIGHT, GLYPH_UP, ROTATE_0, ROTATE_180, ROTATE_270, ROTATE_90
 
Fields inherited from interface com.inet.report.FontProperties
FONT_DIALOG, FONT_MONOSPACED, FONT_SANS_SERIF, FONT_SERIF, FONT_STYLE_BOLD, FONT_STYLE_ITALIC, FONT_STYLE_STRIKETHROUGH, FONT_STYLE_UNDERLINE
 
Fields inherited from interface com.inet.report.BorderProperties
LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_DOUBLE, LINE_STYLE_SINGLE, NO_LINE
 
Fields inherited from interface com.inet.report.GeneralProperties
ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_DEFAULT, ALIGN_HORIZONTAL_JUSTIFIED, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_RIGHT
 
Method Summary
 SubreportLink addSubreportLink(Field mainRptField, Field subRptField)
          Adds a new subreport link to the set and returns it.
 SubreportLink addSubreportLink(Field mainRptField, Field subRptField, boolean generatePrompt)
          Adds a new subreport link to the set and returns it.
 java.lang.Object copy()
          Creates a serializable copy of this Element.
 Engine getEngine()
          Returns the engine object belonging to this subreport.
 int getGlyphOrientation()
          Returns the glyph orientation.
 FormulaField getGlyphOrientationFormula()
          Returns the formula whose return value determines the glyph orientation.
 FormulaField getOnDemandLinkLabel()
          Returns a FormulaField whose return value specifies the text that is shown instead of the element content when on demand is enabled.
 FormulaField getOnDemandTabLabel()
          Returns a FormulaField whose return value specifies the name of the tab which is showing the activated element if on demand is enabled.
 java.util.List getPropertyFormulas()
          Returns a list with all property formulas that are set for this report element.
 SubreportLink getSubreportLink(int idx)
          Gets the subreport link at the specified index.
 int getSubreportLinkCount()
          Returns the number of subreport links in the set
 int getTextRotation()
          Returns the value of the property 'text rotation'.
 FormulaField getTextRotationFormula()
          Returns the formula whose return value determines the property 'text rotation'.
 boolean isOnDemand()
          Returns true if on demand is enabled else false.
 boolean isSuppressIfBlank()
          Returns true if "suppress if blank" is enabled else false.
 NodeParser parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map parserMap)
          FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML Parses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself.
 void parseEndElement(com.inet.report.parser.XMLTag group, java.lang.String tag, java.util.Map parserMap)
          FOR INTERNAL USE ONLY Internal method for reading report XML Receive notification of the end of an XML tag.
 void parseText(java.lang.String textData, java.util.Map parserMap)
          FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML This method is called if text was encountered in the context of this node.
 void removeSubreportLink(int idx)
          Removes the subreport link at the specified index.
 void setGlyphOrientation(int orientation)
          Sets the orientation of the glyphs.
 void setGlyphOrientationFormula(FormulaField formula)
          Sets the formula whose return value determines the glyph orientation.
 void setOnDemand(boolean onDemand)
          Specifies whether on demand is enabled or not.
 void setOnDemandLinkLabel(java.lang.String lab)
          If on demand is enabled, the element is shown in the report as a line of text.
 void setOnDemandLinkLabel(FormulaField lab)
          If on demand is enabled, the element is shown in the report as a line of text.
 void setOnDemandTabLabel(java.lang.String lab)
          If on demand is enabled and the element is activated, it is shown in an extra tab or window.
 void setOnDemandTabLabel(FormulaField lab)
          If on demand is enabled and the element is activated, it is shown in an extra tab or window.
 void setSuppressIfBlank(boolean suppress)
          Specifies whether "suppress if blank" is enabled or not.
 void setTextRotation(int rotation)
          Sets the value of the property 'text rotation'.
 void setTextRotationFormula(FormulaField formula)
          Sets the formula whose return value determines the property 'text rotation'.
 
Methods inherited from class com.inet.report.AbstractFontElement
getFontColor, getFontColorFormula, getFontName, getFontNameFormula, getFontSize, getFontSizeFormula, getFontSizeTwips, getFontStyle, getFontStyleFormula, getStrikeoutFormula, getUnderlineFormula, isBold, isItalic, isStrikeout, isUnderline, setBold, setFontColor, setFontColorFormula, setFontName, setFontNameFormula, setFontSize, setFontSizeFormula, setFontSizeTwips, setFontStyle, setFontStyleFormula, setItalic, setStrikeout, setStrikeoutFormula, setUnderline, setUnderlineFormula
 
Methods inherited from class com.inet.report.Element
addListener, copyXML2, getBottomLineStyle, getBottomLineStyleFormula, getCanGrowCount, getCanGrowFormula, getCloseBorderOnPageBreakFormula, getDropShadowFormula, getField, getForeColor, getForeColorFormula, getHorAlign, getHorAlignFormula, getHyperlinkUrl, getHyperlinkUrlFormula, getLeftLineStyle, getLeftLineStyleFormula, getParent, getRightLineStyle, getRightLineStyleFormula, getSuppressIfDuplicatedFormula, getTightHorizontalFormula, getToolTipsText, getToolTipsTextFormula, getTopLineStyle, getTopLineStyleFormula, indexOf, isCanGrow, isCloseBorderOnPageBreak, isDropShadow, isSuppressIfDuplicated, isTightHorizontal, paramString, removeListener, setBottomLineStyle, setBottomLineStyleFormula, setCanGrow, setCanGrowCount, setCanGrowFormula, setCloseBorderOnPageBreak, setCloseBorderOnPageBreakFormula, setDropShadow, setDropShadowFormula, setField, setForeColor, setForeColorFormula, setHorAlign, setHorAlignFormula, setHyperlinkUrl, setHyperlinkUrlFormula, setIndex, setLeftLineStyle, setLeftLineStyleFormula, setRightLineStyle, setRightLineStyleFormula, setSuppressIfDuplicated, setSuppressIfDuplicatedFormula, setTightHorizontal, setTightHorizontalFormula, setToolTipsText, setToolTipsTextFormula, setTopLineStyle, setTopLineStyleFormula
 
Methods inherited from class com.inet.report.ReportComponent
getBackColor, getBackColorFormula, getHeight, getKeepTogetherFormula, getSuppressFormula, getType, getWidth, getX, getY, isKeepTogether, isSuppress, setBackColor, setBackColorFormula, setHeight, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula, setWidth, setX, setY
 
Methods inherited from interface com.inet.report.BorderProperties
getBackColor, getBackColorFormula, setBackColor, setBackColorFormula
 
Methods inherited from interface com.inet.report.GeneralProperties
getKeepTogetherFormula, getSuppressFormula, isKeepTogether, isSuppress, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula
 
Methods inherited from interface com.inet.report.parser.NodeParser
isDOMParser, parseDOM
 

Method Detail

copy

public java.lang.Object copy()
                      throws ReportException
Creates a serializable copy of this Element. The returned Object is not an instance of Element. This method is used from i-net Designer for Copy & Paste.

Overrides:
copy in class Element
Returns:
A serializable Object.
Throws:
ReportException - If accessing properties of this Element causes any errors.
See Also:
Section.pasteElement(java.lang.Object)

getEngine

public Engine getEngine()
Returns the engine object belonging to this subreport. This is different to the super method of Element. Will return null if this subreport no longer belongs to a main report.

Overrides:
getEngine in class Element
Returns:
Engine The engine of the subreport.
See Also:
Engine, Element.getEngine()

addSubreportLink

public SubreportLink addSubreportLink(Field mainRptField,
                                      Field subRptField)
                               throws ReportException
Adds a new subreport link to the set and returns it.

Parameters:
mainRptField - The Field in the main report whose values will be used for the PromptField in the subreport.
subRptField - The Field in the subreport whose values will be used to compare with the values of the PromptField.
Returns:
The created SubreportLink object.
Throws:
ReportException - If an error occurred while creating the sub report link.

addSubreportLink

public SubreportLink addSubreportLink(Field mainRptField,
                                      Field subRptField,
                                      boolean generatePrompt)
                               throws ReportException
Adds a new subreport link to the set and returns it.

Parameters:
mainRptField - The Field in the main report whose values will be used for the PromptField in the subreport.
subRptField - The Field in the subreport whose values will be used to compare with the values of the PromptField.
generatePrompt - If true a PromptField which is used for this link is generated automatically. If set to false a PromptField has to be set with SubreportLink.setPromptField(PromptField).
Returns:
The created SubreportLink object.
Throws:
ReportException - If an error occurred while creating the sub report link.

removeSubreportLink

public void removeSubreportLink(int idx)
Removes the subreport link at the specified index.

Parameters:
idx - The 0-based index of the SubreportLink object that should be removed.
See Also:
getSubreportLinkCount()

getSubreportLink

public SubreportLink getSubreportLink(int idx)
Gets the subreport link at the specified index.

Parameters:
idx - The 0-based index of the subreport that should be returned.
Returns:
The SubreportLink object at the specified position.
See Also:
getSubreportLinkCount()

getSubreportLinkCount

public int getSubreportLinkCount()
Returns the number of subreport links in the set

Returns:
The number of subreport links.

setOnDemand

public void setOnDemand(boolean onDemand)
Specifies whether on demand is enabled or not.

Specified by:
setOnDemand in interface SubreportProperties
Parameters:
onDemand - when true on demand is enabled

isOnDemand

public boolean isOnDemand()
Returns true if on demand is enabled else false.

Specified by:
isOnDemand in interface SubreportProperties
Returns:
whether on demand is enabled
Since:
7.0

setOnDemandLinkLabel

public void setOnDemandLinkLabel(java.lang.String lab)
If on demand is enabled, the element is shown in the report as a line of text. Specify this text with this method.

Specified by:
setOnDemandLinkLabel in interface SubreportProperties
Parameters:
lab - - the text as String

setOnDemandLinkLabel

public void setOnDemandLinkLabel(FormulaField lab)
If on demand is enabled, the element is shown in the report as a line of text. Specify this text with this method.

Specified by:
setOnDemandLinkLabel in interface SubreportProperties
Parameters:
lab - - a FormulaField whose return value specifies the text.

getOnDemandLinkLabel

public FormulaField getOnDemandLinkLabel()
Returns a FormulaField whose return value specifies the text that is shown instead of the element content when on demand is enabled.

Specified by:
getOnDemandLinkLabel in interface SubreportProperties
Returns:
FormulaField

setOnDemandTabLabel

public void setOnDemandTabLabel(java.lang.String lab)
If on demand is enabled and the element is activated, it is shown in an extra tab or window. Specify the name of this tab with this method.

Specified by:
setOnDemandTabLabel in interface SubreportProperties
Parameters:
lab - - the name as String

setOnDemandTabLabel

public void setOnDemandTabLabel(FormulaField lab)
If on demand is enabled and the element is activated, it is shown in an extra tab or window. Specify the name of this tab with this method.

Specified by:
setOnDemandTabLabel in interface SubreportProperties
Parameters:
lab - - a FormulaField whose return value specifies the name.

getOnDemandTabLabel

public FormulaField getOnDemandTabLabel()
Returns a FormulaField whose return value specifies the name of the tab which is showing the activated element if on demand is enabled.

Specified by:
getOnDemandTabLabel in interface SubreportProperties
Returns:
FormulaField

getPropertyFormulas

public java.util.List getPropertyFormulas()
Returns a list with all property formulas that are set for this report element.

Overrides:
getPropertyFormulas in class AbstractFontElement
Returns:
List of property formulas

getGlyphOrientation

public int getGlyphOrientation()
Returns the glyph orientation. This is the rotation of every individual charater in the line. The default value is GLYPH_DEFAULT, that is, the glyphs point towards the source of the given block progression. Use the GLYPH constants for the orientation.

Specified by:
getGlyphOrientation in interface TextProperties
Returns:
glyph orientation
See Also:
TextProperties.setGlyphOrientation(int), TextProperties.GLYPH_DEFAULT, TextProperties.GLYPH_UP, TextProperties.GLYPH_DOWN, TextProperties.GLYPH_RIGHT, TextProperties.GLYPH_LEFT

setGlyphOrientation

public void setGlyphOrientation(int orientation)
Sets the orientation of the glyphs. This is the rotation of every individual charater in the line. The default value is GLYPH_DEFAULT, that is, the glyphs point towards the source of the given block progression. Use the GLYPH constants for the orientation.

Specified by:
setGlyphOrientation in interface TextProperties
Parameters:
orientation - Orientation to be set for the glyphs (i.e. the rotation of every individual character of the line of text)
See Also:
TextProperties.getGlyphOrientation(), TextProperties.GLYPH_DEFAULT, TextProperties.GLYPH_UP, TextProperties.GLYPH_DOWN, TextProperties.GLYPH_RIGHT, TextProperties.GLYPH_LEFT

setGlyphOrientationFormula

public void setGlyphOrientationFormula(FormulaField formula)
Sets the formula whose return value determines the glyph orientation. This is the rotation of every individual charater in each line. This formula should return one of the formula constants GlyphDefault, GlyphLeft, GlyphRight, or GlyphDown.

Specified by:
setGlyphOrientationFormula in interface TextProperties
Parameters:
formula - the formula whose return value determines the glyph orientation

getGlyphOrientationFormula

public FormulaField getGlyphOrientationFormula()
Returns the formula whose return value determines the glyph orientation. This is the rotation of every individual charater in each line. This formula should return one of the formula constants GlyphDefault, GlyphLeft, GlyphRight, or GlyphDown.

Specified by:
getGlyphOrientationFormula in interface TextProperties
Returns:
the formula whose return value determines the glyph orientation

setTextRotation

public void setTextRotation(int rotation)
Sets the value of the property 'text rotation'. This property defines a final rotation of the entire element after the text is laid out. For example, to have a text element have vertical text running from top to bottom and each line run from right to left, you'd set a glyph orientation of GLYPH_LEFT and a text rotation of ROTATE_270.

Specified by:
setTextRotation in interface TextProperties
Parameters:
rotation - The new value of the property 'text rotation'. Rotation is done counter-clockwise.
Since:
5.4
See Also:
TextProperties.ROTATE_0, TextProperties.ROTATE_90, TextProperties.ROTATE_180, TextProperties.ROTATE_270

getTextRotation

public int getTextRotation()
Returns the value of the property 'text rotation'. This property defines a final rotation of the entire element after the text is laid out. For example, to have a text element have vertical text running from top to bottom and each line run from right to left, you'd set a glyph orientation of GLYPH_LEFT and a text rotation of ROTATE_270.

Specified by:
getTextRotation in interface TextProperties
Returns:
The value of the property 'text rotation'.
Since:
5.4
See Also:
TextProperties.ROTATE_0, TextProperties.ROTATE_90, TextProperties.ROTATE_180, TextProperties.ROTATE_270

getTextRotationFormula

public FormulaField getTextRotationFormula()
Returns the formula whose return value determines the property 'text rotation'. This property defines a final rotation of the entire element after the text is laid out. This formula should return one of the formula constants Rotate0, Rotate90, Rotate180, or Rotate270.

Specified by:
getTextRotationFormula in interface TextProperties
Returns:
formula whose return value determines the property 'text rotation'.
See Also:
TextProperties.getTextRotation(), TextProperties.setTextRotation(int)

setTextRotationFormula

public void setTextRotationFormula(FormulaField formula)
Sets the formula whose return value determines the property 'text rotation'. This property defines a final rotation of the entire element after the text is laid out. This formula should return one of the formula constants Rotate0, Rotate90, Rotate180, or Rotate270.

Specified by:
setTextRotationFormula in interface TextProperties
Parameters:
formula - formula whose return value determines the property 'text rotation'.
See Also:
TextProperties.getTextRotation(), TextProperties.setTextRotation(int)

isSuppressIfBlank

public boolean isSuppressIfBlank()
Returns true if "suppress if blank" is enabled else false. A subreport is blank if all sections are suppressed or have no height. If the subreport is suppressed, the border and background will not be printed.

Specified by:
isSuppressIfBlank in interface SubreportProperties
Returns:
whether "suppress if blank" is enabled
See Also:
ReportProperties.isSuppressIfNoRows(), Section.getSuppressIfBlank()

setSuppressIfBlank

public void setSuppressIfBlank(boolean suppress)
Specifies whether "suppress if blank" is enabled or not. A subreport is blank if all sections are suppressed or have no height. If the subreport is suppressed, the border and background will not be printed.

Specified by:
setSuppressIfBlank in interface SubreportProperties
Parameters:
suppress - whether to suppress the display of this subreport if it is blank
See Also:
ReportProperties.setSuppressIfNoRows(boolean), Section.setSuppressIfBlank(boolean)

parseElement

public NodeParser parseElement(com.inet.report.parser.XMLTag group,
                               java.lang.String tag,
                               org.xml.sax.Attributes atts,
                               java.util.Map parserMap)
                        throws FatalParserException
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML

Parses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.

Specified by:
parseElement in interface NodeParser
Overrides:
parseElement in class AbstractFontElement
Parameters:
group - XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.
tag - The XMLTag to be parsed
atts - The set of attributes in the current XMLTag
parserMap - The map of current Parser.
Returns:
The NodeParser sub-element if one needed to be created, or null if none was created.
Throws:
FatalParserException - if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.

parseText

public void parseText(java.lang.String textData,
                      java.util.Map parserMap)
FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XML

This method is called if text was encountered in the context of this node. (Examples would be a formula's text or a text element's text)

Specified by:
parseText in interface NodeParser
Parameters:
textData - text encountered and to be stored
parserMap - The map of current Parser.

parseEndElement

public void parseEndElement(com.inet.report.parser.XMLTag group,
                            java.lang.String tag,
                            java.util.Map parserMap)
                     throws FatalParserException
FOR INTERNAL USE ONLY Internal method for reading report XML

Receive notification of the end of an XML tag.

Specified by:
parseEndElement in interface NodeParser
Parameters:
group - XMLTag of the current node to be parsed, or null if there is no such current group.
tag - The XMLTag to be parsed
parserMap - The map of current Parser.
Throws:
FatalParserException - if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.

i-net Clear Reports

Copyright © 1999-2011 by i-net software GmbH