Package com.itextpdf.layout.element
Class Cell
- java.lang.Object
-
- All Implemented Interfaces:
IAbstractElement,IBlockElement,IElement,IPropertyContainer,IAccessibleElement
public class Cell extends BlockElement<Cell>
ACellis 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 otherBlockElementobjects or images. Other types of layout elements must be wrapped in aBlockElement.
-
-
Field Summary
Fields Modifier and Type Field Description private intcolprivate intcolspanprivate static BorderDEFAULT_BORDERprivate introwprivate introwspanprotected DefaultAccessibilityPropertiestagProperties-
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 Celladd(IBlockElement element)Adds any block element to the cell's contents.Celladd(Image element)Adds an image to the cell's contents.Cellclone(boolean includeContent)Clones a cell with its position, properties, and optionally its contents.AccessibilityPropertiesgetAccessibilityProperties()Gets theaccessibility properties.intgetCol()Getsthe number of the columnin which the cell is located.intgetColspan()Gets thecolspanof the cell.<T1> T1getDefaultProperty(int property)Gets the default property from this entity.IRenderergetRenderer()Gets a cell renderer for this element.intgetRow()Getsthe number of the rowin which the cell is located.intgetRowspan()Gets therowspanof the cell.protected IRenderermakeNewRenderer()Creates a new renderer instance.java.lang.StringtoString()protected CellupdateCellIndexes(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, getTransparentStrokeColor, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, 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:
getRendererin interfaceIElement- Overrides:
getRendererin classAbstractElement<Cell>- Returns:
- a cell renderer for this element
-
getRow
public int getRow()
Getsthe number of the rowin which the cell is located.- Returns:
- the row number
-
getCol
public int getCol()
Getsthe number of the columnin which the cell is located.- Returns:
- the column number
-
getRowspan
public int getRowspan()
Gets therowspanof the cell.- Returns:
- the rowspan
-
getColspan
public int getColspan()
Gets thecolspanof 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:IPropertyContainerGets the default property from this entity.- Specified by:
getDefaultPropertyin interfaceIPropertyContainer- Overrides:
getDefaultPropertyin 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,
nullwill be returned
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getAccessibilityProperties
public AccessibilityProperties getAccessibilityProperties()
Description copied from interface:IAccessibleElementGets 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:AbstractElementCreates a new renderer instance.- Specified by:
makeNewRendererin classAbstractElement<Cell>- Returns:
- new
IRenderer
-
-