Package com.storedobject.pdf
Class PDFCell
java.lang.Object
com.storedobject.pdf.PDFRectangle
com.storedobject.pdf.PDFCell
- All Implemented Interfaces:
PDFElement
Represents a "cell" of the
PDFTable. PDFTable has many methods to create "cells" and
that is the preferred way to create PDFCell instances rather than directly using the constructors
of this method.- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.pdf.PDFRectangle
BOTTOM, BOX, LEFT, NO_BORDER, RIGHT, TOP, UNDEFINEDFields inherited from interface com.storedobject.pdf.PDFElement
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, TEXT_DIRECTION_DEFAULT, TEXT_DIRECTION_LTR, TEXT_DIRECTION_NO_BIDI, TEXT_DIRECTION_RTL -
Constructor Summary
ConstructorsConstructorDescriptionPDFCell()Constructor.Construct from another cell.Construct from an image as its content.Construct from an image as its content.Constructor from a phrase as its content.Construct from a table as its content.Construct from a table as its content. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddElement(PDFElement element) Add anPDFElementto this cell.intGet the number of columns the cell spans.floatGet the extra space between paragraphs.floatGet fixed height for the cell.floatGet the following indent.intGet the horizontal alignment.getImage()Get the image contained in this cell.floatGet the indent.floatGet the leading.floatGet the maximum height.floatGet minimum height for the cell.floatGet the variable leading.floatGet the bottom padding of this cell.floatGet the left padding of this cell.floatGet the right padding of this cell.floatGet the top padding of this cell.Get the phrase inside the cell.floatGet the right indent.intGet the number of rows occupied by this cell.intGet the text direction.intGet the vertical alignment.booleanisWrap()Does the content wrap in this cell?voidsetBackgroundImage(PDFImage image) Set a background image in this cell (The cell content will go above this image).voidsetBackgroundImage(PDFImage image, boolean scale) Set a background image in this cell (The cell content will go above this image).voidsetColumnSpan(int numbreOfColumns) Set number of columns to span (by default only 1 column of thePDFTablewill be occupied).voidsetExtraParagraphSpace(float extraParagraphSpace) Set the extra space between paragraphs.voidsetFixedHeight(float height) Set fixed height for the cell.voidsetFollowingIndent(float indent) Set the following indent.voidsetHorizontalAlignment(int alignment) Set horizontal alignmentvoidSet an image as the content of this cell.voidsetIndent(float indent) Set indent.voidsetLeading(float leading) Set the leading to fixed.voidsetLeading(float fixedLeading, float multipliedLeading) Set the leading to fixed and variable part.voidsetMinimumHeight(float height) Set minimum height.voidsetPadding(float padding) Get the padding of this cell.voidsetPaddingBottom(float padding) Set the bottom padding of this cell.voidsetPaddingLeft(float padding) Set padding on the left side.voidsetPaddingRight(float padding) Set padding on the right side.voidsetPaddingTop(float padding) Set padding at the top.voidSet an phrase as the content of this cell.voidsetRightIndent(float indent) Set the right indent.voidsetRowSpan(int rows) Set the number of rows of the table this cell to occupy.voidsetTextDirection(int direction) Set the text direction.voidsetVerticalAlignment(int alignment) Set vertical alignmentvoidsetWrap(boolean wrap) Set the content to wrap.Methods inherited from class com.storedobject.pdf.PDFRectangle
getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getGrayFill, getHeight, getLeft, getRight, getRotation, getTop, getWidth, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setRotation, setTop
-
Constructor Details
-
PDFCell
public PDFCell()Constructor. -
PDFCell
Constructor from a phrase as its content.- Parameters:
phrase- Phrase.
-
PDFCell
-
PDFCell
Construct from an image as its content.- Parameters:
image- Image.autoFit- Whether to auto-fit it within the cell or not.
-
PDFCell
-
PDFCell
-
PDFCell
-
-
Method Details
-
addElement
Add anPDFElementto this cell.- Parameters:
element- Element to add.
-
setMinimumHeight
public void setMinimumHeight(float height) Set minimum height.- Parameters:
height- Height.
-
setColumnSpan
public void setColumnSpan(int numbreOfColumns) Set number of columns to span (by default only 1 column of thePDFTablewill be occupied).- Parameters:
numbreOfColumns- Number of columns.
-
setHorizontalAlignment
public void setHorizontalAlignment(int alignment) Set horizontal alignment. (PDFElement.ALIGN_RIGHTfor example).- Parameters:
alignment- Alignment.
-
setPaddingTop
public void setPaddingTop(float padding) Set padding at the top.- Parameters:
padding- Padding.
-
setVerticalAlignment
public void setVerticalAlignment(int alignment) Set vertical alignment. (PDFElement.ALIGN_BOTTOMfor example).- Parameters:
alignment- Alignment.
-
getImage
Get the image contained in this cell.- Returns:
- Image if exists, otherwise
null.
-
getVerticalAlignment
public int getVerticalAlignment()Get the vertical alignment.- Returns:
- Alignment.
-
setPaddingRight
public void setPaddingRight(float padding) Set padding on the right side.- Parameters:
padding- Padding.
-
setPaddingLeft
public void setPaddingLeft(float padding) Set padding on the left side.- Parameters:
padding- Padding.
-
getColumnSpan
public int getColumnSpan()Get the number of columns the cell spans.- Returns:
- Number of columns.
-
getTextDirection
public int getTextDirection()Get the text direction. (Example:PDFElement.TEXT_DIRECTION_RTL).- Returns:
- Text direction.
-
setTextDirection
public void setTextDirection(int direction) Set the text direction. (Example:PDFElement.TEXT_DIRECTION_RTL).- Parameters:
direction- Text direction.
-
getRowSpan
public int getRowSpan()Get the number of rows occupied by this cell.- Returns:
- Number of rows occupied by this cell.
-
setImage
Set an image as the content of this cell.- Parameters:
image- Image to set.
-
setPhrase
Set an phrase as the content of this cell.- Parameters:
phrase- Phrase to set.
-
getMaxHeight
public float getMaxHeight()Get the maximum height.- Returns:
- Height.
-
getHorizontalAlignment
public int getHorizontalAlignment()Get the horizontal alignment.- Returns:
- Alignment.
-
setPadding
public void setPadding(float padding) Get the padding of this cell.- Parameters:
padding- Padding.
-
setLeading
public void setLeading(float leading) Set the leading to fixed.- Parameters:
leading- Leading.
-
setLeading
public void setLeading(float fixedLeading, float multipliedLeading) Set the leading to fixed and variable part.The resultant leading will be: fixedLeading + multipliedLeading * maxFontSize
where maxFontSize is the size of the biggest font in the line.- Parameters:
fixedLeading- Fixed leading.multipliedLeading- Variable part of the leading.
-
getLeading
public float getLeading()Get the leading.- Returns:
- Leading (fixed part).
-
getMultipliedLeading
public float getMultipliedLeading()Get the variable leading.- Returns:
- Leading (variable part).
-
getExtraParagraphSpace
public float getExtraParagraphSpace()Get the extra space between paragraphs.- Returns:
- The extra space between paragraphs.
-
setExtraParagraphSpace
public void setExtraParagraphSpace(float extraParagraphSpace) Set the extra space between paragraphs.- Parameters:
extraParagraphSpace- The extra space between paragraphs.
-
setIndent
public void setIndent(float indent) Set indent.- Parameters:
indent- Indent to set.
-
getIndent
public float getIndent()Get the indent.- Returns:
- The indent.
-
setFollowingIndent
public void setFollowingIndent(float indent) Set the following indent.- Parameters:
indent- Indent to set.
-
getFollowingIndent
public float getFollowingIndent()Get the following indent.- Returns:
- The indent.
-
setRightIndent
public void setRightIndent(float indent) Set the right indent.- Parameters:
indent- Indent to set.
-
getRightIndent
public float getRightIndent()Get the right indent.- Returns:
- The indent.
-
getPhrase
-
getPaddingLeft
public float getPaddingLeft()Get the left padding of this cell.- Returns:
- Padding.
-
getPaddingRight
public float getPaddingRight()Get the right padding of this cell.- Returns:
- Padding.
-
getPaddingTop
public float getPaddingTop()Get the top padding of this cell.- Returns:
- Padding.
-
getPaddingBottom
public float getPaddingBottom()Get the bottom padding of this cell.- Returns:
- Padding.
-
setPaddingBottom
public void setPaddingBottom(float padding) Set the bottom padding of this cell.- Parameters:
padding- Padding to set.
-
setFixedHeight
public void setFixedHeight(float height) Set fixed height for the cell.- Parameters:
height- Height.
-
getFixedHeight
public float getFixedHeight()Get fixed height for the cell.- Returns:
- Height.
-
getMinimumHeight
public float getMinimumHeight()Get minimum height for the cell.- Returns:
- Height.
-
isWrap
public boolean isWrap()Does the content wrap in this cell?- Returns:
- True/false.
-
setWrap
public void setWrap(boolean wrap) Set the content to wrap.- Parameters:
wrap- True if wrapping to be turned on.
-
setRowSpan
public void setRowSpan(int rows) Set the number of rows of the table this cell to occupy.- Parameters:
rows- Number of rows.
-
setBackgroundImage
Set a background image in this cell (The cell content will go above this image).- Parameters:
image- Background image to set.
-
setBackgroundImage
Set a background image in this cell (The cell content will go above this image).- Parameters:
image- Background image to set.scale- Whether to scale image to the cell size or not. Iffalseis passed, it will make sure that the cell has at least the height of the image.
-