net.sf.jasperreports.crosstabs

## Interface JRCrosstab

- All Superinterfaces:
    java.lang.Cloneable, JRBoxContainer, JRChild, JRCloneable, JRCommonElement, JRElement, JRIdentifiable, JRPropertiesHolder, JRStyleContainer, JRVisitable
  All Known Implementing Classes:
    JRBaseCrosstab, JRDesignCrosstab, JRFillCrosstab

      public interface JRCrosstab
      extends JRElement, JRBoxContainer

  Crosstab element interface.
  Version:
    $Id: JRCrosstab.java 6874 2014-02-07 11:24:22Z lucianc $
  Author:
    Lucian Chirita (lucianc@users.sourceforge.net)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_COLUMN_BREAK_OFFSET` The default offset used for column breaks.
    `static java.lang.String` | `PROPERTY_IGNORE_WIDTH` A property that provides a default value for the ignore width crosstab flag.
    `static java.lang.String` | `VARIABLE_COLUMN_COUNT` Name of the built-in column count variable.
    `static java.lang.String` | `VARIABLE_ROW_COUNT` Name of the built-in row count variable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JRCrosstabCell[][]` | `getCells()` Returns the data cell matrix.
    `int` | `getColumnBreakOffset()` Returns the column break offset.
    `JRCrosstabColumnGroup[]` | `getColumnGroups()` Returns the column groups of the crosstab.
    `JRCrosstabDataset` | `getDataset()` Returns the input dataset of the crosstab.
    `JRElement` | `getElementByKey(java.lang.String key)` Searches for an element inside all crosstab cells.
    `JRCellContents` | `getHeaderCell()` Returns a cell which will be rendered at the upper-left corner of the crosstab.
    `HorizontalPosition` | `getHorizontalPosition()` Returns the position of the crosstab within its element box.
    `int` | `getId()` Returns the ID of the crosstab.
    `java.lang.Boolean` | `getIgnoreWidth()` Returns the ignore width flag for the crosstab.
    `JRCrosstabMeasure[]` | `getMeasures()` Returns the crosstab measures.
    `JRCrosstabParameter[]` | `getParameters()` Returns the crosstab parameters.
    `JRExpression` | `getParametersMapExpression()` Returns the parameters map expression.
    `JRCrosstabRowGroup[]` | `getRowGroups()` Returns the row groups of the crosstab.
    `RunDirectionEnum` | `getRunDirectionValue()` Retrieves the run direction of this crosstab
    `CrosstabColumnCell` | `getTitleCell()` Returns the title cell, which renders once at the beginning of the crosstab.
    `JRVariable[]` | `getVariables()` Returns the variables defined for the crosstab.
    `JRCellContents` | `getWhenNoDataCell()` Returns a cell which will be rendered when no data was fed to the crosstab.
    `boolean` | `isRepeatColumnHeaders()` Returns whether to repeat the column headers after a row break.
    `boolean` | `isRepeatRowHeaders()` Returns whether to repeat the row headers after a column break.
    `void` | `setHorizontalPosition(HorizontalPosition horizontalPosition)` Sets the position of the crosstab within its element box.
    `void` | `setIgnoreWidth(boolean ignoreWidth)` Set the ignore width crosstab flag.
    `void` | `setIgnoreWidth(java.lang.Boolean ignoreWidth)` Set the ignore width crosstab flag.
    `void` | `setRunDirection(RunDirectionEnum runDirectionEnum)` Sets the run direction of the crosstab.

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRElement

      `clone, collectExpressions, getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRChild

      `clone`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRVisitable

      `visit`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRCloneable

      `clone`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRCommonElement

      `getBackcolor, getForecolor, getHeight, getModeValue, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer

      `getDefaultStyleProvider, getStyle, getStyleNameReference`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder

      `getParentProperties, getPropertiesMap, hasProperties`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRIdentifiable

      `getUUID`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRBoxContainer

      `getDefaultLineColor, getLineBox`

