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

java.lang.Object
be.quodlibet.boxable.Cell<T>
Direct Known Subclasses:
ImageCell, TableCell

public class Cell<T extends org.apache.pdfbox.pdmodel.PDPage> extends Object
  • Method Details

    • getTextColor

      public Color getTextColor()

      Retrieves cell's text Color. Default color is black.

      Returns:
      Color of the cell's text
    • setTextColor

      public void setTextColor(Color textColor)

      Sets cell's text Color.

      Parameters:
      textColor - designated text Color
    • getFillColor

      public Color getFillColor()

      Gets fill (background) Color for the current cell.

      Returns:
      Fill Color for the cell
    • setFillColor

      public void setFillColor(Color fillColor)

      Sets fill (background) Color for the current cell.

      Parameters:
      fillColor - Fill Color for the cell
    • getWidth

      public float getWidth()

      Gets cell's width.

      Returns:
      Cell's width
    • getInnerWidth

      public float getInnerWidth()

      Gets cell's width without (left,right) padding.

      Returns:
      Inner cell's width
    • getInnerHeight

      public float getInnerHeight()

      Gets cell's height without (top,bottom) padding.

      Returns:
      Inner cell's height
    • getText

      public String getText()

      Retrieves text from current cell

      Returns:
      cell's text
    • setText

      public void setText(String text)

      Sets cell's text value

      Parameters:
      text - Text value of the cell
    • getFont

      public org.apache.pdfbox.pdmodel.font.PDFont getFont()

      Gets appropriate PDFont for current cell.

      Returns:
      PDFont for current cell
      Throws:
      IllegalArgumentException - if font is not set.
    • setFont

      public void setFont(org.apache.pdfbox.pdmodel.font.PDFont font)

      Sets appropriate PDFont for current cell.

      Parameters:
      font - PDFont for current cell
    • getFontSize

      public float getFontSize()

      Gets PDFont size for current cell (in points).

      Returns:
      PDFont size for current cell (in points).
    • setFontSize

      public void setFontSize(float fontSize)

      Sets PDFont size for current cell (in points).

      Parameters:
      fontSize - PDFont size for current cell (in points).
    • getParagraph

      public Paragraph getParagraph()

      Retrieves a valid Paragraph depending of cell's PDFont and value rotation.

      If cell has rotated value then Paragraph width is depending of getInnerHeight() otherwise getInnerWidth()

      Returns:
      Cell's Paragraph
    • getExtraWidth

      public float getExtraWidth()
    • getHeight

      public float getHeight()

      Gets the cell's height according to Row's height

      Returns:
      Row's height
    • getCellHeight

      public float getCellHeight()

      Gets the height of the single cell, opposed to getHeight(), which returns the row's height.

      Depending of rotated/normal cell's value there is two cases for calculation:

      1. Rotated value - cell's height is equal to overall text length in the cell with necessery paddings (top,bottom)
      2. Normal value - cell's height is equal to Paragraph's height with necessery paddings (top,bottom)
      Returns:
      Cell's height
      Throws:
      IllegalStateException - if font is not set.
    • setHeight

      public void setHeight(Float height)

      Sets the height of the single cell.

      Parameters:
      height - Cell's height
    • getTextHeight

      public float getTextHeight()

      Gets Paragraph's height

      Returns:
      Paragraph's height
    • getTextWidth

      public float getTextWidth()

      Gets Paragraph's width

      Returns:
      Paragraph's width
    • getLeftPadding

      public float getLeftPadding()

      Gets cell's left padding (in points).

      Returns:
      Cell's left padding (in points).
    • setLeftPadding

      public void setLeftPadding(float cellLeftPadding)

      Sets cell's left padding (in points)

      Parameters:
      cellLeftPadding - Cell's left padding (in points).
    • getRightPadding

      public float getRightPadding()

      Gets cell's right padding (in points).

      Returns:
      Cell's right padding (in points).
    • setRightPadding

      public void setRightPadding(float cellRightPadding)

      Sets cell's right padding (in points)

      Parameters:
      cellRightPadding - Cell's right padding (in points).
    • getTopPadding

      public float getTopPadding()

      Gets cell's top padding (in points).

      Returns:
      Cell's top padding (in points).
    • setTopPadding

      public void setTopPadding(float cellTopPadding)

      Sets cell's top padding (in points)

      Parameters:
      cellTopPadding - Cell's top padding (in points).
    • getBottomPadding

      public float getBottomPadding()

      Gets cell's bottom padding (in points).

      Returns:
      Cell's bottom padding (in points).
    • setBottomPadding

      public void setBottomPadding(float cellBottomPadding)

      Sets cell's bottom padding (in points)

      Parameters:
      cellBottomPadding - Cell's bottom padding (in points).
    • getVerticalFreeSpace

      public float getVerticalFreeSpace()

      Gets free vertical space of cell.

      If cell has rotated value then free vertical space is equal inner cell's height (getInnerHeight()) subtracted to the longest line of rotated Paragraph otherwise it's just cell's inner height ( getInnerHeight()) subtracted with width of the normal Paragraph.

      Returns:
      Free vertical space of the cell's.
    • getHorizontalFreeSpace

      public float getHorizontalFreeSpace()

      Gets free horizontal space of cell.

      If cell has rotated value then free horizontal space is equal cell's inner width (getInnerWidth()) subtracted to the Paragraph's height otherwise it's just cell's getInnerWidth() subtracted with width of longest line in normal Paragraph.

      Returns:
      Free vertical space of the cell's.
    • getAlign

      public HorizontalAlignment getAlign()
    • getValign

      public VerticalAlignment getValign()
    • isHeaderCell

      public boolean isHeaderCell()
    • setHeaderCell

      public void setHeaderCell(boolean isHeaderCell)
    • getWrappingFunction

      public WrappingFunction getWrappingFunction()
    • setWrappingFunction

      public void setWrappingFunction(WrappingFunction wrappingFunction)
    • getLeftBorder

      public LineStyle getLeftBorder()
    • getRightBorder

      public LineStyle getRightBorder()
    • getTopBorder

      public LineStyle getTopBorder()
    • getBottomBorder

      public LineStyle getBottomBorder()
    • setLeftBorderStyle

      public void setLeftBorderStyle(LineStyle leftBorder)
    • setRightBorderStyle

      public void setRightBorderStyle(LineStyle rightBorder)
    • setTopBorderStyle

      public void setTopBorderStyle(LineStyle topBorder)
    • setBottomBorderStyle

      public void setBottomBorderStyle(LineStyle bottomBorder)
    • setBorderStyle

      public void setBorderStyle(LineStyle border)

      Easy setting for cell border style.

      Parameters:
      border - It is LineStyle for all borders
      See Also:
    • isTextRotated

      public boolean isTextRotated()
    • setTextRotated

      public void setTextRotated(boolean textRotated)
    • getFontBold

      public org.apache.pdfbox.pdmodel.font.PDFont getFontBold()
    • setFontBold

      public void setFontBold(org.apache.pdfbox.pdmodel.font.PDFont fontBold)

      Sets the font used for bold text, for example in header cells.

      Parameters:
      fontBold - The font to use for bold text
    • isColspanCell

      public boolean isColspanCell()
    • setColspanCell

      public void setColspanCell(boolean isColspanCell)
    • setAlign

      public void setAlign(HorizontalAlignment align)
    • setValign

      public void setValign(VerticalAlignment valign)
    • copyCellStyle

      public void copyCellStyle(Cell sourceCell)

      Copies the style of an existing cell to this cell

      Parameters:
      sourceCell - Source Cell from which cell style will be copied.
    • hasSameStyle

      public Boolean hasSameStyle(Cell sourceCell)

      Compares the style of a cell with another cell

      Parameters:
      sourceCell - Source Cell which will be used for style comparation
      Returns:
      boolean if source cell has the same style
    • setWidth

      public void setWidth(float width)
    • getLineSpacing

      public float getLineSpacing()
    • setLineSpacing

      public void setLineSpacing(float lineSpacing)
    • addContentDrawnListener

      public void addContentDrawnListener(CellContentDrawnListener<T> listener)
    • getCellContentDrawnListeners

      public List<CellContentDrawnListener<T>> getCellContentDrawnListeners()
    • notifyContentDrawnListeners

      public void notifyContentDrawnListeners(org.apache.pdfbox.pdmodel.PDDocument document, org.apache.pdfbox.pdmodel.PDPage page, org.apache.pdfbox.pdmodel.common.PDRectangle rectangle)
    • getUrl

      public URL getUrl()
    • setUrl

      public void setUrl(URL url)