Class JRFillCrosstab
- All Implemented Interfaces:
Cloneable,BucketingServiceContext,JRCrosstab,DynamicPropertiesHolder,JRFillCloneable,JROriginProvider,JRBoxContainer,JRChild,JRCloneable,JRCommonElement,JRElement,JRIdentifiable,JRPropertiesHolder,JRStyleContainer,JRStyleSetter,JRVisitable
crosstab.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classCrosstab filler class.classFill-time crosstab input dataset implementation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CrosstabBucketingServiceprotected CrosstabCell[][]protected JRFillCrosstabColumnGroup[]protected HeaderCell[][]protected JRFillCrosstabCell[][]static final Stringstatic final JRGenericElementTypeprotected JRCrosstabExpressionEvaluatorprotected JRFillCrosstab.JRFillCrosstabDatasetstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static final Stringprotected MeasureDefinition.MeasureValue[]protected booleanprotected JRFillCellContentsstatic final Stringstatic final Stringstatic final Stringprotected booleanprotected final JRLineBoxprotected JRFillCrosstabMeasure[]protected JRFillCrosstabParameter[]protected Map<String, JRFillParameter> protected final JRCrosstabstatic final Stringstatic final StringProperty that enables/disables the floating headers in the crosstab component when scrolling.static final StringProperty that enables/disables the interactivity in the crosstab component.static final Stringstatic final Stringprotected boolean[][]protected JRFillCrosstabRowGroup[]protected HeaderCell[][]protected JRFillCellContentsprotected JRFillVariable[][][]protected JRFillVariable[]protected Map<String, JRFillVariable> protected JRFillCellContentsFields inherited from class net.sf.jasperreports.engine.fill.JRFillElement
band, conditionalStylesContainer, currentEvaluation, currentStyle, defaultPopulateTemplateStyle, defaultStyleProvider, delayedEvaluationsMap, dynamicProperties, dynamicTransferProperties, elementGroup, EXCEPTION_MESSAGE_KEY_INVALID_BOOKMARK_LEVEL, expressionEvaluator, exprStyle, fillContainerContext, filler, hasDynamicPopulateTemplateStyle, initStyle, mergedProperties, originProvider, parent, printElementOriginator, printWhenGroupChanges, propertyExpressions, providerStyle, staticProperties, staticTransferProperties, styleProviders, templatesFields inherited from interface net.sf.jasperreports.crosstabs.JRCrosstab
DEFAULT_COLUMN_BREAK_OFFSET, PROPERTY_IGNORE_WIDTH, VARIABLE_COLUMN_COUNT, VARIABLE_IS_EVEN_COLUMN, VARIABLE_IS_EVEN_ROW, VARIABLE_ROW_COUNTFields inherited from interface net.sf.jasperreports.engine.JRElement
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE -
Constructor Summary
ConstructorsConstructorDescriptionJRFillCrosstab(JRBaseFiller filler, JRCrosstab crosstab, JRFillObjectFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCrosstabChunk(List<JRPrintElement> elements, int yOffset) protected BucketOrderbucketOrder(BucketDefinition bucket) protected List<BucketDefinition.Bucket> bucketValuesList(HeaderCell cell) voidcollectExpressions(JRExpressionCollector collector) protected HorizontalPositioncreateClone(JRFillCloneFactory factory) Creates a working clone of itself.protected JRTemplateElementprotected JRTemplateGenericPrintElementcreateInteractiveElement(String chunkId, boolean floatingHeaders) protected BucketOrderercreateOrderer(JRCrosstabGroup group, int groupIndex, Comparator<Object> bucketComparator) protected voidevaluate(byte evaluation) evaluateMeasuresExpression(JRExpression expression, MeasureDefinition.MeasureValue[] measureValues) protected JRPrintElementfill()JRCrosstabCell[][]getCells()Returns the data cell matrix.protected intReturns the column break offset.Returns the column groups of the crosstab.Returns the input dataset of the crosstab.getElementByKey(String elementKey) Searches for an element inside all crosstab cells.Returns a cell which will be rendered at the upper-left corner of the crosstab.Returns the position of the crosstab within its element box.intgetId()Returns the ID of the crosstab.Returns the ignore width flag for the crosstab.Returns the crosstab measures.getMode()Returns the element transparency mode.Returns an element origin.Returns the crosstab parameters.Returns the parameters map expression.protected List<? extends JRPrintElement> protected intReturns the row groups of the crosstab.Retrieves the run direction of this crosstabprotected JRTemplateFrameReturns the title cell, which renders once at the beginning of the crosstab.Returns the variables defined for the crosstab.Returns a cell which will be rendered when no data was fed to the crosstab.protected voidprotected voidinitEvaluator(byte evaluation) booleanReturns whether to repeat the column headers after a row break.booleanReturns whether to repeat the row headers after a column break.protected voidloadEvaluator(JasperReport jasperReport) protected booleanprotected voidmirrorPrintElements(List<JRPrintElement> printElements, int width) protected booleanprepare(int availableHeight, boolean isOverflow, boolean isOverflowAllowed) protected voidreset()protected voidresolveElement(JRPrintElement element, byte evaluation) Resolves an element.protected voidrewind()protected voidsetBand(JRFillBand band) voidsetHorizontalPosition(HorizontalPosition horizontalPosition) Sets the position of the crosstab within its element box.voidsetIgnoreWidth(Boolean ignoreWidth) Set the ignore width crosstab flag.protected voidprotected voidvoidsetRunDirection(RunDirectionEnum runDirection) Sets the run direction of the crosstab.protected List<ColumnValueInfo> toColumnValues(List<BucketDefinition.Bucket> bucketValues) voidMethods inherited from class net.sf.jasperreports.engine.fill.JRFillElement
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, getEvaluationTime, getField, getForecolor, getGroupElements, getHeight, getInitStyle, getKey, getOwnBackcolor, getOwnForecolor, getOwnMode, getParent, getParentProperties, getPositionType, getPrepareHeight, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getPropertyExpressions, getRelativeY, getStretchHeight, getStretchType, getStyle, getStyleExpression, 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, toPopulateTemplateStyle, transferProperties, transferPropertiesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.jasperreports.engine.JRCloneable
cloneMethods inherited from interface net.sf.jasperreports.engine.JRCommonElement
getBackcolor, getForecolor, getHeight, getKey, getOwnBackcolor, getOwnForecolor, getOwnMode, getWidth, setBackcolor, setForecolor, setModeMethods inherited from interface net.sf.jasperreports.engine.JRElement
clone, getElementGroup, getPositionType, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchType, getStyleExpression, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setXMethods inherited from interface net.sf.jasperreports.engine.JRIdentifiable
getUUIDMethods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder
getParentProperties, getPropertiesMap, hasPropertiesMethods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyle, getStyleName, getStyleNameReference
-
Field Details
-
EXCEPTION_MESSAGE_KEY_BUCKETING_SERVICE_ERROR
- See Also:
-
EXCEPTION_MESSAGE_KEY_EVALUATOR_LOADING_ERROR
- See Also:
-
EXCEPTION_MESSAGE_KEY_INFINITE_LOOP
- See Also:
-
EXCEPTION_MESSAGE_KEY_NOT_ENOUGH_SPACE
- See Also:
-
PROPERTY_INTERACTIVE
Property that enables/disables the interactivity in the crosstab component.It can be set:
- globally
- at report level
- at component level
The default global value of this property is
true- See Also:
-
PROPERTY_FLOATING_HEADERS
Property that enables/disables the floating headers in the crosstab component when scrolling. If the interactivity has been disabled by settingPROPERTY_INTERACTIVEtofalse, then setting this property will have no effect.It can be set:
- globally
- at report level
- at component level
The default global value of this property is
true- See Also:
-
PROPERTY_ORDER_BY_COLUMN
- See Also:
-
PROPERTY_ROW_GROUP_COLUMN_HEADER
- See Also:
-
PROPERTY_COLUMN_HEADER_SORT_MEASURE_INDEX
- See Also:
-
CROSSTAB_INTERACTIVE_ELEMENT_NAME
- See Also:
-
HTML_CLASS_COLUMN_FLOATING
- See Also:
-
HTML_CLASS_ROW_FLOATING
- See Also:
-
HTML_CLASS_CROSS_FLOATING
- See Also:
-
CROSSTAB_INTERACTIVE_ELEMENT_TYPE
-
FILL_CACHE_KEY_CROSSTAB_CHUNK_COUNTER
-
parentCrosstab
-
lineBox
-
dataset
-
rowGroups
-
rowGroupsMap
-
columnGroups
-
columnGroupsMap
-
measures
-
bucketingService
-
variables
-
variablesMap
-
totalVariables
-
retrieveTotal
protected boolean[][] retrieveTotal -
parameters
-
parametersMap
-
ignoreWidth
protected boolean ignoreWidth -
crosstabEvaluator
-
crossCells
-
titleCellContents
-
headerCell
-
whenNoDataCell
-
hasData
protected boolean hasData -
columnHeadersData
-
rowHeadersData
-
cellData
-
grandTotals
-
-
Constructor Details
-
JRFillCrosstab
-
-
Method Details
-
setBand
- Overrides:
setBandin classJRFillElement
-
getMode
Description copied from interface:JRCommonElementReturns the element transparency mode. The default value depends on the type of the report element. Graphic elements like rectangles and lines are opaque by default, but the images are transparent. Both static texts and text fields are transparent by default, and so are the subreport elements.- Specified by:
getModein interfaceJRCommonElement- Overrides:
getModein classJRFillElement
-
getFiller
- Overrides:
getFillerin classJRFillElement
-
loadEvaluator
-
createOrderer
protected BucketOrderer createOrderer(JRCrosstabGroup group, int groupIndex, Comparator<Object> bucketComparator) -
evaluateMeasuresExpression
public Object evaluateMeasuresExpression(JRExpression expression, MeasureDefinition.MeasureValue[] measureValues) throws JRException - Specified by:
evaluateMeasuresExpressionin interfaceBucketingServiceContext- Throws:
JRException
-
reset
protected void reset()- Overrides:
resetin classJRFillElement
-
evaluate
- Specified by:
evaluatein classJRFillElement- Throws:
JRException
-
initEvaluator
- Throws:
JRException
-
initBucketingService
protected void initBucketingService() -
setOrderByColumnInfo
protected void setOrderByColumnInfo() -
setOrderByColumnBucketValues
protected void setOrderByColumnBucketValues() -
prepare
protected boolean prepare(int availableHeight, boolean isOverflow, boolean isOverflowAllowed) throws JRException - Overrides:
preparein classJRFillElement- Throws:
JRException
-
addCrosstabChunk
-
getChunkIndex
protected int getChunkIndex() -
concreteHorizontalPosition
-
createInteractiveElement
protected JRTemplateGenericPrintElement createInteractiveElement(String chunkId, boolean floatingHeaders) -
bucketOrder
-
matchesOrderByColumn
-
bucketValuesList
-
toColumnValues
-
fill
- Specified by:
fillin classJRFillElement
-
getTemplateFrame
-
createElementTemplate
- Specified by:
createElementTemplatein classJRFillElement
-
rewind
protected void rewind()- Specified by:
rewindin classJRFillElement
-
getPrintElements
-
getPrintElementsWidth
protected int getPrintElementsWidth() -
mirrorPrintElements
-
resolveElement
Description copied from class:JRFillElementResolves an element.- Specified by:
resolveElementin classJRFillElement- Parameters:
element- the elementevaluation- the evaluation type
-
collectExpressions
- Specified by:
collectExpressionsin interfaceJRElement
-
visit
- Specified by:
visitin interfaceJRVisitable
-
getId
public int getId()Description copied from interface:JRCrosstabReturns the ID of the crosstab.The ID is generated when the report is compiled and is used internally.
- Specified by:
getIdin interfaceJRCrosstab- Returns:
- the ID of the crosstab
-
getDataset
Description copied from interface:JRCrosstabReturns the input dataset of the crosstab.- Specified by:
getDatasetin interfaceJRCrosstab- Returns:
- the input dataset of the crosstab
-
getRowGroups
Description copied from interface:JRCrosstabReturns the row groups of the crosstab.- Specified by:
getRowGroupsin interfaceJRCrosstab- Returns:
- the row groups
-
getColumnGroups
Description copied from interface:JRCrosstabReturns the column groups of the crosstab.- Specified by:
getColumnGroupsin interfaceJRCrosstab- Returns:
- the column groups
-
getMeasures
Description copied from interface:JRCrosstabReturns the crosstab measures.- Specified by:
getMeasuresin interfaceJRCrosstab- Returns:
- the crosstab measures
-
getColumnBreakOffset
Description copied from interface:JRCrosstabReturns 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.
- Specified by:
getColumnBreakOffsetin interfaceJRCrosstab- Returns:
- the column break offset
-
isRepeatColumnHeaders
public boolean isRepeatColumnHeaders()Description copied from interface:JRCrosstabReturns whether to repeat the column headers after a row break.- Specified by:
isRepeatColumnHeadersin interfaceJRCrosstab- Returns:
- whether to repeat the column headers after a row break
-
isRepeatRowHeaders
public boolean isRepeatRowHeaders()Description copied from interface:JRCrosstabReturns whether to repeat the row headers after a column break.- Specified by:
isRepeatRowHeadersin interfaceJRCrosstab- Returns:
- whether to repeat the row headers after a column break
-
getCells
Description copied from interface:JRCrosstabReturns 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:
- the row index of a cell is
- the row group index, if the cell corresponds to a total row
- rowGroupCount, otherwise
- the column index of a cell is
- the column group index, if the cell corresponds to a total column
- columnGroupCount, otherwise
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.
- Specified by:
getCellsin interfaceJRCrosstab- Returns:
- the data cell matrix
- the row index of a cell is
-
getWhenNoDataCell
Description copied from interface:JRCrosstabReturns 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.
- Specified by:
getWhenNoDataCellin interfaceJRCrosstab- Returns:
- a cell which will be rendered when no data was fed to the crosstab
-
getParameters
Description copied from interface:JRCrosstabReturns 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.
- Specified by:
getParametersin interfaceJRCrosstab- Returns:
- the crosstab parameters
-
getParametersMapExpression
Description copied from interface:JRCrosstabReturns 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.
- Specified by:
getParametersMapExpressionin interfaceJRCrosstab- Returns:
- the parameters map expression
-
getElementByKey
Description copied from interface:JRCrosstabSearches for an element inside all crosstab cells.- Specified by:
getElementByKeyin interfaceJRCrosstab- Parameters:
elementKey- the element key- Returns:
- the first element having the specified key
-
createClone
Description copied from interface:JRFillCloneableCreates a working clone of itself.- Specified by:
createClonein interfaceJRFillCloneable- Parameters:
factory- the clone factory to use while creating the clone- Returns:
- a working clone of itself
-
getTitleCell
Description copied from interface:JRCrosstabReturns the title cell, which renders once at the beginning of the crosstab.- Specified by:
getTitleCellin interfaceJRCrosstab- Returns:
- the title cell
-
getHeaderCell
Description copied from interface:JRCrosstabReturns a cell which will be rendered at the upper-left corner of the crosstab. The cell size will be calculated based on the row/column header cell widths/heights.- Specified by:
getHeaderCellin interfaceJRCrosstab- Returns:
- a cell which will be rendered at the upper-left corner of the crosstab
-
getVariables
Description copied from interface:JRCrosstabReturns the variables defined for the crosstab.- Specified by:
getVariablesin interfaceJRCrosstab- Returns:
- variables defined for the crosstab
- See Also:
-
getRunDirection
Description copied from interface:JRCrosstabRetrieves the run direction of this crosstab- Specified by:
getRunDirectionin interfaceJRCrosstab- Returns:
- a value representing one of the run direction constants in
RunDirectionEnum
-
setRunDirection
Description copied from interface:JRCrosstabSets the run direction of the crosstab.Crosstabs can either be filled from left to right (the default) or from right to left (mainly for reports in RTL languages).
- Specified by:
setRunDirectionin interfaceJRCrosstab- Parameters:
runDirection- a value representing one of the run direction constants inRunDirectionEnum
-
getHorizontalPosition
Description copied from interface:JRCrosstabReturns the position of the crosstab within its element box.- Specified by:
getHorizontalPositionin interfaceJRCrosstab- Returns:
- the position of the crosstab within its element box,
nullif no position is specified
-
setHorizontalPosition
Description copied from interface:JRCrosstabSets the position of the crosstab within its element box.- Specified by:
setHorizontalPositionin interfaceJRCrosstab- Parameters:
horizontalPosition- the crosstab position, ifnullthe default position is applied
-
getOrigin
Description copied from interface:JROriginProviderReturns an element origin.- Specified by:
getOriginin interfaceJROriginProvider- Returns:
- an element origin
-
getIgnoreWidth
Description copied from interface:JRCrosstabReturns the ignore width flag for the crosstab.- Specified by:
getIgnoreWidthin interfaceJRCrosstab- Returns:
- the ignore width flag, or
nullis the crosstab does not specify a flag value - See Also:
-
setIgnoreWidth
Description copied from interface:JRCrosstabSet the ignore width crosstab flag.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_WIDTHproperty and theJRParameter.IS_IGNORE_PAGINATIONparameter.- Specified by:
setIgnoreWidthin interfaceJRCrosstab- Parameters:
ignoreWidth- whether the element width is to be ignored by the crosstab, ornullif the default setting is to be used- See Also:
-
getDefaultLineColor
- Specified by:
getDefaultLineColorin interfaceJRBoxContainer
-
getLineBox
- Specified by:
getLineBoxin interfaceJRBoxContainer
-
getJasperReportsContext
- Specified by:
getJasperReportsContextin interfaceBucketingServiceContext
-
getExpressionEvaluator
- Specified by:
getExpressionEvaluatorin interfaceBucketingServiceContext
-