Class Table<T extends org.apache.pdfbox.pdmodel.PDPage>

java.lang.Object
be.quodlibet.boxable.Table<T>
Direct Known Subclasses:
AbstractTemplatedTable, BaseTable

public abstract class Table<T extends org.apache.pdfbox.pdmodel.PDPage> extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final org.apache.pdfbox.pdmodel.PDDocument
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Table(float yStart, float yStartNewPage, float pageTopMargin, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, T currentPage, boolean drawLines, boolean drawContent, PageProvider<T> pageProvider)
     
    Table(float yStartNewPage, float pageTopMargin, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, boolean drawLines, boolean drawContent, PageProvider<T> pageProvider)
     
    Table(float yStart, float yStartNewPage, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, T currentPage, boolean drawLines, boolean drawContent)
    Deprecated.
    Use one of the constructors that pass a PageProvider
    Table(float yStartNewPage, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, boolean drawLines, boolean drawContent)
    Deprecated.
    Use one of the constructors that pass a PageProvider
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Setting current row as table header row
    boolean
     
    protected T
    Deprecated.
    Use a PageProvider instead
    createRow(float height)
     
    createRow(List<Cell<T>> cells, float height)
     
    float
    Draws table
    void
    drawTitle(String title, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize, float tableWidth, float height, String alignment, float freeSpaceForPageBreak, boolean drawHeaderMargin)
     
    void
    drawTitle(String title, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize, float tableWidth, float height, String alignment, float freeSpaceForPageBreak, WrappingFunction wrappingFunction, boolean drawHeaderMargin)
     
    List<org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem>
     
     
    protected org.apache.pdfbox.pdmodel.PDDocument
     
    Retrieves last table's header row
    float
    Calculate height of all table cells (essentially, table height).
    float
     
    float
     
    float
    Calculates minimum table height that needs to be drawn (all header rows + first data row heights).
     
    float
     
    boolean
     
    protected org.apache.pdfbox.pdmodel.font.PDType0Font
    loadFont(String fontPath)
     
    protected abstract void
     
    void
    removeAllBorders(boolean removeAllBorders)
     
    void
    setDrawDebug(boolean drawDebug)
     
    void
    setHeader(Row<T> header)
    Deprecated.
    Use addHeaderRow(Row) instead, as it supports multiple header rows
    void
    setLineSpacing(float lineSpacing)
     
    void
    setTableIsBroken(boolean tableIsBroken)
     
    protected void
    setYStart(float yStart)
     
    boolean
     
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • document

      public final org.apache.pdfbox.pdmodel.PDDocument document
  • Constructor Details

    • Table

      @Deprecated public Table(float yStart, float yStartNewPage, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, T currentPage, boolean drawLines, boolean drawContent) throws IOException
      Deprecated.
      Use one of the constructors that pass a PageProvider
      Parameters:
      yStart - Y position where Table will start
      yStartNewPage - Y position where possible new page of Table will start
      pageBottomMargin - bottom margin of Table
      width - Table width
      margin - Table margin
      document - PDDocument where Table will be drawn
      currentPage - current page where Table will be drawn (some tables are big and can be through multiple pages)
      drawLines - draw Table's borders
      drawContent - draw Table's content
      Throws:
      IOException - if fonts are not loaded correctly
    • Table

      @Deprecated public Table(float yStartNewPage, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, boolean drawLines, boolean drawContent) throws IOException
      Deprecated.
      Use one of the constructors that pass a PageProvider
      Parameters:
      yStartNewPage - Y position where possible new page of Table will start
      pageBottomMargin - bottom margin of Table
      width - Table width
      margin - Table margin
      document - PDDocument where Table will be drawn
      drawLines - draw Table's borders
      drawContent - draw Table's content
      Throws:
      IOException - if fonts are not loaded correctly
    • Table

      public Table(float yStart, float yStartNewPage, float pageTopMargin, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, T currentPage, boolean drawLines, boolean drawContent, PageProvider<T> pageProvider) throws IOException
      Throws:
      IOException
    • Table

      public Table(float yStartNewPage, float pageTopMargin, float pageBottomMargin, float width, float margin, org.apache.pdfbox.pdmodel.PDDocument document, boolean drawLines, boolean drawContent, PageProvider<T> pageProvider) throws IOException
      Throws:
      IOException
  • Method Details

    • loadFonts

      protected abstract void loadFonts() throws IOException
      Throws:
      IOException
    • loadFont

      protected org.apache.pdfbox.pdmodel.font.PDType0Font loadFont(String fontPath) throws IOException
      Throws:
      IOException
    • getDocument

      protected org.apache.pdfbox.pdmodel.PDDocument getDocument()
    • drawTitle

      public void drawTitle(String title, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize, float tableWidth, float height, String alignment, float freeSpaceForPageBreak, boolean drawHeaderMargin) throws IOException
      Throws:
      IOException
    • drawTitle

      public void drawTitle(String title, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize, float tableWidth, float height, String alignment, float freeSpaceForPageBreak, WrappingFunction wrappingFunction, boolean drawHeaderMargin) throws IOException
      Throws:
      IOException
    • getWidth

      public float getWidth()
    • createRow

      public Row<T> createRow(float height)
    • createRow

      public Row<T> createRow(List<Cell<T>> cells, float height)
    • draw

      public float draw() throws IOException

      Draws table

      Returns:
      Y position of the table
      Throws:
      IOException - if underlying stream has problem being written to.
    • createPage

      @Deprecated protected T createPage()
      Deprecated.
      Use a PageProvider instead
      Returns:
      new PDPage
    • getCurrentPage

      public T getCurrentPage()
    • getBookmarks

      public List<org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem> getBookmarks()
    • setHeader

      @Deprecated public void setHeader(Row<T> header)
      Deprecated.
      Use addHeaderRow(Row) instead, as it supports multiple header rows
      /**
      Parameters:
      header - row that will be set as table's header row
    • getHeaderAndDataHeight

      public float getHeaderAndDataHeight()

      Calculate height of all table cells (essentially, table height).

      IMPORTANT: Doesn't acknowledge possible page break. Use with caution.

      Returns:
      Table's height
    • getMinimumHeight

      public float getMinimumHeight()

      Calculates minimum table height that needs to be drawn (all header rows + first data row heights).

      Returns:
      height
    • addHeaderRow

      public void addHeaderRow(Row<T> row)

      Setting current row as table header row

      Parameters:
      row - The row that would be added as table's header row
    • getHeader

      public Row<T> getHeader()

      Retrieves last table's header row

      Returns:
      header row
    • getMargin

      public float getMargin()
    • setYStart

      protected void setYStart(float yStart)
    • isDrawDebug

      public boolean isDrawDebug()
    • setDrawDebug

      public void setDrawDebug(boolean drawDebug)
    • tableIsBroken

      public boolean tableIsBroken()
    • setTableIsBroken

      public void setTableIsBroken(boolean tableIsBroken)
    • getRows

      public List<Row<T>> getRows()
    • tableStartedAtNewPage

      public boolean tableStartedAtNewPage()
    • getLineSpacing

      public float getLineSpacing()
    • setLineSpacing

      public void setLineSpacing(float lineSpacing)
    • allBordersRemoved

      public boolean allBordersRemoved()
    • removeAllBorders

      public void removeAllBorders(boolean removeAllBorders)