com.businessobjects.rebean.wi
Interface CrossTable

All Superinterfaces:
Representation, Table, TableFormBase, Unit

public interface CrossTable
extends Table

Warning: This interface is no longer functional from the SAP BusinessObjects 4.0 release onwards.

CrossTable is a representation of a cross table. A block is a CrossTable when Representation.getType() returns TableType.XTABLE.


Method Summary
 CellMatrix getCellMatrix(VZoneType v, HZoneType h)
          Returns the cells in a specific zone of the crosstable.
 CellMatrix getCellMatrix(VZoneType v, HZoneType h, BreakElement vBreak, BreakElement hBreak)
          Returns cells for a specific zone in a crosstable, for a specific break.
 Decoration getExtraHeaderDecoration()
          Returns the default graphics for the extra headers.
 boolean isExtraHeaderVisible()
          Checks if the crosstables extra headers are visible.
 boolean isHeaderVisible()
          For a cross table, this method checks if the extra headers are visible or not.
 boolean isLeftHeaderVisible()
          Checks if the left header of the cross table is visible.
 boolean isShowEmptyColumns()
          Checks if columns with empty measure values will be shown.
 boolean isShowEmptyDimensionCells()
          Checks if cells with empty dimension values will be shown.
 boolean isShowEmptyRows()
          Checks if rows with empty measure values will be shown or not.
 boolean isTopHeaderVisible()
          Checks if the top header of the cross table is visible.
 void setExtraHeaderVisible(boolean b)
          Shows or hides the extra headers.
 void setHeaderVisible(boolean b)
          For a cross table, this method shows the extra headers.
 void setLeftHeaderVisible(boolean visible)
          Shows or hides the left header of this cross table.
 void setShowEmptyColumns(boolean show)
          Shows or hides columns with empty measure values.
 void setShowEmptyDimensionCells(boolean show)
          Shows cells with empty dimension values.
 void setShowEmptyRows(boolean show)
          Shows or hides rows with empty measure values.
 void setTopHeaderVisible(boolean visible)
          Shows or hides the top header of this cross table.
 
Methods inherited from interface com.businessobjects.rebean.wi.Table
getBodyDecoration, getFooterDecoration, getHBlockCalculation, getHeaderDecoration, getVBlockCalculation, isFooterOnEveryPage, isFooterVisible, isHeaderOnEveryPage, setFooterOnEveryPage, setFooterVisible, setHeaderOnEveryPage
 
Methods inherited from interface com.businessobjects.rebean.wi.TableFormBase
getAlternateColor, getAlternateColorFrequency, getBodyTableDecoration, getCellPadding, getCellSpacing, getTableCell, setAlternateColor, setCellPadding, setCellSpacing
 
Methods inherited from interface com.businessobjects.rebean.wi.Representation
getBlock, getType, setType
 
Methods inherited from interface com.businessobjects.rebean.wi.Unit
getUnit, setUnit
 

Method Detail

getCellMatrix

CellMatrix getCellMatrix(VZoneType v,
                         HZoneType h)

Returns the cells in a specific zone of the crosstable. Any crosstable can be represented as a matrix of 9 zones:

empty
(TOP, LEFT)
top headers
(TOP, BODY)
top right footers
(TOP, RIGHT)
left headers
(BODY, LEFT)
body
(BODY, BODY)
right footers
(BODY, RIGHT)
bottom left footers
(BOTTOM, LEFT)
bottom footers
(BOTTOM, BODY)
bottom right footers
(BOTTOM, RIGHT)

How many cells each zone contains depends on the number of expressions on each axis. All TableAxis.HORIZONTAL expressions will be added vertically (they are the top headers), all TableAxis.VERTICAL expressions will be added horizontally (they are the left headers) and all TableAxis.CONTENT expressions will be added vertically (they are the body).

All the different zones are identified by two zone type parameters, in the table above, their values for each zone are given in parentheses.

Parameters:
v - the vertical zone.
h - the hozizontal zone.
Returns:
all cells in that zone.
Throws:
java.lang.NullPointerException - when v and/or h are null.

getCellMatrix

CellMatrix getCellMatrix(VZoneType v,
                         HZoneType h,
                         BreakElement vBreak,
                         BreakElement hBreak)

Returns cells for a specific zone in a crosstable, for a specific break. For this function, the same zones apply as described for CrossTable.getCellMatrix(VZoneType, HZoneType). Apart from those, this function also looks at the break level. In fact, getCellMatrix(VZoneType, HZoneType) has the same result as getCellMatrix(VZoneType, HZoneType, null, null); the first function never returns a CellMatrix for a break.

