|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TableCell
Warning: This interface is no longer functional from the SAP BusinessObjects 4.0 release onwards.
The TableCell object represents a single cell in a table.
Method Summary | |
---|---|
double |
estimateMinimalHeight()
Estimates the minimal height, in the current unit ,
for this cell. |
CellMatrix |
getCellMatrix()
Returns the CellMatrix this cell is part of. |
int |
getColSpan()
Returns the number of columns spanned by this cell. |
int |
getColumn()
Returns the column in which this cell is placed in the cell matrix. |
CellContentType |
getContentType()
Returns the TableCell object's content type. |
ReportExpression |
getExpr()
Returns the ReportExpression displayed by this cell. |
FormatNumber |
getFormatNumber()
Returns the format for values in this cell. |
double |
getHeight()
Returns the height of the current TableCell . |
double |
getHorizontalPadding()
Returns the cell's horizontal padding. |
java.lang.String |
getID()
Returns the ID of this cell. |
ReportExpression |
getNestedExpr()
Returns the ReportExpression displayed by this cell. |
double |
getPadding()
Deprecated. Use TableCell.getVerticalPadding() and
TableCell.getHorizontalPadding() instead. |
int |
getRow()
Returns the index of the row in which this cell is placed in the cell matrix. |
int |
getRowSpan()
Returns the number of rows spanned by this cell. |
java.lang.String |
getText()
Returns a text representation of this cell. |
double |
getVerticalPadding()
Returns the cell's vertical padding. |
double |
getWidth()
Return the cell width. |
boolean |
hasCalculation()
Returns true if the cell contains a calculation. |
boolean |
isAutoFitHeight()
Returns true if the height of the cell depends on the content. |
boolean |
isAutoFitWidth()
Returns true if this cell's width is dependent on its content. |
boolean |
isCustomFormula()
Returns true if this TableCell contains a custom formula. |
void |
setAutoFitHeight(boolean b)
It is set to true when the TableCell height is to be adjusted to fit its content. |
void |
setAutoFitWidth(boolean b)
It is set to true when the TableCell width is to be adjusted to fit its content. |
void |
setColSpan(int span)
Sets the number of columns spanned by this cell. |
void |
setColumnAutoFitWidth(boolean b)
Sets or unsets the autoFitWidth property on all
cells in this table that end in the same column. |
void |
setContentType(CellContentType t)
Changes the TableCell object's type. |
void |
setExpr(ReportExpression expr)
Changes the report expression this cell displays. |
void |
setFormatNumber(FormatNumber format)
Sets the format for values in this cell. |
void |
setHeight(double size)
Changes the TableCell height. |
void |
setHorizontalPadding(double padding)
Changes the cell's horizontal padding. |
void |
setPadding(double padding)
Changes the padding in the cell. |
void |
setRowAutoFitHeight(boolean b)
Sets the autoFitHeight property to
b for all table cells in the same row in the table. |
void |
setRowSpan(int span)
Sets the number of rows spanned by this cell. |
void |
setText(java.lang.String text)
Changes the contents of this cell to a simple text string. |
void |
setVerticalPadding(double padding)
Changes the cell's vertical padding If this value is negative, the default TableFormBase.getCellPadding() value
will be applied. |
void |
setWidth(double size)
Changes the current width of the current TableCell . |
Methods inherited from interface com.businessobjects.rebean.wi.Unit |
---|
getUnit, setUnit |
Methods inherited from interface com.businessobjects.rebean.wi.Decoration |
---|
getAlignment, getAttributes, getBackgroundAlignment, getFont, setAlignment, setAttributes, setBackgroundAlignment, setFont |
Methods inherited from interface com.businessobjects.rebean.wi.Alertable |
---|
getAlerters |
Method Detail |
---|
java.lang.String getID()
CellMatrix getCellMatrix()
CellMatrix
this cell is part of.
CellMatrix
this cell is part of, or
null
if this cell has been removed from its table.CellMatrix
double getWidth()
Note : the width is returned in the the current Unit
format. You can retrieve the current Unit
format using
Unit.getUnit()
.
ReportException
- Thrown when this cell has been removed from the table.Unit
void setWidth(double size)
TableCell
.
Note: Calling setWidth
changes the width of all cells in the same column.
size
- The new cell width in the current unit. You can retrieve the current
Unit
format using Unit.getUnit()
.
java.lang.IllegalArgumentException
- when size < 0
ReportException
- Thrown when this cell has been removed from the table.Unit
double getHeight()
TableCell
.
The hight is returned in the the current Unit
format. You can retrieve the
current Unit
format using Unit.getUnit()
.
ReportException
- Thrown when this cell has been removed from the table.Unit
void setHeight(double size)
TableCell
height.
Note: Calling setHeight
changes the height of all cells in the same row.
size
- The new height in the current unit. You can retrieve the
current Unit
format using Unit.getUnit()
.
java.lang.IllegalArgumentException
- when size < 0
ReportException
- Thrown when this cell has been removed from the table.boolean isAutoFitWidth()
true
if this cell's width is dependent on its content.
true
when the width of the cell is adjusted to fit
the cell's content.void setAutoFitWidth(boolean b)
true
when the TableCell
width is to be adjusted to fit its content.
When set to true
, the cell width serves as a minimal value;
it will be extended if the content does not fit in.
b
- Set to true
for the cell width to be adjusted to fit content.boolean isAutoFitHeight()
true
if the height of the cell depends on the content.
true
when the height of the cell is adjusted to fit contentvoid setAutoFitHeight(boolean b)
true
when the TableCell
height is to be adjusted to fit its content.
When set to true
, the cell height serves as a minimal height;
it will be extended if the content does not fit in.
b
- Set to true
for the cell height to be adjusted to fit content.double getHorizontalPadding()
Note: the default padding is 3 points, or 1/24 inch.
Unit
. You can retrieve the
current Unit
format using Unit.getUnit()
.void setHorizontalPadding(double padding)
If this value is negative, the default TableFormBase.getCellPadding()
value
will be applied.
padding
- The new padding in the cell in the current Unit
. You can retrieve the
current Unit
format using Unit.getUnit()
.double getVerticalPadding()
Note: the default padding is 1.5 points, or 1/48 inch.
Unit
. You can retrieve the
current Unit
format using Unit.getUnit()
.void setVerticalPadding(double padding)
If this value is negative, the default TableFormBase.getCellPadding()
value
will be applied.
padding
- The new cell padding in the current Unit
. You can retrieve the
current Unit
format using Unit.getUnit()
.double getPadding()
TableCell.getVerticalPadding()
and
TableCell.getHorizontalPadding()
instead.
Returns the padding in the cell.
If TableCell.getVerticalPadding()
returns a different value from
TableCell.getHorizontalPadding()
, this method will return -1
.
If both values are equal, this method will return that value, in the
current Unit
. You can retrieve the current
Unit
format using Unit.getUnit()
.
-1
if this cell has
different values for horizontal and vertical padding.void setPadding(double padding)
TableCell.setVerticalPadding(double)
and
TableCell.setHorizontalPadding(double)
with the given value.
padding
- The new padding in the cell, in the current Unit
.
You can retrieve the current Unit
format using
Unit.getUnit()
.
java.lang.IllegalArgumentException
- Thrown when padding < 0
.TableCell.getPadding()
,
TableFormBase.setCellPadding(double)
ReportExpression getExpr()
ReportExpression
displayed by this cell.
Note: this will usually be a formula; use getNestedExpr()
to return a ReportExpression
from the ReportDictionary
.
ReportDictionary
,
ReportExpression
ReportExpression getNestedExpr()
ReportExpression
displayed by this cell.
Unless the expression is a complex formula such as =[Revenue] / COUNT([Month])
,
getNestedExpr
always returns the base expression displayed in the cell.
null
if no ReportExpression
is present.void setExpr(ReportExpression expr)
FormulaExpression
,
the expression will automatically be transformed to a formula =expr
.
Note: if the expression is not in one of the table's axes, it might be added, depending on its type.
expr
- The report expression this cell should now display. Returns null
when
the cell should become empty.boolean hasCalculation()
true
when the cell contains a calculationFormatNumber getFormatNumber()
null
for the default format.void setFormatNumber(FormatNumber format)
format
- The format for values in this cell. Returns null
for the default format.java.lang.String getText()
This will return the same value as getExpr().getName()
if there is an expression.
If their is no expression, the text stored in this cell is returned, for example, "Sum:"
.
String
representationvoid setText(java.lang.String text)
After calling this method, getExpr()
and getNestedExpr()
always return null
.
text
- The text to be show in this cell, or null
to display and empty cell.CellContentType getContentType()
TableCell
object's content type.
Possible types are:
CellContentType
objectCellContentType
void setContentType(CellContentType t)
TableCell
object's type.
CellContentType
- CellContentType
boolean isCustomFormula()
true
if this TableCell
contains a custom formula.
A formula is custom when it has been set in a TableCell using TableCell.setExpr(ReportExpression)
.
Whether a formula is custom or not does not depend on the
formula itself, but also on its position in a block.
If, at the place in which the block is positioned, the formula is not standard,
it is a custom formula. For example, in a vertical table, a header cell with
the formula =NameOf([Country])
will be a custom formula if the
body cell in the same column is not =[Country]
.
true
if the expression in this cell is a custom
formula, for this particular cell
ReportException
- Thrown when this cell has been removed from the table.ReportCell.isCustomFormula()
,
GraphAxisProperties.isCustomFormula(int)
int getColSpan()
void setColSpan(int span)
When the column span is increased, it erases the cells to its right in the table. The number of cells erased is the amount necessary to compensate for the increased column span.
A column can only be increased to span the current cell matrix; setting a
span to a number greater than the number of cells in this cell matrix
will result in an IllegalArgumentException
.
Once the column span for a cell is increased, for all matrix positions
that are covered by that cell, CellMatrix.getCell(int, int)
will
return the same cell. See TableCell.getRow()
for more information.
If the increased span overlaps other spanning cells, those cells will be split into separate cells. That is to say, they will be given a row span and a column span of 1.
span
- The number of columns this cell should span.
java.lang.IllegalArgumentException
- When span < 1
or
getColumn() + span > getCellMatrix().getColumnCount()
.int getRowSpan()
void setRowSpan(int span)
When the row span is increased it erases the cells below it in the table. The number of cells erased the amount necessary to compensate for the increased span.
A row can only be increased to span the current cell matrix; setting a
span to include rows that are not in this cell matrix will result in an
IllegalArgumentException
.
Once the row span for a cell is increased, for all matrix positions that
are covered by that cell, CellMatrix.getCell(int, int)
will
return the same cell. See TableCell.getRow()
for more information.
If the increased span overlaps other spanning cells, those cells will be split into separate cells. That is to say, they will be given a row span and a column span of 1.
span
- The number of rows this cell should span.
java.lang.IllegalArgumentException
- When span < 1
or
getColumn() + span > getCellMatrix().getColumnCount()
.int getRow()
Note: for a given row, myRow
, and column,
myColumn
, the result from
myCellMatrix.getCell(myRow, myColumn).getRow()
may be
different to myRow
. This can occur when the cell at
position (myRow, myColumn)
has a row span greater than 1. This is
demonstrated in the following code:
TableCell myCell = myCellMatrix.getCell(0, 0);
myCell.setRowSpan(2);
//Get the cell at row 1:
TableCell myCell2 = myCellMatrix.getCell(1, 0);
//Note: myCell == myCell2 because of the row span of myCell
//also: myCell.getRow() == myCell2.getRow() == 0
One typical use of this method is a loop to act on cells in a matrix:
using the algorithm below, we are certain that each cell is processed
only once, even in the case where cells span several rows and/or columns.
final int rows = myCellMatrix.getRowCount();
final int columns = myCellMatrix.getColumnCount();
int colspan = 1;
for (int row = 0; row < rows; ++row) {
for (int column = 0; column < columns; column += colspan) {
TableCell cell = myCellMatrix.getCell(row, column);
colspan = cell.getColSpan();
if (cell.getRow() == row) {
// do something with cell
}
}
}
int getColumn()
TableCell.getRow()
void setRowAutoFitHeight(boolean b)
autoFitHeight
property to
b
for all table cells in the same row in the table.
Because this method scans the entire table, cells in other matrices can
be impacted too.
If any of the impacted cells has
, that cell's autofit will be
changed only if it ends in the same table row as this cell.
TableCell.getRowSpan()
> 1
For example, given a table with the following structure:
+-----+-----+-----+ | A | B | C | +-----+ +-----+ | D | | E | +-----+-----+ | | F | G | | +-----+-----+-----+When called on cell A, cells A and C will be updated. When called on cell B, cells B and D will be updated. Likewise, cells E, F and G will always be updated together.
b
- When true
, all cells ending in the same row in
the table will have their height depend on their contents.
When false
, all cells ending in this row will
have fixed height.void setColumnAutoFitWidth(boolean b)
autoFitWidth
property on all
cells in this table that end in the same column.
b
- When true
, all cells ending in the same column
in the table will have their width depend on their contents.
When false
, all cells ending in this column
will have fixed width.TableCell.setRowAutoFitHeight(boolean)
double estimateMinimalHeight()
unit
,
for this cell. This height can later be applied using
TableCell.setHeight(double)
.
This method will check all table cells ending in the same row, so that the height of tose cells would at least allow one line of text in the current font size to fit.
For example, given a table with the following structure:
+-----+-----+-----+ | A | B | C | +-----+ +-----+ | D | | E | +-----+-----+ | | F | G | | +-----+-----+-----+When called on cell A, the contents of cells A and C will be taken into account, but the height of cell B will also be impacted if the returned minimal height is applied to cell A.
double minHeightA = cellA.estimateMinimalHeight(); // Cells A and C are checked for the above calculation. // If cellA.getHeight() > minHeightA, the next line will decrease // B's height too. cellA.setHeight(minHeightA); // If B's font size is very big in comparison to A and C, it could // now happen that cellB.getHeight() < cellB.estimateMinimalHeight().When called on cell B, cells B and D will be taken into account, but E's height will also be impacted if the returned height is applied to B. Likewise, cells E, F and G will always be checked together.
A typical use of this method is to implement some standard behavior for applying auto fit height to a row of cells.
private void onDoubleClick(MyEvent e) { if (e.isBottomOfCell()) { TableCell cell = e.getCell(); cell.setRowAutoFitHeight(true); // apply some minimal height cell.setHeight(cell.estimateMinimalHeight()); } }Calling this method is particularly useful when an entire row contains empty cells; this will ensure the empty row will at least have some minimal height.
TableCell.setRowAutoFitHeight(boolean)
,
TableCell.getVerticalPadding()
,
TableCell.getRowSpan()
,
Decoration.getFont()
,
Font.getSize()
,
TableFormBase.getCellSpacing()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |