Package com.itextpdf.text.pdf
Class PdfPRow
java.lang.Object
com.itextpdf.text.pdf.PdfPRow
- All Implemented Interfaces:
IAccessibleElement
A row in a PdfPTable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanstatic final floatthe bottom limit (bottom right y)protected booleanprivate int[]protected PdfPCell[]protected float[]extra heights that needs to be added to a cell because of rowspans.protected AccessibleElementIdprivate final Loggerprotected floatbooleanTrue if the table may not break after this row.static final floatthe right limitprotected PdfNameprotected float[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalculates the heights of each cell in the row.voidcopyRowContent(PdfPTable table, int idx) Copies the content of a specific row in a table to this row.Get the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).Gets all the properties of accessible element.PdfPCell[]getCells()Returns the array of cells in the row.(package private) float[]getEventWidth(float xPos, float[] absoluteWidths) getId()floatGets the maximum height of the row (i.e.floatgetRole()Gets the role of the accessible element.booleanChecks if a cell in the row has a rowspan greater than 1.protected voidInitializes the extra heights array.booleanbooleanChecks if the dimensions of the columns were calculated.booleanisInline()booleanGetter for the mayNotbreak variable.private static booleanisTagged(PdfContentByte canvas) protected voidrestoreCanvases(PdfContentByte[] canvases) protected voidsaveAndRotateCanvases(PdfContentByte[] canvases, float a, float b, float c, float d, float e, float f) voidsetAccessibleAttribute(PdfName key, PdfObject value) Set the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).voidsetAdjusted(boolean adjusted) static floatsetColumn(ColumnText ct, float left, float bottom, float right, float top) voidsetExtraHeight(int cell, float height) Sets an extra height for a cell.voidsetFinalMaxHeights(float maxHeight) voidvoidsetMaxHeights(float maxHeight) Changes the maximum height of the row (to make it higher).voidsetMayNotBreak(boolean mayNotBreak) Setter for the mayNotBreak variable.voidSets the role of the accessiblee element.booleansetWidths(float[] widths) Sets the widths of the columns in the row.Splits a row to newHeight.voidsplitRowspans(PdfPTable original, int originalIdx, PdfPTable part, int partIdx) Split rowspan of cells with rowspan on next page by inserting copies with the remaining rowspan and reducing the previous rowspan appropriately, i.e.voidwriteBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) Writes the border and background of one cell in the row.voidwriteCells(int colStart, int colEnd, float xPos, float yPos, PdfContentByte[] canvases, boolean reusable) Writes a number of cells (not necessarily all cells).
-
Field Details
-
LOGGER
-
mayNotBreak
public boolean mayNotBreakTrue if the table may not break after this row. -
BOTTOM_LIMIT
public static final float BOTTOM_LIMITthe bottom limit (bottom right y)- See Also:
-
RIGHT_LIMIT
public static final float RIGHT_LIMITthe right limit- Since:
- 2.1.5
- See Also:
-
cells
-
widths
protected float[] widths -
extraHeights
protected float[] extraHeightsextra heights that needs to be added to a cell because of rowspans.- Since:
- 2.1.6
-
maxHeight
protected float maxHeight -
calculated
protected boolean calculated -
adjusted
protected boolean adjusted -
canvasesPos
private int[] canvasesPos -
role
-
accessibleAttributes
-
id
-
-
Constructor Details
-
PdfPRow
Constructs a new PdfPRow with the cells in the array that was passed as a parameter.- Parameters:
cells-
-
PdfPRow
-
PdfPRow
Makes a copy of an existing row.- Parameters:
row-
-
-
Method Details
-
setWidths
public boolean setWidths(float[] widths) Sets the widths of the columns in the row.- Parameters:
widths-- Returns:
- true if everything went right
-
initExtraHeights
protected void initExtraHeights()Initializes the extra heights array.- Since:
- 2.1.6
-
setExtraHeight
public void setExtraHeight(int cell, float height) Sets an extra height for a cell.- Parameters:
cell- the index of the cell that needs an extra heightheight- the extra height- Since:
- 2.1.6
-
calculateHeights
protected void calculateHeights()Calculates the heights of each cell in the row. -
setMayNotBreak
public void setMayNotBreak(boolean mayNotBreak) Setter for the mayNotBreak variable. -
isMayNotBreak
public boolean isMayNotBreak()Getter for the mayNotbreak variable. -
writeBorderAndBackground
public void writeBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) Writes the border and background of one cell in the row.- Parameters:
xPos- The x-coordinate where the table starts on the canvasyPos- The y-coordinate where the table starts on the canvascurrentMaxHeight- The height of the cell to be drawn.cell-canvases-- Since:
- 2.1.6 extra parameter currentMaxHeight
-
saveAndRotateCanvases
protected void saveAndRotateCanvases(PdfContentByte[] canvases, float a, float b, float c, float d, float e, float f) - Since:
- 2.1.6 private is now protected
-
restoreCanvases
- Since:
- 2.1.6 private is now protected
-
setColumn
- Since:
- 3.0.0 protected is now public static
-
writeCells
public void writeCells(int colStart, int colEnd, float xPos, float yPos, PdfContentByte[] canvases, boolean reusable) Writes a number of cells (not necessarily all cells).- Parameters:
colStart- The first column to be written. Remember that the column index starts with 0.colEnd- The last column to be written. Remember that the column index starts with 0. If -1, all the columns to the end are written.xPos- The x-coordinate where the table starts on the canvasyPos- The y-coordinate where the table starts on the canvasreusable- if set to false, the content in the cells is "consumed"; if true, you can reuse the cells, the row, the parent table as many times you want.- Since:
- 5.1.0 added the reusable parameter
-
isCalculated
public boolean isCalculated()Checks if the dimensions of the columns were calculated.- Returns:
- true if the dimensions of the columns were calculated
-
getMaxHeights
public float getMaxHeights()Gets the maximum height of the row (i.e. of the 'highest' cell).- Returns:
- the maximum height of the row
-
setMaxHeights
public void setMaxHeights(float maxHeight) Changes the maximum height of the row (to make it higher). (added by Jin-Hsia Yang)- Parameters:
maxHeight- the new maximum height
-
getEventWidth
float[] getEventWidth(float xPos, float[] absoluteWidths) -
copyRowContent
Copies the content of a specific row in a table to this row. Don't do this if the rows have a different number of cells.- Parameters:
table- the table from which you want to copy a rowidx- the index of the row that needs to be copied- Since:
- 5.1.0
-
splitRow
Splits a row to newHeight. The returned row is the remainder. It will return null if the newHeight was so small that only an empty row would result.- Parameters:
new_height- the new height- Returns:
- the remainder row or null if the newHeight was so small that only an empty row would result
-
getMaxRowHeightsWithoutCalculating
public float getMaxRowHeightsWithoutCalculating() -
setFinalMaxHeights
public void setFinalMaxHeights(float maxHeight) -
splitRowspans
Split rowspan of cells with rowspan on next page by inserting copies with the remaining rowspan and reducing the previous rowspan appropriately, i.e. if a cell with rowspan 7 gets split after 3 rows of that rowspan have been laid out, its column on the next page should start with an empty cell having the same attributes and rowspan 7 - 3 = 4.- Since:
- iText 5.4.3
-
getCells
Returns the array of cells in the row. Please be extremely careful with this method. Use the cells as read only objects.- Returns:
- an array of cells
- Since:
- 2.1.1
-
hasRowspan
public boolean hasRowspan()Checks if a cell in the row has a rowspan greater than 1.- Since:
- 5.1.0
-
isAdjusted
public boolean isAdjusted() -
setAdjusted
public void setAdjusted(boolean adjusted) -
getAccessibleAttribute
Description copied from interface:IAccessibleElementGet the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).- Specified by:
getAccessibleAttributein interfaceIAccessibleElement- Parameters:
key-- Returns:
-
setAccessibleAttribute
Description copied from interface:IAccessibleElementSet the attribute of accessible element (everything inAdictionary +Lang,Alt,ActualText,E).- Specified by:
setAccessibleAttributein interfaceIAccessibleElement- Parameters:
key-value-
-
getAccessibleAttributes
Description copied from interface:IAccessibleElementGets all the properties of accessible element.- Specified by:
getAccessibleAttributesin interfaceIAccessibleElement- Returns:
-
getRole
Description copied from interface:IAccessibleElementGets the role of the accessible element.- Specified by:
getRolein interfaceIAccessibleElement- Returns:
-
setRole
Description copied from interface:IAccessibleElementSets the role of the accessiblee element. Set role tonullif you don't want to tag this element. Note that all child elements won't also be tagged.- Specified by:
setRolein interfaceIAccessibleElement- Parameters:
role-
-
getId
- Specified by:
getIdin interfaceIAccessibleElement
-
setId
- Specified by:
setIdin interfaceIAccessibleElement
-
isTagged
-
isInline
public boolean isInline()- Specified by:
isInlinein interfaceIAccessibleElement
-