Package com.lowagie.text
Class SimpleCell
java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.text.SimpleCell
- All Implemented Interfaces:
Element,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
FieldsModifier and TypeFieldDescriptionstatic final booleanthe CellAttributes object represents a cell.static final booleanthe CellAttributes object represents a row.protected booleanIndicates that the largest ascender height should be used to determine the height of the first line.protected booleanAdjusts the cell contents to compensate for border widths.protected booleanIndicates 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).Fields inherited from class com.lowagie.text.Rectangle
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBordersFields inherited from interface com.lowagie.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, SECTION, SUBJECT, TABLE, TITLE, YMARK -
Constructor Summary
ConstructorsConstructorDescriptionSimpleCell(boolean row) A CellAttributes object is always constructed without any dimensions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds an object to theTextElementArray.voidaddElement(Element element) Adds content to this object.voidcellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) This method is called at the end of the cell rendering.createCell(SimpleCell rowAttributes) Creates a Cell with these attributes.createPdfPCell(SimpleCell rowAttributes) Creates a PdfPCell with these attributes.intintfloatfloatfloatfloatfloatfloatfloatfloatintfloatgetWidth()Returns the width of the rectangle.floatbooleanbooleanbooleanbooleanvoidsetCellgroup(boolean cellgroup) voidsetColspan(int colspan) voidsetHorizontalAlignment(int horizontalAlignment) voidsetPadding(float padding) Sets the padding parameters if they are undefined.voidsetPadding_bottom(float padding_bottom) voidsetPadding_left(float padding_left) voidsetPadding_right(float padding_right) voidsetPadding_top(float padding_top) voidsetSpacing(float spacing) voidsetSpacing_bottom(float spacing) voidsetSpacing_left(float spacing) voidsetSpacing_right(float spacing) voidsetSpacing_top(float spacing) voidsetUseAscender(boolean useAscender) voidsetUseBorderPadding(boolean useBorderPadding) voidsetUseDescender(boolean useDescender) voidsetVerticalAlignment(int verticalAlignment) voidsetWidth(float width) voidsetWidthpercentage(float widthpercentage) inttype()Gets the type of the text element.Methods inherited from class com.lowagie.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 Details
-
ROW
public static final boolean ROWthe CellAttributes object represents a row.- See Also:
-
CELL
public static final boolean CELLthe CellAttributes object represents a cell.- See Also:
-
useAscender
protected boolean useAscenderIndicates 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
protected boolean useDescenderIndicates 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
protected boolean useBorderPaddingAdjusts the cell contents to compensate for border widths. Note that this only has an effect when rendered to PDF.
-
-
Constructor Details
-
SimpleCell
public SimpleCell(boolean row) A CellAttributes object is always constructed without any dimensions. Dimensions are defined after creation.- Parameters:
row- only true if the CellAttributes object represents a row.
-
-
Method Details
-
addElement
Adds content to this object.- Parameters:
element-- Throws:
BadElementException
-
createCell
Creates a Cell with these attributes.- Parameters:
rowAttributes-- Returns:
- a cell based on these attributes.
- Throws:
BadElementException
-
createPdfPCell
Creates a PdfPCell with these attributes.- Parameters:
rowAttributes-- Returns:
- a PdfPCell based on these attributes.
-
cellLayout
Description copied from interface:PdfPCellEventThis method is called at the end of the cell rendering. The text or graphics are added to one of the 4PdfContentBytecontained incanvases.
The indexes tocanvasesare: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:
cellLayoutin interfacePdfPCellEvent- Parameters:
cell- the cellposition- the coordinates of the cellcanvases- an array ofPdfContentByte- See Also:
-
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:RectangleReturns 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.
-
add
Description copied from interface:TextElementArrayAdds an object to theTextElementArray.- Specified by:
addin interfaceTextElementArray- Parameters:
o- an object that has to be added- Returns:
trueif the addition succeeded;falseotherwise- See Also:
-
type
public int type()Description copied from class:RectangleGets the type of the text element.
-