Class PdfPRow


  • class PdfPRow
    extends java.lang.Object
    A row in a PdfPTable.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static float BOTTOM_LIMIT
      the bottom limit (bottom right y)
      private boolean calculated  
      private int[] canvasesPos  
      private PdfPCell[] cells  
      private float[] extraHeights
      extra heights that needs to be added to a cell because of rowspans.
      private float maxHeight  
      (package private) static float RIGHT_LIMIT
      the right limit
      private float[] widths  
    • Constructor Summary

      Constructors 
      Constructor Description
      PdfPRow​(PdfPCell[] cells)
      Constructs a new PdfPRow with the cells in the array that was passed as a parameter.
      PdfPRow​(PdfPRow row)
      Makes a copy of an existing row.
    • Field Detail

      • BOTTOM_LIMIT

        static final float BOTTOM_LIMIT
        the bottom limit (bottom right y)
        See Also:
        Constant Field Values
      • RIGHT_LIMIT

        static final float RIGHT_LIMIT
        the right limit
        Since:
        2.1.5
        See Also:
        Constant Field Values
      • widths

        private float[] widths
      • extraHeights

        private float[] extraHeights
        extra heights that needs to be added to a cell because of rowspans.
        Since:
        2.1.6
      • maxHeight

        private float maxHeight
      • calculated

        private boolean calculated
      • canvasesPos

        private int[] canvasesPos
    • Constructor Detail

      • PdfPRow

        public PdfPRow​(PdfPCell[] cells)
        Constructs a new PdfPRow with the cells in the array that was passed as a parameter.
        Parameters:
        cells -
      • PdfPRow

        public PdfPRow​(PdfPRow row)
        Makes a copy of an existing row.
        Parameters:
        row -
    • Method Detail

      • setWidths

        public boolean setWidths​(float[] widths)
        Sets the widths of the columns in the row.
        Parameters:
        widths -
        Returns:
        true if everything went right
      • initExtraHeights

        public 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 height
        height - the extra height
        Since:
        2.1.6
      • calculateHeights

        private float calculateHeights()
        Calculates the heights of each cell in the row.
        Returns:
        the maximum height of the row.
      • writeBorderAndBackground

        private 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 canvas
        yPos - The y-coordinate where the table starts on the canvas
        currentMaxHeight - The height of the cell to be drawn.
        cell -
        canvases -
        Since:
        2.1.6 extra parameter currentMaxHeight
      • saveAndRotateCanvases

        private 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

        private void restoreCanvases​(PdfContentByte[] canvases)
        Since:
        2.1.6 private is now protected
      • setColumn

        public static float setColumn​(ColumnText ct,
                                      float left,
                                      float bottom,
                                      float right,
                                      float top)
        Since:
        3.0.0 protected is now public static
      • writeCells

        public void writeCells​(int colStart,
                               int colEnd,
                               float xPos,
                               float yPos,
                               PdfContentByte[] canvases)
        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 canvas
        yPos - The y-coordinate where the table starts on the canvas
      • 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)
      • splitRow

        public PdfPRow splitRow​(PdfPTable table,
                                int rowIndex,
                                float new_height)
        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
      • getCells

        public PdfPCell[] 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