Each break on an expression in the left header (TableAxis.VERTICAL) has a vertical header and footer. Each break on a top header (TableAxis.HORIZONTAL) expression has a horizontal header and footer. Graphically, this comes down to:

        VHeader0        
        VHeader1        
       
(...)
       
        VHeaderm        
HHeader0 HHeader1 (...) HHeadern Body HFootern (...) (...) HFooter1 HFooter0
        VFooterm        
       
(...)
       
        VFooter1        
        VFooter0        

Where VHeaderi stands for vertical header i. This table represents a crosstable with m - 1 vertical breaks and n - 1 horizontal breaks. Each vertical or horizontal header or footer i stands for the break at index i - 1 (index as in BlockBreak.getBreakElement(int)) and when i == 0, the header or footer belongs to the table itself and not to any break.

Each break has a header and a footer. These might be hidden (BreakElement.setHeaderVisible(boolean) and BreakElement.setFooterVisible(boolean)). When a user has deleted all rows or columns of a break header or footer (using the applet - this cannot be done using ReBean at this moment), they can be reset to their default value by calling BreakElement.setHeaderVisible(true) or BreakElement.setFooterVisible(true).

Each break's header and footer are repeated for each different break value (if they are visible of course). By default, the first break's footer has a transparent row or column at the end to give a visual seperation between the two values (in fact, the result will look like there are several tables).

As an example of break and table headers and footers, look at this table:

(1) (6)=Year (11)
(2)=Country (7)=Revenue (12)=Sum(Revenue)
(3)=Country (8)=Sum(Revenue) (13)=Sum(Revenue)
(4) (9) (14)
(5) (10)=Sum(Revenue) (15)=Sum(Revenue)

Headers are indicated in bold text, the body in normal text and the footers in italic. The numbers in the upper left corners have been added to identify each cell later on - this would never appear in a real table structure.

This table might have been created with the following code:

 // ...
 
 ReportContainer report = documentInstance.createReport("My Report");
 ReportBlock block = report.getReportBody().createBlock();

 block.getAxis(TableAxis.HORIZONTAL).addExpr(year);
 block.getAxis(TableAxis.VERTICAL).addExpr(country);
 block.getAxis(TableAxis.CONTENT).addExpr(revenue);

 // set a break on Country, this introduces a second header and
 // footer
 BreakElement countryBreak = block.getAxis(TableAxis.VERTICAL)
                            .getBlockBreak().createBreakElement(country);
 
 block.getAxis(TableAxis.CONTENT).getHBlockCalculation()
      .createCalculationElement(revenue, Calculation.SUM);
 block.getAxis(TableAxis.CONTENT).getVBlockCalculation()
      .createCalculationElement(revenue, Calculation.SUM);
  
 Crosstable xtab = (CrossTable) block.getRepresentation()
                   .setType(TableType.XTABLE);

By default, countryBreak.isHeaderVisible() == false, so we do not see it in the table above.

For the following parameters to this function, we will get the following parts of the table:

v h vBreak hBreak CellMatrix
TOP LEFT null null
(1)
TOP LEFT countryBreak null cell between (1) and (2), not visible but identical to (1)
BODY LEFT null null
(2)=Country
BOTTOM LEFT countryBreak null
(3)=Country
(4)
BOTTOM LEFT null null
(5)
TOP BODY null null
(6)=Year
TOP BODY countryBreak null cell between (6) and (7), not visible but identical to (6)
BODY BODY null null
(7)=Revenue
BOTTOM BODY countryBreak null
(8)=Sum(Revenue)
(9)
BOTTOM BODY null null
(10)=Sum(Revenue)
TOP RIGHT null null
(11)
TOP RIGHT countryBreak null cell between (11) and (12), not visible but identical to (11)
BODY RIGHT null null
(12)=Sum(Revenue)
BOTTOM RIGHT countryBreak null
(13)=Sum(Revenue)
(14)
BOTTOM RIGHT null null
(15)=Sum(Revenue)

Parameters:
v - the vertical zone.
h - the hozizontal zone.
vBreak - the vertical break, or null to get a zone that does not depend on a vertical break.
hBreak - the horizontal break, or null to get a zone that does not depend on a horizontal break.
Returns:
all cells in that zone.
Throws:
java.lang.NullPointerException - when v and/or h are null.

isExtraHeaderVisible

boolean isExtraHeaderVisible()

Checks if the crosstables extra headers are visible. A crosstable has extra headers, that normally are not displayed.

