Class Cell

All Implemented Interfaces:
IAbstractElement, IBlockElement, IElement, IPropertyContainer, IAccessibleElement

public class Cell extends BlockElement<Cell>
A Cell is one piece of data in an enclosing grid, the Table. This object is a BlockElement, giving it a number of visual layout properties. A cell can act as a container for a number of layout elements; it can only contain other BlockElement objects or images. Other types of layout elements must be wrapped in a BlockElement.
  • Field Details

  • Constructor Details

    • Cell

      public Cell (int rowspan, int colspan)
      Creates a cell which takes a custom amount of cell spaces in the table.
      rowspan - the number of rows this cell must occupy. Negative numbers will make the argument default to 1.
      colspan - the number of columns this cell must occupy. Negative numbers will make the argument default to 1.
    • Cell

      public Cell()
      Creates a cell.
  • Method Details

    • getRenderer

      public IRenderer getRenderer()
      Gets a cell renderer for this element. Note that this method can be called more than once. By default each element should define its own renderer, but the renderer can be overridden by AbstractElement.setNextRenderer(IRenderer) method call.
      Specified by:
      getRenderer in interface IElement
      getRenderer in class AbstractElement<Cell>
      a cell renderer for this element
    • getRow

      public int getRow()
      Gets the number of the row in which the cell is located.
      the row number
    • getCol

      public int getCol()
      Gets the number of the column in which the cell is located.
      the column number
    • getRowspan

      public int getRowspan()
      Gets the rowspan of the cell.
      the rowspan
    • getColspan

      public int getColspan()
      Gets the colspan of the cell.
      the colspan
    • add

      public Cell add (IBlockElement element)
      Adds any block element to the cell's contents.
      element - a BlockElement
      this Element
    • add

      public Cell add (Image element)
      Adds an image to the cell's contents.
      element - an Image
      this Element
    • clone

      public Cell clone (boolean includeContent)
      Clones a cell with its position, properties, and optionally its contents.
      includeContent - whether or not to also include the contents of the cell.
      a clone of this Element
    • getDefaultProperty

      public  T1 getDefaultProperty (int property)
      Description copied from interface: IPropertyContainer
      Gets the default property from this entity.
      Specified by:
      getDefaultProperty in interface IPropertyContainer
      getDefaultProperty in class BlockElement<Cell>
      Type Parameters:
      T1 - the return type associated with the property
      property - the property to be retrieved
      the default property value. If the default property is not defined, null will be returned
    • toString

      public String toString()
      toString in class Object
    • getAccessibilityProperties

      public AccessibilityProperties getAccessibilityProperties()
      Description copied from interface: IAccessibleElement
      an interface that allows to specify properties of a tagged element in Tagged PDF.
    • makeNewRenderer

      protected IRenderer makeNewRenderer()
      Description copied from class: AbstractElement
      Creates new renderer instance.
      Specified by:
      makeNewRenderer in class AbstractElement<Cell>
      new IRenderer
    • updateCellIndexes

      protected Cell updateCellIndexes (int row, int col, int numberOfColumns)
      Updates cell indexes.
      row - the number of the row to update
      col - the number of the col to update
      numberOfColumns - to evaluate new colspan
      this Cell with updated fields