Class JRFillCrosstab

    • Field Detail

      • EXCEPTION_MESSAGE_KEY_BUCKETING_SERVICE_ERROR

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_BUCKETING_SERVICE_ERROR
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_EVALUATOR_LOADING_ERROR

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_EVALUATOR_LOADING_ERROR
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_INFINITE_LOOP

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_INFINITE_LOOP
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_NOT_ENOUGH_SPACE

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_NOT_ENOUGH_SPACE
        See Also:
        Constant Field Values
      • PROPERTY_INTERACTIVE

        public static final java.lang.String 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:
        Constant Field Values
      • PROPERTY_FLOATING_HEADERS

        public static final java.lang.String PROPERTY_FLOATING_HEADERS
        Property that enables/disables the floating headers in the crosstab component when scrolling. If the interactivity has been disabled by setting PROPERTY_INTERACTIVE to false, 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:
        Constant Field Values
      • PROPERTY_ORDER_BY_COLUMN

        public static final java.lang.String PROPERTY_ORDER_BY_COLUMN
        See Also:
        Constant Field Values
      • PROPERTY_ROW_GROUP_COLUMN_HEADER

        public static final java.lang.String PROPERTY_ROW_GROUP_COLUMN_HEADER
        See Also:
        Constant Field Values
      • PROPERTY_COLUMN_HEADER_SORT_MEASURE_INDEX

        public static final java.lang.String PROPERTY_COLUMN_HEADER_SORT_MEASURE_INDEX
        See Also:
        Constant Field Values
      • CROSSTAB_INTERACTIVE_ELEMENT_NAME

        public static final java.lang.String CROSSTAB_INTERACTIVE_ELEMENT_NAME
        See Also:
        Constant Field Values
      • HTML_CLASS_COLUMN_FLOATING

        public static final java.lang.String HTML_CLASS_COLUMN_FLOATING
        See Also:
        Constant Field Values
      • HTML_CLASS_ROW_FLOATING

        public static final java.lang.String HTML_CLASS_ROW_FLOATING
        See Also:
        Constant Field Values
      • HTML_CLASS_CROSS_FLOATING

        public static final java.lang.String HTML_CLASS_CROSS_FLOATING
        See Also:
        Constant Field Values
      • CROSSTAB_INTERACTIVE_ELEMENT_TYPE

        public static final JRGenericElementType CROSSTAB_INTERACTIVE_ELEMENT_TYPE
      • FILL_CACHE_KEY_CROSSTAB_CHUNK_COUNTER

        protected static final java.lang.String FILL_CACHE_KEY_CROSSTAB_CHUNK_COUNTER
      • parentCrosstab

        protected final JRCrosstab parentCrosstab
      • rowGroupsMap

        protected java.util.Map<java.lang.String,​java.lang.Integer> rowGroupsMap
      • columnGroupsMap

        protected java.util.Map<java.lang.String,​java.lang.Integer> columnGroupsMap
      • variablesMap

        protected java.util.Map<java.lang.String,​JRFillVariable> variablesMap
      • retrieveTotal

        protected boolean[][] retrieveTotal
      • parametersMap

        protected java.util.Map<java.lang.String,​JRFillParameter> parametersMap
      • ignoreWidth

        protected boolean ignoreWidth
      • hasData

        protected boolean hasData
      • columnHeadersData

        protected HeaderCell[][] columnHeadersData
      • rowHeadersData

        protected HeaderCell[][] rowHeadersData
    • Method Detail

      • getModeValue

        public ModeEnum getModeValue()
        Description copied from interface: JRCommonElement
        Returns 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:
        getModeValue in interface JRCommonElement
        Overrides:
        getModeValue in class JRFillElement
      • loadEvaluator

        protected void loadEvaluator​(JasperReport jasperReport)
      • createOrderer

        protected BucketOrderer createOrderer​(JRCrosstabGroup group,
                                              int groupIndex,
                                              java.util.Comparator<java.lang.Object> bucketComparator)
      • initBucketingService

        protected void initBucketingService()
      • setOrderByColumnInfo

        protected void setOrderByColumnInfo()
      • setOrderByColumnBucketValues

        protected void setOrderByColumnBucketValues()
      • addCrosstabChunk

        protected void addCrosstabChunk​(java.util.List<JRPrintElement> elements,
                                        int yOffset)
      • getChunkIndex

        protected int getChunkIndex()
      • createInteractiveElement

        protected JRTemplateGenericPrintElement createInteractiveElement​(java.lang.String chunkId,
                                                                         boolean floatingHeaders)
      • matchesOrderByColumn

        protected boolean matchesOrderByColumn​(HeaderCell cell)
      • getPrintElements

        protected java.util.List<? extends JRPrintElement> getPrintElements()
      • getPrintElementsWidth

        protected int getPrintElementsWidth()
      • mirrorPrintElements

        protected void mirrorPrintElements​(java.util.List<JRPrintElement> printElements,
                                           int width)
      • resolveElement

        protected void resolveElement​(JRPrintElement element,
                                      byte evaluation)
        Description copied from class: JRFillElement
        Resolves an element.
        Specified by:
        resolveElement in class JRFillElement
        Parameters:
        element - the element
        evaluation - the evaluation type
      • getId

        public int getId()
        Description copied from interface: JRCrosstab
        Returns the ID of the crosstab.

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

        Specified by:
        getId in interface JRCrosstab
        Returns:
        the ID of the crosstab
      • getDataset

        public JRCrosstabDataset getDataset()
        Description copied from interface: JRCrosstab
        Returns the input dataset of the crosstab.
        Specified by:
        getDataset in interface JRCrosstab
        Returns:
        the input dataset of the crosstab
      • getColumnBreakOffset

        public int getColumnBreakOffset()
        Description copied from interface: JRCrosstab
        Returns the column break offset.

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

        Specified by:
        getColumnBreakOffset in interface JRCrosstab
        Returns:
        the column break offset
      • isRepeatColumnHeaders

        public boolean isRepeatColumnHeaders()
        Description copied from interface: JRCrosstab
        Returns whether to repeat the column headers after a row break.
        Specified by:
        isRepeatColumnHeaders in interface JRCrosstab
        Returns:
        whether to repeat the column headers after a row break
      • isRepeatRowHeaders

        public boolean isRepeatRowHeaders()
        Description copied from interface: JRCrosstab
        Returns whether to repeat the row headers after a column break.
        Specified by:
        isRepeatRowHeaders in interface JRCrosstab
        Returns:
        whether to repeat the row headers after a column break
      • getCells

        public JRCrosstabCell[][] getCells()
        Description copied from interface: JRCrosstab
        Returns the data cell matrix.

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

        • 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:
        getCells in interface JRCrosstab
        Returns:
        the data cell matrix
      • getWhenNoDataCell

        public JRCellContents getWhenNoDataCell()
        Description copied from interface: JRCrosstab
        Returns a cell which will be rendered when no data was fed to the crosstab.

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

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

        Specified by:
        getWhenNoDataCell in interface JRCrosstab
        Returns:
        a cell which will be rendered when no data was fed to the crosstab
      • getParameters

        public JRCrosstabParameter[] getParameters()
        Description copied from interface: JRCrosstab
        Returns the crosstab parameters.

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

        A crosstab parameters has a name and a value expression.

        Specified by:
        getParameters in interface JRCrosstab
        Returns:
        the crosstab parameters
      • getParametersMapExpression

        public JRExpression getParametersMapExpression()
        Description copied from interface: JRCrosstab
        Returns the parameters map expression.

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

        Specified by:
        getParametersMapExpression in interface JRCrosstab
        Returns:
        the parameters map expression
      • getElementByKey

        public JRElement getElementByKey​(java.lang.String elementKey)
        Description copied from interface: JRCrosstab
        Searches for an element inside all crosstab cells.
        Specified by:
        getElementByKey in interface JRCrosstab
        Parameters:
        elementKey - the element key
        Returns:
        the first element having the specified key
      • getTitleCell

        public CrosstabColumnCell getTitleCell()
        Description copied from interface: JRCrosstab
        Returns the title cell, which renders once at the beginning of the crosstab.
        Specified by:
        getTitleCell in interface JRCrosstab
        Returns:
        the title cell
      • getHeaderCell

        public JRCellContents getHeaderCell()
        Description copied from interface: JRCrosstab
        Returns 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:
        getHeaderCell in interface JRCrosstab
        Returns:
        a cell which will be rendered at the upper-left corner of the crosstab
      • setRunDirection

        public void setRunDirection​(RunDirectionEnum runDirection)
        Description copied from interface: JRCrosstab
        Sets 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:
        setRunDirection in interface JRCrosstab
        Parameters:
        runDirection - a value representing one of the run direction constants in RunDirectionEnum
      • getHorizontalPosition

        public HorizontalPosition getHorizontalPosition()
        Description copied from interface: JRCrosstab
        Returns the position of the crosstab within its element box.
        Specified by:
        getHorizontalPosition in interface JRCrosstab
        Returns:
        the position of the crosstab within its element box, null if no position is specified
      • setHorizontalPosition

        public void setHorizontalPosition​(HorizontalPosition horizontalPosition)
        Description copied from interface: JRCrosstab
        Sets the position of the crosstab within its element box.
        Specified by:
        setHorizontalPosition in interface JRCrosstab
        Parameters:
        horizontalPosition - the crosstab position, if null the default position is applied
      • getIgnoreWidth

        public java.lang.Boolean getIgnoreWidth()
        Description copied from interface: JRCrosstab
        Returns the ignore width flag for the crosstab.
        Specified by:
        getIgnoreWidth in interface JRCrosstab
        Returns:
        the ignore width flag, or null is 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: JRCrosstab
        Set 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_WIDTH property and the JRParameter.IS_IGNORE_PAGINATION parameter.

        Specified by:
        setIgnoreWidth in interface JRCrosstab
        Parameters:
        ignoreWidth - whether the element width is to be ignored by the crosstab, or null if the default setting is to be used
        See Also:
        JRCrosstab.PROPERTY_IGNORE_WIDTH