com.lowagie.text.rtf.table

Class RtfCell

public class RtfCell extends Cell implements RtfExtendedElement

The RtfCell wraps a Cell, but can also be added directly to a Table. The RtfCell is an extension of Cell, that supports a multitude of different borderstyles.

Version: $Id: RtfCell.java 2796 2007-05-27 09:42:20Z psoares33 $

Author: Mark Hall (mhall@edu.uni-klu.ac.at) Steffen Stundzig Benoit Wiart Thomas Bickel (tmb99@inode.at)

See Also: RtfBorder

Field Summary
RtfColorbackgroundColor
The background color of this RtfCell
RtfBorderGroupborders
The borders of this RtfCell
intcellPadding
The padding of this RtfCell
intcellRight
The right margin of this RtfCell
intcellWidth
The width of this RtfCell
ArrayListcontent
The content of this RtfCell
booleandeleted
Whether this RtfCell is a placeholder for a removed table cell.
RtfDocumentdocument
The RtfDocument this RtfCell belongs to
booleaninHeader
Whether this RtfCell is in a header
intmergeType
The merge type of this RtfCell
static intMERGE_NONE
This cell is not merged
static intMERGE_VERT_CHILD
This cell is a child cell of a vertical merge operation
static intMERGE_VERT_PARENT
This cell is the parent cell of a vertical merge operation
RtfRowparentRow
The parent RtfRow of this RtfCell
Constructor Summary
RtfCell()
Constructs an empty RtfCell
RtfCell(String content)
Constructs a RtfCell based upon a String
RtfCell(Element element)
Constructs a RtfCell based upon an Element
RtfCell(Properties properties)
Constructs a RtfCell based upon certain Properties
protected RtfCell(boolean deleted)
Constructs a deleted RtfCell.
protected RtfCell(RtfDocument doc, RtfRow row, Cell cell)
Constructs a RtfCell based on a Cell.
Method Summary
protected RtfBorderGroupgetBorders()
Gets the borders of this RtfCell
protected intgetCellpadding()
Gets the cell padding of this RtfCell
protected intgetCellRight()
Gets the right margin of this RtfCell
protected intgetCellWidth()
Gets the cell width of this RtfCell
protected RtfColorgetRtfBackgroundColor()
Get the background color of this RtfCell
voidimportCell(Cell cell)
Imports the Cell properties into the RtfCell
byte[]intToByteArray(int i)
Transforms an integer into its String representation and then returns the bytes of that string.
booleanisDeleted()
Checks whether this RtfCell is a placeholder for a table cell that has been removed due to col/row spanning.
voidsetBorders(RtfBorderGroup borderGroup)
Set the borders of this RtfCell
protected voidsetCellMergeChild(RtfCell mergeParent)
Merge this cell into the parent cell.
protected voidsetCellRight(int cellRight)
Sets the right margin of this cell.
protected voidsetCellWidth(int cellWidth)
Sets the cell width of this RtfCell.
voidsetInHeader(boolean inHeader)
Sets whether this RtfCell is in a header
voidsetInTable(boolean inTable)
Unused
voidsetRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfCell belongs to
byte[]write()
Write the content of this RtfCell
voidwriteContent(OutputStream result)
Write the content of this RtfCell
byte[]writeDefinition()
Write the cell definition part of this RtfCell
voidwriteDefinition(OutputStream result)
Write the cell definition part of this RtfCell

Field Detail

backgroundColor

private RtfColor backgroundColor
The background color of this RtfCell

borders

private RtfBorderGroup borders
The borders of this RtfCell

cellPadding

private int cellPadding
The padding of this RtfCell

cellRight

private int cellRight
The right margin of this RtfCell

cellWidth

private int cellWidth
The width of this RtfCell

content

private ArrayList content
The content of this RtfCell

deleted

private boolean deleted
Whether this RtfCell is a placeholder for a removed table cell.

document

private RtfDocument document
The RtfDocument this RtfCell belongs to

inHeader

private boolean inHeader
Whether this RtfCell is in a header

mergeType

private int mergeType
The merge type of this RtfCell

