public class JRFillCrosstab extends JRFillElement implements JRCrosstab, JROriginProvider, BucketingServiceContext
crosstab
.Modifier and Type | Class and Description |
---|---|
protected class |
JRFillCrosstab.CrosstabFiller
Crosstab filler class.
|
class |
JRFillCrosstab.JRFillCrosstabDataset
Fill-time crosstab input dataset implementation.
|
band, conditionalStylesContainer, currentEvaluation, currentStyle, defaultPopulateTemplateStyle, defaultStyleProvider, delayedEvaluationsMap, dynamicProperties, dynamicTransferProperties, elementGroup, EXCEPTION_MESSAGE_KEY_INVALID_BOOKMARK_LEVEL, expressionEvaluator, fillContainerContext, filler, hasDynamicPopulateTemplateStyle, initStyle, mergedProperties, originProvider, parent, printElementOriginator, printWhenGroupChanges, propertyExpressions, providerStyle, staticProperties, staticTransferProperties, styleProviders, templates
DEFAULT_COLUMN_BREAK_OFFSET, PROPERTY_IGNORE_WIDTH, VARIABLE_COLUMN_COUNT, VARIABLE_ROW_COUNT
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE
Constructor and Description |
---|
JRFillCrosstab(JRBaseFiller filler,
JRCrosstab crosstab,
JRFillObjectFactory factory) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCrosstabChunk(List<JRPrintElement> elements,
int yOffset) |
protected BucketOrder |
bucketOrder(BucketDefinition bucket) |
protected List<BucketDefinition.Bucket> |
bucketValuesList(HeaderCell cell) |
void |
collectExpressions(JRExpressionCollector collector) |
protected HorizontalPosition |
concreteHorizontalPosition() |
JRFillCloneable |
createClone(JRFillCloneFactory factory)
Creates a working clone of itself.
|
protected JRTemplateElement |
createElementTemplate() |
protected JRTemplateGenericPrintElement |
createInteractiveElement(String chunkId,
boolean floatingHeaders) |
protected BucketOrderer |
createOrderer(JRCrosstabGroup group,
int groupIndex,
Comparator<Object> bucketComparator) |
protected void |
evaluate(byte evaluation) |
Object |
evaluateMeasuresExpression(JRExpression expression,
MeasureDefinition.MeasureValue[] measureValues) |
protected JRPrintElement |
fill() |
JRCrosstabCell[][] |
getCells()
Returns the data cell matrix.
|
protected int |
getChunkIndex() |
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() |
JRElement |
getElementByKey(String elementKey)
Searches for an element inside all crosstab cells.
|
JRFillExpressionEvaluator |
getExpressionEvaluator() |
JRBaseFiller |
getFiller() |
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.
|
JasperReportsContext |
getJasperReportsContext() |
JRLineBox |
getLineBox() |
JRCrosstabMeasure[] |
getMeasures()
Returns the crosstab measures.
|
ModeEnum |
getModeValue()
Returns the element transparency mode.
|
JROrigin |
getOrigin()
Returns an element origin.
|
JRCrosstabParameter[] |
getParameters()
Returns the crosstab parameters.
|
JRExpression |
getParametersMapExpression()
Returns the parameters map expression.
|
protected List<? extends JRPrintElement> |
getPrintElements() |
protected int |
getPrintElementsWidth() |
JRCrosstabRowGroup[] |
getRowGroups()
Returns the row groups of the crosstab.
|
RunDirectionEnum |
getRunDirectionValue()
Retrieves the run direction of this crosstab
|
protected JRTemplateFrame |
getTemplateFrame() |
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.
|
protected void |
initBucketingService() |
protected void |
initEvaluator(byte evaluation) |
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.
|
protected void |
loadEvaluator(JasperReport jasperReport) |
protected boolean |
matchesOrderByColumn(HeaderCell cell) |
protected void |
mirrorPrintElements(List<JRPrintElement> printElements,
int width) |
protected boolean |
prepare(int availableHeight,
boolean isOverflow) |
protected void |
reset() |
protected void |
resolveElement(JRPrintElement element,
byte evaluation)
Resolves an element.
|
protected void |
rewind() |
protected void |
setBand(JRFillBand band) |
void |
setHorizontalPosition(HorizontalPosition horizontalPosition)
Sets the position of the crosstab within its element box.
|
void |
setIgnoreWidth(Boolean ignoreWidth)
Set the ignore width crosstab flag.
|
protected void |
setOrderByColumnBucketValues() |
protected void |
setOrderByColumnInfo() |
void |
setRunDirection(RunDirectionEnum runDirection)
Sets the run direction of the crosstab.
|
protected List<ColumnValueInfo> |
toColumnValues(List<BucketDefinition.Bucket> bucketValues) |
void |
visit(JRVisitor visitor) |
_moveDependantElements, _stretchElement, _stretchElementToHeight, addDependantElement, addDynamicProperty, clone, clone, clone, collectDelayedEvaluations, collectDelayedEvaluations, collectDelayedEvaluations, collectStyleDelayedEvaluations, collectStyleProviderDelayedEvaluations, delayedEvaluate, delayedEvaluationUpdatesTemplate, evaluateExpression, evaluatePrintWhenExpression, evaluateProperties, evaluateStyle, getBackcolor, getBand, getBookmarkLevel, getCollapsedHeightAbove, getCollapsedHeightBelow, getConditionalStylesContainer, getDefaultStyleProvider, getDependantElements, getDynamicProperties, getElementGroup, getElementOrigin, getElementTemplate, getEvaluatedProperties, getEvaluationTimeValue, getField, getForecolor, getGroupElements, getHeight, getInitStyle, getKey, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getParent, getParentProperties, getPositionTypeValue, getPrepareHeight, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getPropertyExpressions, getRelativeY, getStretchHeight, getStretchTypeValue, getStyle, getStyleNameReference, getStyleResolver, getTemplate, getTimeZone, getUUID, getVariable, getWidth, getX, getY, hasDynamicProperties, hasDynamicProperty, hasProperties, initDelayedEvaluationPrint, initDelayedEvaluations, initStyleProviders, isAlreadyPrinted, isAutoEvaluateNow, isDelayedStyleEvaluation, isEvaluateAuto, isEvaluateNow, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isPrintWhenExpressionNull, isPrintWhenTrue, isRemoveLineWhenBlank, isReprinted, isToPrint, isValueRepeating, moveDependantElements, performDelayedEvaluation, registerTemplate, resolveElement, setAlreadyPrinted, setBackcolor, setCollapsedHeightAbove, setCollapsedHeightBelow, setConditionalStylesContainer, setCurrentEvaluation, setExpressionEvaluator, setForecolor, setHeight, setMode, setOriginProvider, setPositionType, setPrepareHeight, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setPrintWhenExpressionNull, setPrintWhenTrue, setRelativeY, setRemoveLineWhenBlank, setReprinted, setShrinkable, setStretchHeight, setStretchType, setStyle, setStyleNameReference, setToPrint, setValueRepeating, setWidth, setX, setY, stretchElement, stretchElementToContainer, stretchElementToElementGroup, stretchElementToHeight, stretchHeightFinal, toPopulateTemplateStyle, transferProperties, transferProperties
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone, getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
clone
getBackcolor, getForecolor, getHeight, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode
getDefaultStyleProvider, getStyle, getStyleNameReference
getParentProperties, getPropertiesMap, hasProperties
getUUID
public static final String EXCEPTION_MESSAGE_KEY_BUCKETING_SERVICE_ERROR
public static final String EXCEPTION_MESSAGE_KEY_EVALUATOR_LOADING_ERROR
public static final String EXCEPTION_MESSAGE_KEY_INFINITE_LOOP
public static final String EXCEPTION_MESSAGE_KEY_NOT_ENOUGH_SPACE
public static final String PROPERTY_INTERACTIVE
It can be set:
The default global value of this property is true
public static final String PROPERTY_FLOATING_HEADERS
PROPERTY_INTERACTIVE
to false
, then
setting this property will have no effect.
It can be set:
The default global value of this property is true
public static final String PROPERTY_ORDER_BY_COLUMN
public static final String PROPERTY_ROW_GROUP_COLUMN_HEADER
public static final String PROPERTY_COLUMN_HEADER_SORT_MEASURE_INDEX
public static final String CROSSTAB_INTERACTIVE_ELEMENT_NAME
public static final String HTML_CLASS_COLUMN_FLOATING
public static final String HTML_CLASS_ROW_FLOATING
public static final String HTML_CLASS_CROSS_FLOATING
public static final JRGenericElementType CROSSTAB_INTERACTIVE_ELEMENT_TYPE
protected static final String FILL_CACHE_KEY_CROSSTAB_CHUNK_COUNTER
protected final JRCrosstab parentCrosstab
protected final JRLineBox lineBox
protected JRFillCrosstab.JRFillCrosstabDataset dataset
protected JRFillCrosstabRowGroup[] rowGroups
protected JRFillCrosstabColumnGroup[] columnGroups
protected JRFillCrosstabMeasure[] measures
protected CrosstabBucketingService bucketingService
protected JRFillVariable[] variables
protected Map<String,JRFillVariable> variablesMap
protected JRFillVariable[][][] totalVariables
protected boolean[][] retrieveTotal
protected JRFillCrosstabParameter[] parameters
protected Map<String,JRFillParameter> parametersMap
protected boolean ignoreWidth
protected JRCrosstabExpressionEvaluator crosstabEvaluator
protected JRFillCrosstabCell[][] crossCells
protected JRFillCellContents titleCellContents
protected JRFillCellContents headerCell
protected JRFillCellContents whenNoDataCell
protected boolean hasData
protected HeaderCell[][] columnHeadersData
protected HeaderCell[][] rowHeadersData
protected CrosstabCell[][] cellData
protected MeasureDefinition.MeasureValue[] grandTotals
public JRFillCrosstab(JRBaseFiller filler, JRCrosstab crosstab, JRFillObjectFactory factory)
protected void setBand(JRFillBand band)
setBand
in class JRFillElement
public ModeEnum getModeValue()
JRCommonElement
getModeValue
in interface JRCommonElement
getModeValue
in class JRFillElement
public JRBaseFiller getFiller()
getFiller
in class JRFillElement
protected void loadEvaluator(JasperReport jasperReport)
protected BucketOrderer createOrderer(JRCrosstabGroup group, int groupIndex, Comparator<Object> bucketComparator)
public Object evaluateMeasuresExpression(JRExpression expression, MeasureDefinition.MeasureValue[] measureValues) throws JRException
evaluateMeasuresExpression
in interface BucketingServiceContext
JRException
protected void reset()
reset
in class JRFillElement
protected void evaluate(byte evaluation) throws JRException
evaluate
in class JRFillElement
JRException
protected void initEvaluator(byte evaluation) throws JRException
JRException
protected void initBucketingService()
protected void setOrderByColumnInfo()
protected void setOrderByColumnBucketValues()
protected boolean prepare(int availableHeight, boolean isOverflow) throws JRException
prepare
in class JRFillElement
JRException
protected void addCrosstabChunk(List<JRPrintElement> elements, int yOffset)
protected int getChunkIndex()
protected HorizontalPosition concreteHorizontalPosition()
protected JRTemplateGenericPrintElement createInteractiveElement(String chunkId, boolean floatingHeaders)
protected BucketOrder bucketOrder(BucketDefinition bucket)
protected boolean matchesOrderByColumn(HeaderCell cell)
protected List<BucketDefinition.Bucket> bucketValuesList(HeaderCell cell)
protected List<ColumnValueInfo> toColumnValues(List<BucketDefinition.Bucket> bucketValues)
protected JRPrintElement fill()
fill
in class JRFillElement
protected JRTemplateFrame getTemplateFrame()
protected JRTemplateElement createElementTemplate()
createElementTemplate
in class JRFillElement
protected void rewind()
rewind
in class JRFillElement
protected List<? extends JRPrintElement> getPrintElements()
protected int getPrintElementsWidth()
protected void mirrorPrintElements(List<JRPrintElement> printElements, int width)
protected void resolveElement(JRPrintElement element, byte evaluation)
JRFillElement
resolveElement
in class JRFillElement
element
- the elementevaluation
- the evaluation typepublic void collectExpressions(JRExpressionCollector collector)
collectExpressions
in interface JRElement
public void visit(JRVisitor visitor)
visit
in interface JRVisitable
public int getId()
JRCrosstab
The ID is generated when the report is compiled and is used internally.
getId
in interface JRCrosstab
public JRCrosstabDataset getDataset()
JRCrosstab
getDataset
in interface JRCrosstab
public JRCrosstabRowGroup[] getRowGroups()
JRCrosstab
getRowGroups
in interface JRCrosstab
public JRCrosstabColumnGroup[] getColumnGroups()
JRCrosstab
getColumnGroups
in interface JRCrosstab
public JRCrosstabMeasure[] getMeasures()
JRCrosstab
getMeasures
in interface JRCrosstab
public int getColumnBreakOffset()
JRCrosstab
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.
getColumnBreakOffset
in interface JRCrosstab
public boolean isRepeatColumnHeaders()
JRCrosstab
isRepeatColumnHeaders
in interface JRCrosstab
public boolean isRepeatRowHeaders()
JRCrosstab
isRepeatRowHeaders
in interface JRCrosstab
public JRCrosstabCell[][] getCells()
JRCrosstab
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.
getCells
in interface JRCrosstab
public JRCellContents getWhenNoDataCell()
JRCrosstab
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.
getWhenNoDataCell
in interface JRCrosstab
public JRCrosstabParameter[] getParameters()
JRCrosstab
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.
getParameters
in interface JRCrosstab
public JRExpression getParametersMapExpression()
JRCrosstab
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.
getParametersMapExpression
in interface JRCrosstab
public JRElement getElementByKey(String elementKey)
JRCrosstab
getElementByKey
in interface JRCrosstab
elementKey
- the element keypublic JRFillCloneable createClone(JRFillCloneFactory factory)
JRFillCloneable
createClone
in interface JRFillCloneable
factory
- the clone factory to use while creating the clonepublic CrosstabColumnCell getTitleCell()
JRCrosstab
getTitleCell
in interface JRCrosstab
public JRCellContents getHeaderCell()
JRCrosstab
getHeaderCell
in interface JRCrosstab
public JRVariable[] getVariables()
JRCrosstab
getVariables
in interface JRCrosstab
JRCrosstabGroup.getVariable()
,
JRCrosstabMeasure.getVariable()
,
JRCrosstab.VARIABLE_ROW_COUNT
,
JRCrosstab.VARIABLE_COLUMN_COUNT
public RunDirectionEnum getRunDirectionValue()
JRCrosstab
getRunDirectionValue
in interface JRCrosstab
RunDirectionEnum
public void setRunDirection(RunDirectionEnum runDirection)
JRCrosstab
Crosstabs can either be filled from left to right (the default) or from right to left (mainly for reports in RTL languages).
setRunDirection
in interface JRCrosstab
runDirection
- a value representing one of the run direction constants in RunDirectionEnum
public HorizontalPosition getHorizontalPosition()
JRCrosstab
getHorizontalPosition
in interface JRCrosstab
null
if no position is specifiedpublic void setHorizontalPosition(HorizontalPosition horizontalPosition)
JRCrosstab
setHorizontalPosition
in interface JRCrosstab
horizontalPosition
- the crosstab position,
if null
the default position is appliedpublic JROrigin getOrigin()
JROriginProvider
getOrigin
in interface JROriginProvider
public Boolean getIgnoreWidth()
JRCrosstab
getIgnoreWidth
in interface JRCrosstab
null
is the crosstab
does not specify a flag valueJRCrosstab.setIgnoreWidth(Boolean)
public void setIgnoreWidth(Boolean ignoreWidth)
JRCrosstab
This 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 JRCrosstab
ignoreWidth
- whether the element width is to be ignored by the crosstab,
or null
if the default setting is to be usedJRCrosstab.PROPERTY_IGNORE_WIDTH
public Color getDefaultLineColor()
getDefaultLineColor
in interface JRBoxContainer
public JRLineBox getLineBox()
getLineBox
in interface JRBoxContainer
public JasperReportsContext getJasperReportsContext()
getJasperReportsContext
in interface BucketingServiceContext
public JRFillExpressionEvaluator getExpressionEvaluator()
getExpressionEvaluator
in interface BucketingServiceContext
Copyright © 2023 Cloud Software Group, Inc.. All rights reserved.