Class JRDesignCrosstab
- java.lang.Object
-
- net.sf.jasperreports.engine.base.JRBaseElement
-
- net.sf.jasperreports.engine.design.JRDesignElement
-
- net.sf.jasperreports.crosstabs.design.JRDesignCrosstab
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,JRCrosstab,JRChangeEventsSupport,JRBoxContainer,JRChild,JRCloneable,JRCommonElement,JRElement,JRIdentifiable,JRPropertiesHolder,JRStyleContainer,JRVisitable
public class JRDesignCrosstab extends JRDesignElement implements JRCrosstab
Design-timecrosstabimplementation.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<JRCrosstabCell>cellsListprotected java.util.Map<Pair<java.lang.String,java.lang.String>,JRCrosstabCell>cellsMapprotected intcolumnBreakOffsetprotected java.util.List<JRCrosstabColumnGroup>columnGroupsprotected java.util.Map<java.lang.String,java.lang.Integer>columnGroupsMapprotected JRDesignCrosstabCell[][]crossCellsprotected JRDesignCrosstabDatasetdatasetstatic java.lang.StringEXCEPTION_MESSAGE_KEY_COLUMN_GROUP_DOES_NOT_EXISTstatic java.lang.StringEXCEPTION_MESSAGE_KEY_DUPLICATE_CELLstatic java.lang.StringEXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP_OR_MEASUREstatic java.lang.StringEXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETERstatic java.lang.StringEXCEPTION_MESSAGE_KEY_ROW_GROUP_DOES_NOT_EXISTprotected JRDesignCellContentsheaderCellprotected HorizontalPositionhorizontalPositionprotected java.lang.BooleanignoreWidthprotected JRLineBoxlineBoxprotected java.util.List<JRCrosstabMeasure>measuresprotected java.util.Map<java.lang.String,java.lang.Integer>measuresMapprotected java.util.List<JRCrosstabParameter>parametersListprotected java.util.Map<java.lang.String,JRCrosstabParameter>parametersMapprotected JRExpressionparametersMapExpressionstatic java.lang.StringPROPERTY_CELLSstatic java.lang.StringPROPERTY_COLUMN_BREAK_OFFSETstatic java.lang.StringPROPERTY_COLUMN_GROUPSstatic java.lang.StringPROPERTY_DATASETstatic java.lang.StringPROPERTY_HEADER_CELLstatic java.lang.StringPROPERTY_IGNORE_WIDTHstatic java.lang.StringPROPERTY_MEASURESstatic java.lang.StringPROPERTY_PARAMETERSstatic java.lang.StringPROPERTY_PARAMETERS_MAP_EXPRESSIONstatic java.lang.StringPROPERTY_REPEAT_COLUMN_HEADERSstatic java.lang.StringPROPERTY_REPEAT_ROW_HEADERSstatic java.lang.StringPROPERTY_ROW_GROUPSstatic java.lang.StringPROPERTY_TITLE_CELLstatic java.lang.StringPROPERTY_WHEN_NO_DATA_CELLprotected booleanrepeatColumnHeadersprotected booleanrepeatRowHeadersprotected java.util.List<JRCrosstabRowGroup>rowGroupsprotected java.util.Map<java.lang.String,java.lang.Integer>rowGroupsMapprotected RunDirectionEnumrunDirectionValueprotected DesignCrosstabColumnCelltitleCellprotected java.util.Map<java.lang.String,JRVariable>variablesListprotected JRDesignCellContentswhenNoDataCell-
Fields inherited from class net.sf.jasperreports.engine.design.JRDesignElement
PROPERTY_ELEMENT_GROUP, PROPERTY_HEIGHT, PROPERTY_KEY, PROPERTY_PARENT_STYLE, PROPERTY_PARENT_STYLE_NAME_REFERENCE, PROPERTY_PRINT_WHEN_EXPRESSION, PROPERTY_PRINT_WHEN_GROUP_CHANGES, PROPERTY_PROPERTY_EXPRESSIONS, PROPERTY_STYLE_EXPRESSION, PROPERTY_Y
-
Fields inherited from class net.sf.jasperreports.engine.base.JRBaseElement
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, styleExpression, uuid, width, x, y
-
Fields inherited from interface net.sf.jasperreports.crosstabs.JRCrosstab
DEFAULT_COLUMN_BREAK_OFFSET, VARIABLE_COLUMN_COUNT, VARIABLE_IS_EVEN_COLUMN, VARIABLE_IS_EVEN_ROW, VARIABLE_ROW_COUNT
-
Fields inherited from interface net.sf.jasperreports.engine.JRElement
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE
-
-
Constructor Summary
Constructors Constructor Description JRDesignCrosstab()Creates a new crosstab.JRDesignCrosstab(JRDefaultStyleProvider defaultStyleProvider)Creates a new crosstab.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCell(JRDesignCrosstabCell cell)Adds a data cell to the crosstab.protected voidaddColGroupVars(JRDesignCrosstabColumnGroup colGroup)voidaddColumnGroup(int index, JRDesignCrosstabColumnGroup group)Adds a column group.voidaddColumnGroup(JRDesignCrosstabColumnGroup group)Adds a column group.voidaddMeasure(int index, JRDesignCrosstabMeasure measure)Adds a measure to the crosstab.voidaddMeasure(JRDesignCrosstabMeasure measure)Adds a measure to the crosstab.protected voidaddMeasureVars(JRDesignCrosstabMeasure measure)voidaddParameter(int index, JRCrosstabParameter parameter)Adds a parameter to the crosstab.voidaddParameter(JRCrosstabParameter parameter)Adds a parameter to the crosstab.voidaddRowGroup(int index, JRDesignCrosstabRowGroup group)Adds a row group.voidaddRowGroup(JRDesignCrosstabRowGroup group)Adds a row group.protected voidaddRowGroupVars(JRDesignCrosstabRowGroup rowGroup)protected voidaddTotalVar(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)protected intcalculateColumnHeadersSizes(int rowHeadersWidth)protected intcalculateRowHeadersSizes()protected voidcalculateSizes()java.lang.Objectclone()voidcollectExpressions(JRExpressionCollector collector)protected voidcreateCellMatrix()JRCrosstabCell[][]getCells()Returns the data cell matrix.java.util.List<JRCrosstabCell>getCellsList()Returns the data cells list.java.util.Map<Pair<java.lang.String,java.lang.String>,JRCrosstabCell>getCellsMap()Returns the crosstab cells indexed by corresponding row total group/ column total grouppairs.intgetColumnBreakOffset()Returns the column break offset.protected JRDesignCrosstabColumnGroupgetColumnGroup(int columnGroupIndex)java.util.Map<java.lang.String,java.lang.Integer>getColumnGroupIndicesMap()JRCrosstabColumnGroup[]getColumnGroups()Returns the column groups of the crosstab.java.util.List<JRCrosstabColumnGroup>getColumnGroupsList()JRCrosstabDatasetgetDataset()Returns the input dataset of the crosstab.java.awt.ColorgetDefaultLineColor()JRDesignCrosstabDatasetgetDesignDataset()Returns the crosstab dataset object to be used for report designing.JRElementgetElementByKey(java.lang.String elementKey)Searches for an element inside all crosstab cells.JRCellContentsgetHeaderCell()Returns a cell which will be rendered at the upper-left corner of the crosstab.HorizontalPositiongetHorizontalPosition()Returns the position of the crosstab within its element box.intgetId()The ID of the crosstab is only generated at compile time.java.lang.BooleangetIgnoreWidth()Returns the ignore width flag for the crosstab.JRLineBoxgetLineBox()java.util.Map<java.lang.String,java.lang.Integer>getMeasureIndicesMap()JRCrosstabMeasure[]getMeasures()Returns the crosstab measures.java.util.List<JRCrosstabMeasure>getMesuresList()ModeEnumgetModeValue()Returns the element transparency mode.JRCrosstabParameter[]getParameters()Returns the crosstab parameters.java.util.List<JRCrosstabParameter>getParametersList()Returns the paremeters list.java.util.Map<java.lang.String,JRCrosstabParameter>getParametersMap()Returns the parameters indexed by names.JRExpressiongetParametersMapExpression()Returns the parameters map expression.protected JRDesignCrosstabRowGroupgetRowGroup(int rowGroupIndex)java.util.Map<java.lang.String,java.lang.Integer>getRowGroupIndicesMap()JRCrosstabRowGroup[]getRowGroups()Returns the row groups of the crosstab.java.util.List<JRCrosstabRowGroup>getRowGroupsList()RunDirectionEnumgetRunDirectionValue()Retrieves the run direction of this crosstabCrosstabColumnCellgetTitleCell()Returns the title cell, which renders once at the beginning of the crosstab.static java.lang.StringgetTotalVariableName(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)JRVariable[]getVariables()Returns the list of variables created for this crosstab.java.util.Map<java.lang.String,JRVariable>getVariablesMap()Returns the variables of this crosstab indexed by name.JRCellContentsgetWhenNoDataCell()Returns a cell which will be rendered when no data was fed to the crosstab.protected voidinheritCell(int i, int j)protected voidinheritCells()protected voidinheritCellSize(int i, int j)booleanisRepeatColumnHeaders()Returns whether to repeat the column headers after a row break.booleanisRepeatRowHeaders()Returns whether to repeat the row headers after a column break.protected voidmeasureClassChanged(JRDesignCrosstabMeasure measure, java.lang.String valueClassName)voidpreprocess()Performs all the calculations required for report compilation.JRCrosstabCellremoveCell(java.lang.String rowTotalGroup, java.lang.String columnTotalGroup)Removes a data cell.JRCrosstabCellremoveCell(JRCrosstabCell cell)Removes a data cell.protected voidremoveColGroupVars(JRCrosstabColumnGroup colGroup)JRCrosstabColumnGroupremoveColumnGroup(java.lang.String groupName)Removes a column group.JRCrosstabColumnGroupremoveColumnGroup(JRCrosstabColumnGroup group)Removes a column group.JRCrosstabMeasureremoveMeasure(java.lang.String measureName)Removes a measure.JRCrosstabMeasureremoveMeasure(JRCrosstabMeasure measure)Removes a measure.protected voidremoveMeasureVars(JRDesignCrosstabMeasure measure)JRCrosstabParameterremoveParameter(java.lang.String parameterName)Removes a parameter.JRCrosstabParameterremoveParameter(JRCrosstabParameter parameter)Removes a parameter.JRCrosstabRowGroupremoveRowGroup(java.lang.String groupName)Removes a row group.JRCrosstabRowGroupremoveRowGroup(JRCrosstabRowGroup group)Removes a row group.protected voidremoveRowGroupVars(JRCrosstabRowGroup rowGroup)protected voidremoveTotalVar(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)protected voidsetCellOrigin(JRDesignCellContents cell, JRCrosstabOrigin origin)protected voidsetCellOrigin(JRCellContents cell, JRCrosstabOrigin origin)voidsetColumnBreakOffset(int columnBreakOffset)Sets the column break offset.voidsetDataset(JRDesignCrosstabDataset dataset)Sets the crosstab input dataset.protected <T> voidsetGroupVariablesClass(java.util.List<T> groups)voidsetHeaderCell(JRDesignCellContents headerCell)Sets the crosstab header cell (this cell will be rendered at the upper-left corder of the crosstab).voidsetHorizontalPosition(HorizontalPosition horizontalPosition)Sets the position of the crosstab within its element box.voidsetIgnoreWidth(java.lang.Boolean ignoreWidth)Set the ignore width crosstab flag.voidsetParametersMapExpression(JRExpression expression)Sets the parameters map expression.protected voidsetParent(JRDesignCrosstabGroup group)voidsetRepeatColumnHeaders(boolean repeatColumnHeaders)Sets the repeat column headers flag.voidsetRepeatRowHeaders(boolean repeatRowHeaders)Sets the repeat row headers flag.voidsetRunDirection(RunDirectionEnum runDirectionValue)Sets the run direction of the crosstab.voidsetTitleCell(DesignCrosstabColumnCell titleCell)protected voidsetTitleSize(int rowHeadersWidth)protected voidsetTotalVarClass(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup, java.lang.String valueClassName)voidsetWhenNoDataCell(JRDesignCellContents whenNoDataCell)Sets the "No data" cell.protected voidsetWhenNoDataCellSize()voidvisit(JRVisitor visitor)-
Methods inherited from class net.sf.jasperreports.engine.design.JRDesignElement
addPropertyExpression, getPropertyExpressions, getPropertyExpressionsList, removePropertyExpression, removePropertyExpression, setElementGroup, setHeight, setKey, setPrintWhenExpression, setPrintWhenGroupChanges, setStyle, setStyleExpression, setStyleNameReference, setY
-
Methods inherited from class net.sf.jasperreports.engine.base.JRBaseElement
clone, clone, getBackcolor, getBaseStyle, getDefaultStyleProvider, getElementGroup, getEventSupport, getForecolor, getHeight, getKey, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getParentProperties, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getStretchTypeValue, getStyle, getStyleExpression, getStyleNameReference, getStyleResolver, getUUID, getWidth, getX, getY, hasProperties, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setBackcolor, setForecolor, setMode, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setUUID, setWidth, setX
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jasperreports.engine.JRCommonElement
getBackcolor, getForecolor, getHeight, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode
-
Methods inherited from interface net.sf.jasperreports.engine.JRElement
clone, getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getStyleExpression, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
-
Methods inherited from interface net.sf.jasperreports.engine.JRIdentifiable
getUUID
-
Methods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder
getParentProperties, getPropertiesMap, hasProperties
-
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyle, getStyleNameReference
-
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_COLUMN_GROUP_DOES_NOT_EXIST
public static final java.lang.String EXCEPTION_MESSAGE_KEY_COLUMN_GROUP_DOES_NOT_EXIST
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_CELL
public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_CELL
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP_OR_MEASURE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP_OR_MEASURE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER
public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_ROW_GROUP_DOES_NOT_EXIST
public static final java.lang.String EXCEPTION_MESSAGE_KEY_ROW_GROUP_DOES_NOT_EXIST
- See Also:
- Constant Field Values
-
PROPERTY_COLUMN_BREAK_OFFSET
public static final java.lang.String PROPERTY_COLUMN_BREAK_OFFSET
- See Also:
- Constant Field Values
-
PROPERTY_DATASET
public static final java.lang.String PROPERTY_DATASET
- See Also:
- Constant Field Values
-
PROPERTY_TITLE_CELL
public static final java.lang.String PROPERTY_TITLE_CELL
- See Also:
- Constant Field Values
-
PROPERTY_HEADER_CELL
public static final java.lang.String PROPERTY_HEADER_CELL
- See Also:
- Constant Field Values
-
PROPERTY_PARAMETERS_MAP_EXPRESSION
public static final java.lang.String PROPERTY_PARAMETERS_MAP_EXPRESSION
- See Also:
- Constant Field Values
-
PROPERTY_REPEAT_COLUMN_HEADERS
public static final java.lang.String PROPERTY_REPEAT_COLUMN_HEADERS
- See Also:
- Constant Field Values
-
PROPERTY_REPEAT_ROW_HEADERS
public static final java.lang.String PROPERTY_REPEAT_ROW_HEADERS
- See Also:
- Constant Field Values
-
PROPERTY_WHEN_NO_DATA_CELL
public static final java.lang.String PROPERTY_WHEN_NO_DATA_CELL
- See Also:
- Constant Field Values
-
PROPERTY_CELLS
public static final java.lang.String PROPERTY_CELLS
- See Also:
- Constant Field Values
-
PROPERTY_ROW_GROUPS
public static final java.lang.String PROPERTY_ROW_GROUPS
- See Also:
- Constant Field Values
-
PROPERTY_COLUMN_GROUPS
public static final java.lang.String PROPERTY_COLUMN_GROUPS
- See Also:
- Constant Field Values
-
PROPERTY_MEASURES
public static final java.lang.String PROPERTY_MEASURES
- See Also:
- Constant Field Values
-
PROPERTY_PARAMETERS
public static final java.lang.String PROPERTY_PARAMETERS
- See Also:
- Constant Field Values
-
PROPERTY_IGNORE_WIDTH
public static final java.lang.String PROPERTY_IGNORE_WIDTH
- See Also:
- Constant Field Values
-
parametersList
protected java.util.List<JRCrosstabParameter> parametersList
-
parametersMap
protected java.util.Map<java.lang.String,JRCrosstabParameter> parametersMap
-
variablesList
protected java.util.Map<java.lang.String,JRVariable> variablesList
-
parametersMapExpression
protected JRExpression parametersMapExpression
-
dataset
protected JRDesignCrosstabDataset dataset
-
rowGroups
protected java.util.List<JRCrosstabRowGroup> rowGroups
-
columnGroups
protected java.util.List<JRCrosstabColumnGroup> columnGroups
-
measures
protected java.util.List<JRCrosstabMeasure> measures
-
rowGroupsMap
protected java.util.Map<java.lang.String,java.lang.Integer> rowGroupsMap
-
columnGroupsMap
protected java.util.Map<java.lang.String,java.lang.Integer> columnGroupsMap
-
measuresMap
protected java.util.Map<java.lang.String,java.lang.Integer> measuresMap
-
columnBreakOffset
protected int columnBreakOffset
-
repeatColumnHeaders
protected boolean repeatColumnHeaders
-
repeatRowHeaders
protected boolean repeatRowHeaders
-
runDirectionValue
protected RunDirectionEnum runDirectionValue
-
horizontalPosition
protected HorizontalPosition horizontalPosition
-
cellsList
protected java.util.List<JRCrosstabCell> cellsList
-
cellsMap
protected java.util.Map<Pair<java.lang.String,java.lang.String>,JRCrosstabCell> cellsMap
-
crossCells
protected JRDesignCrosstabCell[][] crossCells
-
whenNoDataCell
protected JRDesignCellContents whenNoDataCell
-
titleCell
protected DesignCrosstabColumnCell titleCell
-
headerCell
protected JRDesignCellContents headerCell
-
ignoreWidth
protected java.lang.Boolean ignoreWidth
-
lineBox
protected JRLineBox lineBox
-
-
Constructor Detail
-
JRDesignCrosstab
public JRDesignCrosstab(JRDefaultStyleProvider defaultStyleProvider)
Creates a new crosstab.- Parameters:
defaultStyleProvider- default style provider
-
JRDesignCrosstab
public JRDesignCrosstab()
Creates a new crosstab.
-
-
Method Detail
-
getId
public int getId()
The ID of the crosstab is only generated at compile time.- Specified by:
getIdin interfaceJRCrosstab- Returns:
- the ID of the crosstab
-
getDataset
public JRCrosstabDataset getDataset()
Description copied from interface:JRCrosstabReturns the input dataset of the crosstab.- Specified by:
getDatasetin interfaceJRCrosstab- Returns:
- the input dataset of the crosstab
-
getDesignDataset
public JRDesignCrosstabDataset getDesignDataset()
Returns the crosstab dataset object to be used for report designing.- Returns:
- the crosstab dataset design object
-
getRowGroups
public JRCrosstabRowGroup[] getRowGroups()
Description copied from interface:JRCrosstabReturns the row groups of the crosstab.- Specified by:
getRowGroupsin interfaceJRCrosstab- Returns:
- the row groups
-
getColumnGroups
public JRCrosstabColumnGroup[] getColumnGroups()
Description copied from interface:JRCrosstabReturns the column groups of the crosstab.- Specified by:
getColumnGroupsin interfaceJRCrosstab- Returns:
- the column groups
-
getMeasures
public JRCrosstabMeasure[] getMeasures()
Description copied from interface:JRCrosstabReturns the crosstab measures.- Specified by:
getMeasuresin interfaceJRCrosstab- Returns:
- the crosstab measures
-
collectExpressions
public void collectExpressions(JRExpressionCollector collector)
- Specified by:
collectExpressionsin interfaceJRElement
-
visit
public void visit(JRVisitor visitor)
- Specified by:
visitin interfaceJRVisitable
-
setDataset
public void setDataset(JRDesignCrosstabDataset dataset)
Sets the crosstab input dataset.- Parameters:
dataset- the dataset- See Also:
JRCrosstab.getDataset()
-
addRowGroup
public void addRowGroup(JRDesignCrosstabRowGroup group) throws JRException
Adds a row group.This group will be a sub group of the last row group, if any.
- Parameters:
group- the group- Throws:
JRException- See Also:
JRCrosstab.getRowGroups()
-
addRowGroup
public void addRowGroup(int index, JRDesignCrosstabRowGroup group) throws JRExceptionAdds a row group.This group will be a sub group of the last row group, if any.
- Parameters:
group- the groupindex- position- Throws:
JRException- See Also:
JRCrosstab.getRowGroups()
-
addRowGroupVars
protected void addRowGroupVars(JRDesignCrosstabRowGroup rowGroup)
-
addColumnGroup
public void addColumnGroup(JRDesignCrosstabColumnGroup group) throws JRException
Adds a column group.This group will be a sub group of the last column group, if any.
- Parameters:
group- the group- Throws:
JRException- See Also:
JRCrosstab.getColumnGroups()
-
addColumnGroup
public void addColumnGroup(int index, JRDesignCrosstabColumnGroup group) throws JRExceptionAdds a column group.This group will be a sub group of the last column group, if any.
- Parameters:
group- the group- Throws:
JRException- See Also:
JRCrosstab.getColumnGroups()
-
addColGroupVars
protected void addColGroupVars(JRDesignCrosstabColumnGroup colGroup)
-
addMeasure
public void addMeasure(JRDesignCrosstabMeasure measure) throws JRException
Adds a measure to the crosstab.- Parameters:
measure- the measure- Throws:
JRException- See Also:
JRCrosstab.getMeasures()
-
addMeasure
public void addMeasure(int index, JRDesignCrosstabMeasure measure) throws JRExceptionAdds a measure to the crosstab.- Parameters:
measure- the measure- Throws:
JRException- See Also:
JRCrosstab.getMeasures()
-
addMeasureVars
protected void addMeasureVars(JRDesignCrosstabMeasure measure)
-
addTotalVar
protected void addTotalVar(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)
-
removeTotalVar
protected void removeTotalVar(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)
-
getTotalVariableName
public static java.lang.String getTotalVariableName(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup)
-
removeRowGroup
public JRCrosstabRowGroup removeRowGroup(java.lang.String groupName)
Removes a row group.- Parameters:
groupName- the group name- Returns:
- the removed group
-
removeRowGroupVars
protected void removeRowGroupVars(JRCrosstabRowGroup rowGroup)
-
removeRowGroup
public JRCrosstabRowGroup removeRowGroup(JRCrosstabRowGroup group)
Removes a row group.- Parameters:
group- the group to be removed- Returns:
- the removed group
-
removeColumnGroup
public JRCrosstabColumnGroup removeColumnGroup(java.lang.String groupName)
Removes a column group.- Parameters:
groupName- the group name- Returns:
- the removed group
-
removeColGroupVars
protected void removeColGroupVars(JRCrosstabColumnGroup colGroup)
-
removeColumnGroup
public JRCrosstabColumnGroup removeColumnGroup(JRCrosstabColumnGroup group)
Removes a column group.- Parameters:
group- the group- Returns:
- the removed group
-
removeMeasure
public JRCrosstabMeasure removeMeasure(java.lang.String measureName)
Removes a measure.- Parameters:
measureName- the measure name- Returns:
- the removed measure
-
removeMeasureVars
protected void removeMeasureVars(JRDesignCrosstabMeasure measure)
-
removeMeasure
public JRCrosstabMeasure removeMeasure(JRCrosstabMeasure measure)
Removes a measure.- Parameters:
measure- the measure- Returns:
- the removed measure
-
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
-
setRepeatColumnHeaders
public void setRepeatColumnHeaders(boolean repeatColumnHeaders)
Sets the repeat column headers flag.- Parameters:
repeatColumnHeaders- whether to repeat the column headers on row breaks- See Also:
JRCrosstab.isRepeatColumnHeaders()
-
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
-
setRepeatRowHeaders
public void setRepeatRowHeaders(boolean repeatRowHeaders)
Sets the repeat row headers flag.- Parameters:
repeatRowHeaders- whether to repeat the row headers on column breaks- See Also:
JRCrosstab.isRepeatRowHeaders()
-
getCells
public JRCrosstabCell[][] 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
-
getCellsList
public java.util.List<JRCrosstabCell> getCellsList()
Returns the data cells list.- Returns:
- the data cells list
- See Also:
addCell(JRDesignCrosstabCell)
-
getCellsMap
public java.util.Map<Pair<java.lang.String,java.lang.String>,JRCrosstabCell> getCellsMap()
Returns the crosstab cells indexed by corresponding row total group/ column total grouppairs.- Returns:
- the crosstab cells indexed by row/column total groups
- See Also:
JRCrosstabCell.getRowTotalGroup(),JRCrosstabCell.getColumnTotalGroup()
-
addCell
public void addCell(JRDesignCrosstabCell cell) throws JRException
Adds a data cell to the crosstab.- Parameters:
cell- the cell- Throws:
JRException- See Also:
JRCrosstab.getCells()
-
removeCell
public JRCrosstabCell removeCell(java.lang.String rowTotalGroup, java.lang.String columnTotalGroup)
Removes a data cell.- Parameters:
rowTotalGroup- the cell's total row groupcolumnTotalGroup- the cell's total column group- Returns:
- the removed cell
-
removeCell
public JRCrosstabCell removeCell(JRCrosstabCell cell)
Removes a data cell.- Parameters:
cell- the cell to be removed- Returns:
- the removed cell
-
getParameters
public JRCrosstabParameter[] 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
-
getParametersList
public java.util.List<JRCrosstabParameter> getParametersList()
Returns the paremeters list.- Returns:
- the paremeters list
-
getParametersMap
public java.util.Map<java.lang.String,JRCrosstabParameter> getParametersMap()
Returns the parameters indexed by names.- Returns:
- the parameters indexed by names
-
getParametersMapExpression
public JRExpression 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
-
addParameter
public void addParameter(JRCrosstabParameter parameter) throws JRException
Adds a parameter to the crosstab.- Parameters:
parameter- the parameter- Throws:
JRException- See Also:
JRCrosstab.getMeasures()
-
addParameter
public void addParameter(int index, JRCrosstabParameter parameter) throws JRExceptionAdds a parameter to the crosstab.- Parameters:
parameter- the parameter- Throws:
JRException- See Also:
JRCrosstab.getMeasures()
-
removeParameter
public JRCrosstabParameter removeParameter(java.lang.String parameterName)
Removes a parameter.- Parameters:
parameterName- the name of the parameter to be removed- Returns:
- the removed parameter
-
removeParameter
public JRCrosstabParameter removeParameter(JRCrosstabParameter parameter)
Removes a parameter.- Parameters:
parameter- the parameter to be removed- Returns:
- the removed parameter
-
setParametersMapExpression
public void setParametersMapExpression(JRExpression expression)
Sets the parameters map expression.- Parameters:
expression- the parameters map expression- See Also:
JRCrosstab.getParametersMapExpression()
-
getVariablesMap
public java.util.Map<java.lang.String,JRVariable> getVariablesMap()
Returns the variables of this crosstab indexed by name.- Returns:
- the variables of this crosstab indexed by name
-
getVariables
public JRVariable[] getVariables()
Returns the list of variables created for this crosstab.- Specified by:
getVariablesin interfaceJRCrosstab- Returns:
- the list of variables created for this crosstab
- See Also:
JRCrosstabGroup.getVariable(),JRCrosstabMeasure.getVariable(),JRCrosstab.VARIABLE_ROW_COUNT,JRCrosstab.VARIABLE_IS_EVEN_ROW,JRCrosstab.VARIABLE_COLUMN_COUNT,JRCrosstab.VARIABLE_IS_EVEN_COLUMN
-
getColumnBreakOffset
public int 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
-
setColumnBreakOffset
public void setColumnBreakOffset(int columnBreakOffset)
Sets the column break offset.- Parameters:
columnBreakOffset- the offset- See Also:
JRCrosstab.getColumnBreakOffset()
-
preprocess
public void preprocess()
Performs all the calculations required for report compilation.
-
setGroupVariablesClass
protected <T> void setGroupVariablesClass(java.util.List<T> groups)
-
calculateSizes
protected void calculateSizes()
-
setWhenNoDataCellSize
protected void setWhenNoDataCellSize()
-
createCellMatrix
protected void createCellMatrix()
-
getRowGroup
protected JRDesignCrosstabRowGroup getRowGroup(int rowGroupIndex)
-
getColumnGroup
protected JRDesignCrosstabColumnGroup getColumnGroup(int columnGroupIndex)
-
inheritCells
protected void inheritCells()
-
inheritCellSize
protected void inheritCellSize(int i, int j)
-
inheritCell
protected void inheritCell(int i, int j)
-
calculateRowHeadersSizes
protected int calculateRowHeadersSizes()
-
calculateColumnHeadersSizes
protected int calculateColumnHeadersSizes(int rowHeadersWidth)
-
setTitleSize
protected void setTitleSize(int rowHeadersWidth)
-
getWhenNoDataCell
public JRCellContents 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
-
setWhenNoDataCell
public void setWhenNoDataCell(JRDesignCellContents whenNoDataCell)
Sets the "No data" cell.- Parameters:
whenNoDataCell- the cell- See Also:
JRCrosstab.getWhenNoDataCell()
-
getElementByKey
public JRElement getElementByKey(java.lang.String elementKey)
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
-
getModeValue
public ModeEnum getModeValue()
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:
getModeValuein interfaceJRCommonElement- Overrides:
getModeValuein classJRBaseElement
-
getTitleCell
public CrosstabColumnCell 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
-
setTitleCell
public void setTitleCell(DesignCrosstabColumnCell titleCell)
-
getHeaderCell
public JRCellContents 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
-
setHeaderCell
public void setHeaderCell(JRDesignCellContents headerCell)
Sets the crosstab header cell (this cell will be rendered at the upper-left corder of the crosstab).- Parameters:
headerCell- the cell- See Also:
JRCrosstab.getHeaderCell()
-
measureClassChanged
protected void measureClassChanged(JRDesignCrosstabMeasure measure, java.lang.String valueClassName)
-
setTotalVarClass
protected void setTotalVarClass(JRCrosstabMeasure measure, JRCrosstabRowGroup rowGroup, JRCrosstabColumnGroup colGroup, java.lang.String valueClassName)
-
getRunDirectionValue
public RunDirectionEnum getRunDirectionValue()
Description copied from interface:JRCrosstabRetrieves the run direction of this crosstab- Specified by:
getRunDirectionValuein interfaceJRCrosstab- Returns:
- a value representing one of the run direction constants in
RunDirectionEnum
-
setRunDirection
public void setRunDirection(RunDirectionEnum runDirectionValue)
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:
runDirectionValue- a value representing one of the run direction constants inRunDirectionEnum
-
getHorizontalPosition
public HorizontalPosition 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
public void setHorizontalPosition(HorizontalPosition horizontalPosition)
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
-
setCellOrigin
protected void setCellOrigin(JRCellContents cell, JRCrosstabOrigin origin)
-
setCellOrigin
protected void setCellOrigin(JRDesignCellContents cell, JRCrosstabOrigin origin)
-
setParent
protected void setParent(JRDesignCrosstabGroup group)
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceJRCloneable- Overrides:
clonein classJRDesignElement
-
getRowGroupsList
public java.util.List<JRCrosstabRowGroup> getRowGroupsList()
-
getRowGroupIndicesMap
public java.util.Map<java.lang.String,java.lang.Integer> getRowGroupIndicesMap()
-
getColumnGroupsList
public java.util.List<JRCrosstabColumnGroup> getColumnGroupsList()
-
getColumnGroupIndicesMap
public java.util.Map<java.lang.String,java.lang.Integer> getColumnGroupIndicesMap()
-
getMesuresList
public java.util.List<JRCrosstabMeasure> getMesuresList()
-
getMeasureIndicesMap
public java.util.Map<java.lang.String,java.lang.Integer> getMeasureIndicesMap()
-
getIgnoreWidth
public java.lang.Boolean 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:
JRCrosstab.setIgnoreWidth(Boolean)
-
setIgnoreWidth
public void setIgnoreWidth(java.lang.Boolean ignoreWidth)
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:
JRCrosstab.PROPERTY_IGNORE_WIDTH
-
getDefaultLineColor
public java.awt.Color getDefaultLineColor()
- Specified by:
getDefaultLineColorin interfaceJRBoxContainer
-
getLineBox
public JRLineBox getLineBox()
- Specified by:
getLineBoxin interfaceJRBoxContainer
-
-