- - ### Field Detail

    - #### DEFAULT_COLUMN_BREAK_OFFSET

          static final int DEFAULT_COLUMN_BREAK_OFFSET

      The default offset used for column breaks.
      See Also:
        `getColumnBreakOffset()`, Constant Field Values

    - #### VARIABLE_ROW_COUNT

          static final java.lang.String VARIABLE_ROW_COUNT

      Name of the built-in row count variable.
      See Also:
        Constant Field Values

    - #### VARIABLE_COLUMN_COUNT

          static final java.lang.String VARIABLE_COLUMN_COUNT

      Name of the built-in column count variable.
      See Also:
        Constant Field Values

    - #### PROPERTY_IGNORE_WIDTH

          static final java.lang.String PROPERTY_IGNORE_WIDTH

      A property that provides a default value for the ignore width crosstab flag.

      The property can be set globally and at report level. A flag/attribute set for a crosstab will override the property.

      The property value set at report level will be used when the crosstab flag is not set. If neither the crosstab flag and report level property exist and the `JRParameter.IS_IGNORE_PAGINATION` parameter is set to true, the crosstab width is ignored. Otherwise, the global property value will be used.

      The default global value of this property is `false`, i.e. crosstabs will break by default at the width set for the crosstab report element.

      See Also:
        `setIgnoreWidth(Boolean)`, Constant Field Values

  - ### Method Detail

    - #### getId

          int getId()

      Returns the ID of the crosstab.

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

      Returns:
        the ID of the crosstab

    - #### getDataset

          JRCrosstabDataset getDataset()

      Returns the input dataset of the crosstab.
      Returns:
        the input dataset of the crosstab

    - #### getRowGroups

          JRCrosstabRowGroup[] getRowGroups()

      Returns the row groups of the crosstab.
      Returns:
        the row groups

    - #### getColumnGroups

          JRCrosstabColumnGroup[] getColumnGroups()

      Returns the column groups of the crosstab.
      Returns:
        the column groups

    - #### getMeasures

          JRCrosstabMeasure[] getMeasures()

      Returns the crosstab measures.
      Returns:
        the crosstab measures

    - #### getColumnBreakOffset

          int getColumnBreakOffset()

      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.

      Returns:
        the column break offset

    - #### isRepeatColumnHeaders

          boolean isRepeatColumnHeaders()

      Returns whether to repeat the column headers after a row break.
      Returns:
        whether to repeat the column headers after a row break

    - #### isRepeatRowHeaders

          boolean isRepeatRowHeaders()

      Returns whether to repeat the row headers after a column break.
      Returns:
        whether to repeat the row headers after a column break

    - #### getCells

          JRCrosstabCell[][] getCells()

      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.

      Returns:
        the data cell matrix

    - #### getParameters

          JRCrosstabParameter[] getParameters()

      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.

      Returns:
        the crosstab parameters

    - #### getParametersMapExpression

          JRExpression getParametersMapExpression()

      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.

      Returns:
        the parameters map expression

    - #### getWhenNoDataCell

          JRCellContents getWhenNoDataCell()

      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.

      Returns:
        a cell which will be rendered when no data was fed to the crosstab

    - #### getElementByKey

          JRElement getElementByKey(java.lang.String key)

      Searches for an element inside all crosstab cells.
      Parameters:
        `key` - the element key
      Returns:
        the first element having the specified key

    - #### getHeaderCell

          JRCellContents getHeaderCell()

      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.
      Returns:
        a cell which will be rendered at the upper-left corner of the crosstab

    - #### getVariables

          JRVariable[] getVariables()

      Returns the variables defined for the crosstab.
      Returns:
        variables defined for the crosstab
      See Also:
        `JRCrosstabGroup.getVariable()`, `JRCrosstabMeasure.getVariable()`, `VARIABLE_ROW_COUNT`, `VARIABLE_COLUMN_COUNT`

    - #### getRunDirectionValue

          RunDirectionEnum getRunDirectionValue()

      Retrieves the run direction of this crosstab
      Returns:
        a value representing one of the run direction constants in `RunDirectionEnum`

    - #### setRunDirection

          void setRunDirection(RunDirectionEnum runDirectionEnum)

      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).

      Parameters:
        `runDirectionEnum` - a value representing one of the run direction constants in `RunDirectionEnum`

    - #### getIgnoreWidth

          java.lang.Boolean getIgnoreWidth()

      Returns the ignore width flag for the crosstab.
      Returns:
        the ignore width flag, or `null` is the crosstab does not specify a flag value
      See Also:
        `setIgnoreWidth(Boolean)`

    - #### setIgnoreWidth

          void setIgnoreWidth(java.lang.Boolean ignoreWidth)

      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 `PROPERTY_IGNORE_WIDTH` property and the `JRParameter.IS_IGNORE_PAGINATION` parameter.

      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:
        `PROPERTY_IGNORE_WIDTH`

    - #### setIgnoreWidth

          void setIgnoreWidth(boolean ignoreWidth)

      Set the ignore width crosstab flag.
      Parameters:
        `ignoreWidth` -
      See Also:
        `setIgnoreWidth(Boolean)`

    - #### getHorizontalPosition

          HorizontalPosition getHorizontalPosition()

      Returns the position of the crosstab within its element box.
      Returns:
        the position of the crosstab within its element box, `null` if no position is specified

    - #### setHorizontalPosition

          void setHorizontalPosition(HorizontalPosition horizontalPosition)

      Sets the position of the crosstab within its element box.
      Parameters:
        `horizontalPosition` - the crosstab position, if `null` the default position is applied

    - #### getTitleCell

          CrosstabColumnCell getTitleCell()

      Returns the title cell, which renders once at the beginning of the crosstab.
      Returns:
        the title cell

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com