net.sf.jasperreports.crosstabs
Interface JRCrosstab

All Superinterfaces:
JRChild, JRElement, JRStyleContainer
All Known Implementing Classes:
JRBaseCrosstab, JRDesignCrosstab, JRFillCrosstab

public interface JRCrosstab
extends JRElement

Crosstab element interface.

Version:
$Id: JRCrosstab.java,v 1.3 2005/11/28 09:20:43 teodord Exp $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Field Summary
static int DEFAULT_COLUMN_BREAK_OFFSET
          The default offset used for column breaks.
 
Fields inherited from interface net.sf.jasperreports.engine.JRElement
MODE_OPAQUE, MODE_TRANSPARENT, POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM, POSITION_TYPE_FIX_RELATIVE_TO_TOP, POSITION_TYPE_FLOAT, STRETCH_TYPE_NO_STRETCH, STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT, STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
 
Method Summary
 JRCrosstabCell[][] getCells()
          Returns the data cell matrix.
 int getColumnBreakOffset()
          Returns the column break offset.
 JRCrosstabColumnGroup[] getColumnGroups()
          Returns the column groups of the crosstab.
 JRCrosstabDataset getDataset()
          Returns the input dataset of the crosstab.
 JRElement getElementByKey(java.lang.String key)
          Searches for an element inside all crosstab cells.
 int getId()
          Returns the ID of the crosstab.
 JRCrosstabMeasure[] getMeasures()
          Returns the crosstab measures.
 JRCrosstabParameter[] getParameters()
          Returns the crosstab parameters.
 JRExpression getParametersMapExpression()
          Returns the parameters map expression.
 JRCrosstabRowGroup[] getRowGroups()
          Returns the row groups of the crosstab.
 JRCellContents getWhenNoDataCell()
          Returns a cell which will be rendered when no data was fed to the crosstab.
 boolean isRepeatColumnHeaders()
          Returns whether to repeat the column headers after a row break.
 boolean isRepeatRowHeaders()
          Returns whether to repeat the row headers after a column break.
 
Methods inherited from interface net.sf.jasperreports.engine.JRElement
collectExpressions, getBackcolor, getElementGroup, getForecolor, getHeight, getKey, getMode, getOwnBackcolor, getOwnForecolor, getOwnMode, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getStretchType, getWidth, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setBackcolor, setForecolor, setMode, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
 
Methods inherited from interface net.sf.jasperreports.engine.JRChild
getCopy, writeXml
 
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyle
 

Field Detail

DEFAULT_COLUMN_BREAK_OFFSET

public static final int DEFAULT_COLUMN_BREAK_OFFSET
The default offset used for column breaks.

See Also:
getColumnBreakOffset(), Constant Field Values
Method Detail

getId

public int getId()
Returns the ID of the crosstab.

The ID is generated when the report is compiled and is used internally.

Returns:
the ID of the crosstab

getDataset

public JRCrosstabDataset getDataset()
Returns the input dataset of the crosstab.

Returns:
the input dataset of the crosstab

getRowGroups

public JRCrosstabRowGroup[] getRowGroups()
Returns the row groups of the crosstab.

Returns:
the row groups

getColumnGroups

public JRCrosstabColumnGroup[] getColumnGroups()
Returns the column groups of the crosstab.

Returns:
the column groups

getMeasures

public JRCrosstabMeasure[] getMeasures()
Returns the crosstab measures.

Returns:
the crosstab measures

getColumnBreakOffset

public int getColumnBreakOffset()
Returns the column break offset.

When the crosstab columns do not fit the width, the crosstab breaks the columns and prints the ones that don't fit after printing the first set of columns for all rows. This method returns the offset to be used when continuing the printing after a column break.

Returns:
the column break offset

isRepeatColumnHeaders

public boolean isRepeatColumnHeaders()
Returns whether to repeat the column headers after a row break.

Returns:
whether to repeat the column headers after a row break

isRepeatRowHeaders

public boolean isRepeatRowHeaders()
Returns whether to repeat the row headers after a column break.

Returns:
whether to repeat the row headers after a column break

getCells

public JRCrosstabCell[][] getCells()
Returns the data cell matrix.

A crosstab can have multiple data cells for row/groups totals. These cells are organized in a (rowGroupCount + 1) x (columnGroupCount + 1) matrix as following:

E.g. if the crosstab has Country and City (subgroup of Country) row groups and Year and Month column groups, the cells will be organized in the following matrix

0/Years total 1/Months total 2/Base
0/Countries total Total for all countries and all years Total for all countries and a year Total for all countries and a month
1/Cities total Total for a country and all years Total for a country and a year Total for a country and a month
2/Base Total for a city and all years Total for a city and a year Total for a city and a month

If the data cell for a total row/column is not specified, the cell will be inherited from lower levels, if possible. For example, if the "Total for all countries and a year" cell is not specified, the "Total for a country and a year" or "Total for a city and a year" cell will be used (in this order).

The data cell sizes are calculated from the base data cell sizes, i.e. the height of all data cells for a row will be the height of the base cell of that row. The base cell sizes are also inherited, e.g. if the height of a total row is not specified the height of the base row will be used.

Returns:
the data cell matrix

getParameters

public JRCrosstabParameter[] getParameters()
Returns the crosstab parameters.

Crosstabs have separate expression evaluators and cannot access the parameters/fields/variables of the report. In order to use a value from the report inside a crosstab, it should be passed as parameter to the crosstab.

A crosstab parameters has a name and a value expression.

Returns:
the crosstab parameters

getParametersMapExpression

public JRExpression getParametersMapExpression()
Returns the parameters map expression.

The set of values for crosstab parameters can be set using a map. If a parameter has also a value expression, it will overwrite the value from the map.

Returns:
the parameters map expression

getWhenNoDataCell

public JRCellContents getWhenNoDataCell()
Returns a cell which will be rendered when no data was fed to the crosstab.

If this cell is not specified for a crosstab, nothing will be rendered for an empty crosstab.

The cell sizes are the same as the crosstab element sizes.

Returns:
a cell which will be rendered when no data was fed to the crosstab

getElementByKey

public JRElement getElementByKey(java.lang.String key)
Searches for an element inside all crosstab cells.

Parameters:
key - the element key
Returns:
the first element having the specified key


© 2001-2005 JasperSoft Corporation www.jaspersoft.com