Package com.aowagie.text
Class SimpleCell
- java.lang.Object
-
- com.aowagie.text.Rectangle
-
- com.aowagie.text.SimpleCell
-
- All Implemented Interfaces:
Element
,PdfPCellEvent
,TextElementArray
class SimpleCell extends Rectangle implements PdfPCellEvent, TextElementArray
Rectangle that can be used for Cells. This Rectangle is padded and knows how to draw itself in a PdfPTable or PdfPcellEvent.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static boolean
CELL
the CellAttributes object represents a cell.private boolean
cellgroup
indicates if these are the attributes of a single Cell (false) or a group of Cells (true).private int
colspan
the colspan of a Cellprivate java.util.ArrayList
content
the content of the Cell.private int
horizontalAlignment
horizontal alignment inside the Cell.private float
padding_bottom
an extra padding variableprivate float
padding_left
an extra padding variableprivate float
padding_right
an extra padding variableprivate float
padding_top
an extra padding variableprivate float
spacing_bottom
an extra spacing variableprivate float
spacing_left
an extra spacing variableprivate float
spacing_right
an extra spacing variableprivate float
spacing_top
an extra spacing variableprivate boolean
useAscender
Indicates that the largest ascender height should be used to determine the height of the first line.private boolean
useBorderPadding
Adjusts the cell contents to compensate for border widths.private boolean
useDescender
Indicates that the largest descender height should be added to the height of the last line (so characters like y don't dip into the border).private int
verticalAlignment
vertical alignment inside the Cell.private float
width
the width of the Cell.private float
widthpercentage
the widthpercentage of the Cell.-
Fields inherited from class com.aowagie.text.Rectangle
border, borderWidth, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury
-
Fields inherited from interface com.aowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
-
Constructor Summary
Constructors Constructor Description SimpleCell(boolean row)
A CellAttributes object is always constructed without any dimensions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(java.lang.Object o)
Adds an object to theTextElementArray
.private void
addElement(Element element)
Adds content to this object.void
cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases)
This method is called at the end of the cell rendering.PdfPCell
createPdfPCell(SimpleCell rowAttributes)
Creates a PdfPCell with these attributes.int
getColspan()
(package private) java.util.ArrayList
getContent()
int
getHorizontalAlignment()
float
getPadding_bottom()
float
getPadding_left()
float
getPadding_right()
float
getPadding_top()
float
getSpacing_bottom()
float
getSpacing_left()
float
getSpacing_right()
float
getSpacing_top()
int
getVerticalAlignment()
float
getWidth()
Returns the width of the rectangle.float
getWidthpercentage()
boolean
isCellgroup()
boolean
isUseAscender()
boolean
isUseBorderPadding()
boolean
isUseDescender()
void
setCellgroup(boolean cellgroup)
void
setColspan(int colspan)
void
setHorizontalAlignment(int horizontalAlignment)
void
setPadding(float padding)
Sets the padding parameters if they are undefined.void
setPadding_bottom(float padding_bottom)
void
setPadding_left(float padding_left)
void
setPadding_right(float padding_right)
void
setPadding_top(float padding_top)
void
setSpacing(float spacing)
void
setSpacing_bottom(float spacing)
void
setSpacing_left(float spacing)
void
setSpacing_right(float spacing)
void
setSpacing_top(float spacing)
void
setUseAscender(boolean useAscender)
void
setUseBorderPadding(boolean useBorderPadding)
void
setUseDescender(boolean useDescender)
void
setVerticalAlignment(int verticalAlignment)
void
setWidth(float width)
void
setWidthpercentage(float widthpercentage)
int
type()
Gets the type of the text element.-
Methods inherited from class com.aowagie.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRight, getRight, getRotation, getTop, getTop, hasBorder, hasBorders, isContent, isNestable, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString
-
-
-
-
Field Detail
-
CELL
static final boolean CELL
the CellAttributes object represents a cell.- See Also:
- Constant Field Values
-
content
private final java.util.ArrayList content
the content of the Cell.
-
width
private float width
the width of the Cell.
-
widthpercentage
private float widthpercentage
the widthpercentage of the Cell.
-
spacing_left
private float spacing_left
an extra spacing variable
-
spacing_right
private float spacing_right
an extra spacing variable
-
spacing_top
private float spacing_top
an extra spacing variable
-
spacing_bottom
private float spacing_bottom
an extra spacing variable
-
padding_left
private float padding_left
an extra padding variable
-
padding_right
private float padding_right
an extra padding variable
-
padding_top
private float padding_top
an extra padding variable
-
padding_bottom
private float padding_bottom
an extra padding variable
-
colspan
private int colspan
the colspan of a Cell
-
horizontalAlignment
private int horizontalAlignment
horizontal alignment inside the Cell.
-
verticalAlignment
private int verticalAlignment
vertical alignment inside the Cell.
-
cellgroup
private boolean cellgroup
indicates if these are the attributes of a single Cell (false) or a group of Cells (true).
-
useAscender
private boolean useAscender
Indicates that the largest ascender height should be used to determine the height of the first line. Note that this only has an effect when rendered to PDF. Setting this to true can help with vertical alignment problems.
-
useDescender
private boolean useDescender
Indicates that the largest descender height should be added to the height of the last line (so characters like y don't dip into the border). Note that this only has an effect when rendered to PDF.
-
useBorderPadding
private boolean useBorderPadding
Adjusts the cell contents to compensate for border widths. Note that this only has an effect when rendered to PDF.
-
-
Method Detail
-
addElement
private void addElement(Element element) throws BadElementException
Adds content to this object.- Parameters:
element
- Element- Throws:
BadElementException
- on error
-
createPdfPCell
public PdfPCell createPdfPCell(SimpleCell rowAttributes)
Creates a PdfPCell with these attributes.- Parameters:
rowAttributes
-- Returns:
- a PdfPCell based on these attributes.
-
cellLayout
public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases)
Description copied from interface:PdfPCellEvent
This method is called at the end of the cell rendering. The text or graphics are added to one of the 4PdfContentByte
contained incanvases
.
The indexes tocanvases
are:PdfPTable.BASECANVAS
- the originalPdfContentByte
. Anything placed here will be under the cell.PdfPTable.BACKGROUNDCANVAS
- the layer where the background goes to.PdfPTable.LINECANVAS
- the layer where the lines go to.PdfPTable.TEXTCANVAS
- the layer where the text go to. Anything placed here will be over the cell.
- Specified by:
cellLayout
in interfacePdfPCellEvent
- Parameters:
cell
- the cellposition
- the coordinates of the cellcanvases
- an array ofPdfContentByte
- See Also:
PdfPCellEvent.cellLayout(com.aowagie.text.pdf.PdfPCell, com.aowagie.text.Rectangle, com.aowagie.text.pdf.PdfContentByte[])
-
setPadding
public void setPadding(float padding)
Sets the padding parameters if they are undefined.- Parameters:
padding
-
-
getColspan
public int getColspan()
- Returns:
- Returns the colspan.
-
setColspan
public void setColspan(int colspan)
- Parameters:
colspan
- The colspan to set.
-
getPadding_bottom
public float getPadding_bottom()
- Returns:
- Returns the padding_bottom.
-
setPadding_bottom
public void setPadding_bottom(float padding_bottom)
- Parameters:
padding_bottom
- The padding_bottom to set.
-
getPadding_left
public float getPadding_left()
- Returns:
- Returns the padding_left.
-
setPadding_left
public void setPadding_left(float padding_left)
- Parameters:
padding_left
- The padding_left to set.
-
getPadding_right
public float getPadding_right()
- Returns:
- Returns the padding_right.
-
setPadding_right
public void setPadding_right(float padding_right)
- Parameters:
padding_right
- The padding_right to set.
-
getPadding_top
public float getPadding_top()
- Returns:
- Returns the padding_top.
-
setPadding_top
public void setPadding_top(float padding_top)
- Parameters:
padding_top
- The padding_top to set.
-
getSpacing_left
public float getSpacing_left()
- Returns:
- Returns the spacing.
-
getSpacing_right
public float getSpacing_right()
- Returns:
- Returns the spacing.
-
getSpacing_top
public float getSpacing_top()
- Returns:
- Returns the spacing.
-
getSpacing_bottom
public float getSpacing_bottom()
- Returns:
- Returns the spacing.
-
setSpacing
public void setSpacing(float spacing)
- Parameters:
spacing
- The spacing to set.
-
setSpacing_left
public void setSpacing_left(float spacing)
- Parameters:
spacing
- The spacing to set.
-
setSpacing_right
public void setSpacing_right(float spacing)
- Parameters:
spacing
- The spacing to set.
-
setSpacing_top
public void setSpacing_top(float spacing)
- Parameters:
spacing
- The spacing to set.
-
setSpacing_bottom
public void setSpacing_bottom(float spacing)
- Parameters:
spacing
- The spacing to set.
-
isCellgroup
public boolean isCellgroup()
- Returns:
- Returns the cellgroup.
-
setCellgroup
public void setCellgroup(boolean cellgroup)
- Parameters:
cellgroup
- The cellgroup to set.
-
getHorizontalAlignment
public int getHorizontalAlignment()
- Returns:
- Returns the horizontal alignment.
-
setHorizontalAlignment
public void setHorizontalAlignment(int horizontalAlignment)
- Parameters:
horizontalAlignment
- The horizontalAlignment to set.
-
getVerticalAlignment
public int getVerticalAlignment()
- Returns:
- Returns the vertical alignment.
-
setVerticalAlignment
public void setVerticalAlignment(int verticalAlignment)
- Parameters:
verticalAlignment
- The verticalAligment to set.
-
getWidth
public float getWidth()
Description copied from class:Rectangle
Returns the width of the rectangle.
-
setWidth
public void setWidth(float width)
- Parameters:
width
- The width to set.
-
getWidthpercentage
public float getWidthpercentage()
- Returns:
- Returns the widthpercentage.
-
setWidthpercentage
public void setWidthpercentage(float widthpercentage)
- Parameters:
widthpercentage
- The widthpercentage to set.
-
isUseAscender
public boolean isUseAscender()
- Returns:
- Returns the useAscender.
-
setUseAscender
public void setUseAscender(boolean useAscender)
- Parameters:
useAscender
- The useAscender to set.
-
isUseBorderPadding
public boolean isUseBorderPadding()
- Returns:
- Returns the useBorderPadding.
-
setUseBorderPadding
public void setUseBorderPadding(boolean useBorderPadding)
- Parameters:
useBorderPadding
- The useBorderPadding to set.
-
isUseDescender
public boolean isUseDescender()
- Returns:
- Returns the useDescender.
-
setUseDescender
public void setUseDescender(boolean useDescender)
- Parameters:
useDescender
- The useDescender to set.
-
getContent
java.util.ArrayList getContent()
- Returns:
- Returns the content.
-
add
public boolean add(java.lang.Object o)
Description copied from interface:TextElementArray
Adds an object to theTextElementArray
.- Specified by:
add
in interfaceTextElementArray
- Parameters:
o
- an object that has to be added- Returns:
true
if the addition succeeded;false
otherwise- See Also:
TextElementArray.add(java.lang.Object)
-
-