Say that if we have a crosstable that looks like:

            +----------+----------+----------+
            | New York | LA       | Chicago  |
 +----------+----------+----------+----------+
 | 2000     |    5,000 |    4,500 |    4,000 |
 +----------+----------+----------+----------+
 | 2001     |    6,000 |    5,000 |    5,500 |
 +----------+----------+----------+----------+
 | 2002     |    7,500 |    6,000 |    5,750 |
 +----------+----------+----------+----------+
It can be easily noticed that this table only contains values, even in its headers. The crosstable's extra headers, which are not displayed in the previous example, might make things a little bit easier to read:
            +----------+----------+----------+----------+
            | City     | New York | LA       | Chicago  |
 +----------+----------+----------+----------+----------+
 | Year     |          | Stock    | Stock    | Stock    |
 +----------+----------+----------+----------+----------+
 | 2000     | Stock    |    5,000 |    4,500 |    4,000 |
 +----------+----------+----------+----------+----------+
 | 2001     | Stock    |    6,000 |    5,000 |    5,500 |
 +----------+----------+----------+----------+----------+
 | 2002     | Stock    |    7,500 |    6,000 |    5,750 |
 +----------+----------+----------+----------+----------+

Returns:
true when the extra headers are visible (default is false)

setExtraHeaderVisible

void setExtraHeaderVisible(boolean b)
Shows or hides the extra headers. When showing the extra headers, any hidden table headers (see CrossTable.isTopHeaderVisible() and CrossTable.isLeftHeaderVisible()) will also be shown.

Parameters:
b - when true, the extra headers will be shown
See Also:
CrossTable.isExtraHeaderVisible()

isHeaderVisible

boolean isHeaderVisible()
For a cross table, this method checks if the extra headers are visible or not. For control over the table's headers, use CrossTable.isTopHeaderVisible() and CrossTable.isLeftHeaderVisible().

Specified by:
isHeaderVisible in interface Table
Returns:
true when the header cells are visible (default is true)
See Also:
Table.isHeaderVisible(), CrossTable.isExtraHeaderVisible()

setHeaderVisible

void setHeaderVisible(boolean b)
For a cross table, this method shows the extra headers. For control over the table's headers, use CrossTable.setTopHeaderVisible(boolean) and CrossTable.setLeftHeaderVisible(boolean).

Specified by:
setHeaderVisible in interface Table
Parameters:
b - when true, the header cells will be shown
See Also:
Table.setHeaderVisible(boolean), CrossTable.setExtraHeaderVisible(boolean)

getExtraHeaderDecoration

Decoration getExtraHeaderDecoration()
Returns the default graphics for the extra headers.

Returns:
the default graphics for the extra headers

setShowEmptyRows

void setShowEmptyRows(boolean show)
Shows or hides rows with empty measure values.

Parameters:
show - when true, rows with empty measure values will be shown
Since:
11.5

isShowEmptyRows

boolean isShowEmptyRows()
Checks if rows with empty measure values will be shown or not.

Returns:
true if show empty rows is set.
Since:
11.5

setShowEmptyColumns

void setShowEmptyColumns(boolean show)
Shows or hides columns with empty measure values.

Parameters:
show - when true, columns with empty measure values will be shown
Since:
11.5

isShowEmptyColumns

boolean isShowEmptyColumns()
Checks if columns with empty measure values will be shown.

Returns:
true if show empty columns is set.
Since:
11.5

isTopHeaderVisible

boolean isTopHeaderVisible()
Checks if the top header of the cross table is visible.

Returns:
true if the top header is visible.
Since:
11.5

setTopHeaderVisible

void setTopHeaderVisible(boolean visible)
Shows or hides the top header of this cross table.

Parameters:
visible - when true, the top header will be shown.
Since:
11.5

isLeftHeaderVisible

boolean isLeftHeaderVisible()
Checks if the left header of the cross table is visible.

Returns:
true if the left header is visible.
Since:
11.5

setLeftHeaderVisible

void setLeftHeaderVisible(boolean visible)
Shows or hides the left header of this cross table.

Parameters:
visible - when true, the left header will be shown.
Since:
11.5

setShowEmptyDimensionCells

void setShowEmptyDimensionCells(boolean show)
Shows cells with empty dimension values.

Parameters:
show - when true, empty rows/columns will be shown
Since:
12.1.0

isShowEmptyDimensionCells

boolean isShowEmptyDimensionCells()
Checks if cells with empty dimension values will be shown.

Returns:
true if show empty rows/columns is set.
Since:
12.1.0