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.
      Parameters:
      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
      Overrides:
      getRenderer in class AbstractElement<Cell>
      Returns:
      a cell renderer for this element
    • getRow

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

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

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

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

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

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

      public Cell clone (boolean includeContent)
      Clones a cell with its position, properties, and optionally its contents.
      Parameters:
      includeContent - whether or not to also include the contents of the cell.
      Returns:
      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
      Overrides:
      getDefaultProperty in class BlockElement<Cell>
      Type Parameters:
      T1 - the return type associated with the property
      Parameters:
      property - the property to be retrieved
      Returns:
      the default property value. If the default property is not defined, null will be returned
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAccessibilityProperties

      public AccessibilityProperties getAccessibilityProperties()
      Description copied from interface: IAccessibleElement
      Returns:
      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>
      Returns:
      new IRenderer
    • updateCellIndexes

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