MERGE_NONE

private static final int MERGE_NONE
This cell is not merged

MERGE_VERT_CHILD

private static final int MERGE_VERT_CHILD
This cell is a child cell of a vertical merge operation

MERGE_VERT_PARENT

private static final int MERGE_VERT_PARENT
This cell is the parent cell of a vertical merge operation

parentRow

private RtfRow parentRow
The parent RtfRow of this RtfCell

Constructor Detail

RtfCell

public RtfCell()
Constructs an empty RtfCell

RtfCell

public RtfCell(String content)
Constructs a RtfCell based upon a String

Parameters: content The String to base the RtfCell on

RtfCell

public RtfCell(Element element)
Constructs a RtfCell based upon an Element

Parameters: element The Element to base the RtfCell on

Throws: BadElementException If the Element is not valid

RtfCell

public RtfCell(Properties properties)
Constructs a RtfCell based upon certain Properties

Parameters: properties The Properties for this RtfCell

RtfCell

protected RtfCell(boolean deleted)
Constructs a deleted RtfCell.

Parameters: deleted Whether this RtfCell is actually deleted.

RtfCell

protected RtfCell(RtfDocument doc, RtfRow row, Cell cell)
Constructs a RtfCell based on a Cell.

Parameters: doc The RtfDocument this RtfCell belongs to row The RtfRow this RtfCell lies in cell The Cell to base this RtfCell on

Method Detail

getBorders

protected RtfBorderGroup getBorders()
Gets the borders of this RtfCell

Returns: The borders of this RtfCell

getCellpadding

protected int getCellpadding()
Gets the cell padding of this RtfCell

Returns: The cell padding of this RtfCell

getCellRight

protected int getCellRight()
Gets the right margin of this RtfCell

Returns: The right margin of this RtfCell.

getCellWidth

protected int getCellWidth()
Gets the cell width of this RtfCell

Returns: The cell width of this RtfCell

getRtfBackgroundColor

protected RtfColor getRtfBackgroundColor()
Get the background color of this RtfCell

Returns: The background color of this RtfCell

importCell

private void importCell(Cell cell)
Imports the Cell properties into the RtfCell

Parameters: cell The Cell to import

intToByteArray

private byte[] intToByteArray(int i)
Transforms an integer into its String representation and then returns the bytes of that string.

Parameters: i The integer to convert

Returns: A byte array representing the integer

isDeleted

public boolean isDeleted()
Checks whether this RtfCell is a placeholder for a table cell that has been removed due to col/row spanning.

Returns: True if this RtfCell is deleted, false otherwise.

setBorders

public void setBorders(RtfBorderGroup borderGroup)
Set the borders of this RtfCell

Parameters: borderGroup The RtfBorderGroup to use as borders

setCellMergeChild

protected void setCellMergeChild(RtfCell mergeParent)
Merge this cell into the parent cell.

Parameters: mergeParent The RtfCell to merge with

setCellRight

protected void setCellRight(int cellRight)
Sets the right margin of this cell. Used in merge operations

Parameters: cellRight The right margin to use

setCellWidth

protected void setCellWidth(int cellWidth)
Sets the cell width of this RtfCell. Used in merge operations.

Parameters: cellWidth The cell width to use

setInHeader

public void setInHeader(boolean inHeader)
Sets whether this RtfCell is in a header

Parameters: inHeader True if this RtfCell is in a header, false otherwise

setInTable

public void setInTable(boolean inTable)
Unused

Parameters: inTable

setRtfDocument

public void setRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfCell belongs to

Parameters: doc The RtfDocument to use

write

public byte[] write()

Deprecated: replaced by writeContent

Write the content of this RtfCell

Returns: A byte array with the content of this RtfCell

writeContent

public void writeContent(OutputStream result)
Write the content of this RtfCell

writeDefinition

public byte[] writeDefinition()

Deprecated: replaced by writeDefinition

Write the cell definition part of this RtfCell

Returns: A byte array with the cell definition

writeDefinition

public void writeDefinition(OutputStream result)
Write the cell definition part of this RtfCell