public class JRBaseCrosstab extends JRBaseElement implements JRCrosstab
crosstab implementation.| Modifier and Type | Field and Description |
|---|---|
protected JRCrosstabCell[][] |
cells |
protected int |
columnBreakOffset |
protected JRCrosstabColumnGroup[] |
columnGroups |
protected JRCrosstabDataset |
dataset |
protected JRCellContents |
headerCell |
protected HorizontalPosition |
horizontalPosition |
protected int |
id |
protected Boolean |
ignoreWidth |
protected JRLineBox |
lineBox |
protected JRCrosstabMeasure[] |
measures |
protected JRCrosstabParameter[] |
parameters |
protected JRExpression |
parametersMapExpression |
static String |
PROPERTY_HORIZONTAL_POSITION |
static String |
PROPERTY_IGNORE_WIDTH |
static String |
PROPERTY_RUN_DIRECTION |
protected boolean |
repeatColumnHeaders |
protected boolean |
repeatRowHeaders |
protected JRCrosstabRowGroup[] |
rowGroups |
protected RunDirectionEnum |
runDirectionValue |
protected CrosstabColumnCell |
titleCell |
protected JRVariable[] |
variables |
protected JRCellContents |
whenNoDataCell |
backcolor, defaultStyleProvider, elementGroup, forecolor, height, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, key, modeValue, parentStyle, parentStyleNameReference, positionTypeValue, printWhenExpression, printWhenGroupChanges, PROPERTY_POSITION_TYPE, PROPERTY_PRINT_IN_FIRST_WHOLE_BAND, PROPERTY_PRINT_REPEATED_VALUES, PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS, PROPERTY_REMOVE_LINE_WHEN_BLANK, PROPERTY_STRETCH_TYPE, PROPERTY_WIDTH, PROPERTY_X, stretchTypeValue, uuid, width, x, yDEFAULT_COLUMN_BREAK_OFFSET, VARIABLE_COLUMN_COUNT, VARIABLE_ROW_COUNT| Constructor and Description |
|---|
JRBaseCrosstab(JRCrosstab crosstab,
JRBaseObjectFactory factory,
int id) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
void |
collectExpressions(JRExpressionCollector collector) |
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.
|
Color |
getDefaultLineColor() |
static JRElement |
getElementByKey(JRCrosstab crosstab,
String key) |
JRElement |
getElementByKey(String elementKey)
Searches for an element inside all crosstab cells.
|
JRCellContents |
getHeaderCell()
Returns a cell which will be rendered at the upper-left corner of the crosstab.
|
HorizontalPosition |
getHorizontalPosition()
Returns the position of the crosstab within its element box.
|
int |
getId()
Returns the ID of the crosstab.
|
Boolean |
getIgnoreWidth()
Returns the ignore width flag for the crosstab.
|
JRLineBox |
getLineBox() |
JRCrosstabMeasure[] |
getMeasures()
Returns the crosstab measures.
|
ModeEnum |
getModeValue()
Returns the element transparency mode.
|
JRCrosstabParameter[] |
getParameters()
Returns the crosstab parameters.
|
JRExpression |
getParametersMapExpression()
Returns the parameters map expression.
|
JRCrosstabRowGroup[] |
getRowGroups()
Returns the row groups of the crosstab.
|
RunDirectionEnum |
getRunDirectionValue()
Retrieves the run direction of this crosstab
|
CrosstabColumnCell |
getTitleCell()
Returns the title cell, which renders once at the beginning of the crosstab.
|
JRVariable[] |
getVariables()
Returns the variables defined for 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.
|
void |
setHorizontalPosition(HorizontalPosition horizontalPosition)
Sets the position of the crosstab within its element box.
|
void |
setIgnoreWidth(boolean ignoreWidth)
Set the ignore width crosstab flag.
|
void |
setIgnoreWidth(Boolean ignoreWidth)
Set the ignore width crosstab flag.
|
void |
setRunDirection(RunDirectionEnum runDirectionValue)
Sets the run direction of the crosstab.
|
void |
visit(JRVisitor visitor) |
clone, clone, getBackcolor, getBaseStyle, getDefaultStyleProvider, getElementGroup, getEventSupport, getForecolor, getHeight, getKey, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getParentProperties, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getPropertyExpressions, getStretchTypeValue, getStyle, getStyleNameReference, getStyleResolver, getUUID, getWidth, getX, getY, hasProperties, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setBackcolor, setForecolor, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setXequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclone, getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setXgetBackcolor, getForecolor, getHeight, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setModegetDefaultStyleProvider, getStyle, getStyleNameReferencegetParentProperties, getPropertiesMap, hasPropertiesgetUUIDpublic static final String PROPERTY_RUN_DIRECTION
public static final String PROPERTY_HORIZONTAL_POSITION
public static final String PROPERTY_IGNORE_WIDTH
protected int id
protected JRCrosstabParameter[] parameters
protected JRVariable[] variables
protected JRExpression parametersMapExpression
protected JRCrosstabDataset dataset
protected JRCrosstabRowGroup[] rowGroups
protected JRCrosstabColumnGroup[] columnGroups
protected JRCrosstabMeasure[] measures
protected int columnBreakOffset
protected boolean repeatColumnHeaders
protected boolean repeatRowHeaders
protected RunDirectionEnum runDirectionValue
protected HorizontalPosition horizontalPosition
protected JRCrosstabCell[][] cells
protected JRCellContents whenNoDataCell
protected CrosstabColumnCell titleCell
protected JRCellContents headerCell
protected Boolean ignoreWidth
protected JRLineBox lineBox
public JRBaseCrosstab(JRCrosstab crosstab, JRBaseObjectFactory factory, int id)
public ModeEnum getModeValue()
JRCommonElementgetModeValue in interface JRCommonElementgetModeValue in class JRBaseElementpublic int getId()
JRCrosstabThe ID is generated when the report is compiled and is used internally.
getId in interface JRCrosstabpublic JRCrosstabDataset getDataset()
JRCrosstabgetDataset in interface JRCrosstabpublic JRCrosstabRowGroup[] getRowGroups()
JRCrosstabgetRowGroups in interface JRCrosstabpublic JRCrosstabColumnGroup[] getColumnGroups()
JRCrosstabgetColumnGroups in interface JRCrosstabpublic JRCrosstabMeasure[] getMeasures()
JRCrosstabgetMeasures in interface JRCrosstabpublic void collectExpressions(JRExpressionCollector collector)
collectExpressions in interface JRElementpublic void visit(JRVisitor visitor)
visit in interface JRVisitablepublic int getColumnBreakOffset()
JRCrosstabWhen 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.
getColumnBreakOffset in interface JRCrosstabpublic boolean isRepeatColumnHeaders()
JRCrosstabisRepeatColumnHeaders in interface JRCrosstabpublic boolean isRepeatRowHeaders()
JRCrosstabisRepeatRowHeaders in interface JRCrosstabpublic JRCrosstabCell[][] getCells()
JRCrosstabA 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.
getCells in interface JRCrosstabpublic JRCrosstabParameter[] getParameters()
JRCrosstabCrosstabs 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.
getParameters in interface JRCrosstabpublic JRExpression getParametersMapExpression()
JRCrosstabThe 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.
getParametersMapExpression in interface JRCrosstabpublic JRCellContents getWhenNoDataCell()
JRCrosstabIf 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.
getWhenNoDataCell in interface JRCrosstabpublic static JRElement getElementByKey(JRCrosstab crosstab, String key)
public JRElement getElementByKey(String elementKey)
JRCrosstabgetElementByKey in interface JRCrosstabelementKey - the element keypublic CrosstabColumnCell getTitleCell()
JRCrosstabgetTitleCell in interface JRCrosstabpublic JRCellContents getHeaderCell()
JRCrosstabgetHeaderCell in interface JRCrosstabpublic JRVariable[] getVariables()
JRCrosstabgetVariables in interface JRCrosstabJRCrosstabGroup.getVariable(),
JRCrosstabMeasure.getVariable(),
JRCrosstab.VARIABLE_ROW_COUNT,
JRCrosstab.VARIABLE_COLUMN_COUNTpublic RunDirectionEnum getRunDirectionValue()
JRCrosstabgetRunDirectionValue in interface JRCrosstabRunDirectionEnumpublic void setRunDirection(RunDirectionEnum runDirectionValue)
JRCrosstabCrosstabs can either be filled from left to right (the default) or from right to left (mainly for reports in RTL languages).
setRunDirection in interface JRCrosstabrunDirectionValue - a value representing one of the run direction constants in RunDirectionEnumpublic HorizontalPosition getHorizontalPosition()
JRCrosstabgetHorizontalPosition in interface JRCrosstabnull if no position is specifiedpublic void setHorizontalPosition(HorizontalPosition horizontalPosition)
JRCrosstabsetHorizontalPosition in interface JRCrosstabhorizontalPosition - the crosstab position,
if null the default position is appliedpublic Object clone()
clone in interface JRCloneableclone in class JRBaseElementpublic Boolean getIgnoreWidth()
JRCrosstabgetIgnoreWidth in interface JRCrosstabnull is the crosstab
does not specify a flag valueJRCrosstab.setIgnoreWidth(Boolean)public void setIgnoreWidth(Boolean ignoreWidth)
JRCrosstabThis flag determines whether the crosstab will break at the width set for the crosstab element, or whether the crosstab is to expand over this width (and over the page width as well).
If this flag is set to true, the crosstab will expand towards
the right (or towards the left if the crosstab direction is RTL) as long
as it needs to. This would result in crosstab cells being rendered over
the page boundary; such elements will be exported by certain grid-based
exporters such as the HTML or XLS ones, but will not be visible in export
formats that observe the page width, such as the PDF exporter.
The default value of this flag is given by the
JRCrosstab.PROPERTY_IGNORE_WIDTH property and the
JRParameter.IS_IGNORE_PAGINATION parameter.
setIgnoreWidth in interface JRCrosstabignoreWidth - whether the element width is to be ignored by the crosstab,
or null if the default setting is to be usedJRCrosstab.PROPERTY_IGNORE_WIDTHpublic void setIgnoreWidth(boolean ignoreWidth)
JRCrosstabsetIgnoreWidth in interface JRCrosstabJRCrosstab.setIgnoreWidth(Boolean)public Color getDefaultLineColor()
getDefaultLineColor in interface JRBoxContainerpublic JRLineBox getLineBox()
getLineBox in interface JRBoxContainerCopyright © 2017. All rights reserved.