Package com.itextpdf.layout.element
Class Cell
- java.lang.Object
-
- All Implemented Interfaces:
IAbstractElement
,IBlockElement
,IElement
,IPropertyContainer
,IAccessibleElement
public class Cell extends BlockElement<Cell>
ACell
is one piece of data in an enclosing grid, theTable
. This object is aBlockElement
, giving it a number of visual layout properties. A cell can act as a container for a number of layout elements; it can only contain otherBlockElement
objects or images. Other types of layout elements must be wrapped in aBlockElement
.
-
-
Field Summary
Fields Modifier and Type Field Description private int
col
private int
colspan
private static Border
DEFAULT_BORDER
private int
row
private int
rowspan
protected DefaultAccessibilityProperties
tagProperties
-
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
-
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cell
add(IBlockElement element)
Adds any block element to the cell's contents.Cell
add(Image element)
Adds an image to the cell's contents.Cell
clone(boolean includeContent)
Clones a cell with its position, properties, and optionally its contents.AccessibilityProperties
getAccessibilityProperties()
Gets theaccessibility properties
.int
getCol()
Getsthe number of the column
in which the cell is located.int
getColspan()
Gets thecolspan
of the cell.<T1> T1
getDefaultProperty(int property)
Gets the default property from this entity.IRenderer
getRenderer()
Gets a cell renderer for this element.int
getRow()
Getsthe number of the row
in which the cell is located.int
getRowspan()
Gets therowspan
of the cell.protected IRenderer
makeNewRenderer()
Creates new renderer instance.java.lang.String
toString()
protected Cell
updateCellIndexes(int row, int col, int numberOfColumns)
Updates cell indexes.-
Methods inherited from class com.itextpdf.layout.element.BlockElement
getHeight, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getWidth, isKeepTogether, isKeepWithNext, setHeight, setHeight, setKeepTogether, setKeepWithNext, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMargins, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setNeutralRole, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddings, setPaddingTop, setRotationAngle, setRotationAngle, setSpacingRatio, setVerticalAlignment, setWidth, setWidth
-
Methods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
-
Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.itextpdf.layout.element.IAbstractElement
getChildren
-
Methods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, setNextRenderer
-
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
-
-
-
Field Detail
-
DEFAULT_BORDER
private static final Border DEFAULT_BORDER
-
row
private int row
-
col
private int col
-
rowspan
private int rowspan
-
colspan
private int colspan
-
tagProperties
protected DefaultAccessibilityProperties tagProperties
-
-
Constructor Detail
-
Cell
public Cell(int rowspan, int colspan)
Creates a cell which takes a custom amount of cell spaces in the table.- Parameters:
rowspan
- the number of rows this cell must occupy. Negative numbers will make the argument default to 1.colspan
- the number of columns this cell must occupy. Negative numbers will make the argument default to 1.
-
Cell
public Cell()
Creates a cell.
-
-
Method Detail
-
getRenderer
public IRenderer getRenderer()
Gets a cell renderer for this element. Note that this method can be called more than once. By default each element should define its own renderer, but the renderer can be overridden byAbstractElement.setNextRenderer(IRenderer)
method call.- Specified by:
getRenderer
in interfaceIElement
- Overrides:
getRenderer
in classAbstractElement<Cell>
- Returns:
- a cell renderer for this element
-
getRow
public int getRow()
Getsthe number of the row
in which the cell is located.- Returns:
- the row number
-
getCol
public int getCol()
Getsthe number of the column
in which the cell is located.- Returns:
- the column number
-
getRowspan
public int getRowspan()
Gets therowspan
of the cell.- Returns:
- the rowspan
-
getColspan
public int getColspan()
Gets thecolspan
of the cell.- Returns:
- the colspan
-
add
public Cell add(IBlockElement element)
Adds any block element to the cell's contents.- Parameters:
element
- aBlockElement
- Returns:
- this Element
-
add
public Cell add(Image element)
Adds an image to the cell's contents.- Parameters:
element
- anImage
- Returns:
- this Element
-
clone
public Cell clone(boolean includeContent)
Clones a cell with its position, properties, and optionally its contents.- Parameters:
includeContent
- whether or not to also include the contents of the cell.- Returns:
- a clone of this Element
-
getDefaultProperty
public <T1> T1 getDefaultProperty(int property)
Description copied from interface:IPropertyContainer
Gets the default property from this entity.- Specified by:
getDefaultProperty
in interfaceIPropertyContainer
- Overrides:
getDefaultProperty
in classBlockElement<Cell>
- Type Parameters:
T1
- the return type associated with the property- Parameters:
property
- the property to be retrieved- Returns:
- the default property value. If the default property is not defined,
null
will be returned
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAccessibilityProperties
public AccessibilityProperties getAccessibilityProperties()
Description copied from interface:IAccessibleElement
Gets theaccessibility properties
. See alsoIAccessibleElement
.- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
protected IRenderer makeNewRenderer()
Description copied from class:AbstractElement
Creates new renderer instance.- Specified by:
makeNewRenderer
in classAbstractElement<Cell>
- Returns:
- new
IRenderer
-
-