Class TableCellLayoutManager

All Implemented Interfaces:
PercentBaseContext, Constants, BlockLevelLayoutManager, LayoutManager

public class TableCellLayoutManager extends BlockStackingLayoutManager
LayoutManager for a table-cell FO. A cell contains blocks. These blocks fill the cell.
  • Constructor Details

    • TableCellLayoutManager

      public TableCellLayoutManager(TableCell node, PrimaryGridUnit pgu)
      Create a new Cell layout manager.
      Parameters:
      node - table-cell FO for which to create the LM
      pgu - primary grid unit for the cell
  • Method Details

    • getTableCell

      public TableCell getTableCell()
      Returns:
      the table-cell FO
    • getTable

      public Table getTable()
      Returns:
      the table owning this cell
    • setHasRepeatedHeader

      public void setHasRepeatedHeader(boolean hasRepeatedHeader)
    • getIPIndents

      protected int getIPIndents()
      Overrides:
      getIPIndents in class BlockStackingLayoutManager
      Returns:
      the sum of start-indent and end-indent
    • getNextKnuthElements

      public List getNextKnuthElements(LayoutContext context, int alignment)
      Get a sequence of KnuthElements representing the content of the node assigned to the LM.
      Specified by:
      getNextKnuthElements in interface LayoutManager
      Overrides:
      getNextKnuthElements in class BlockStackingLayoutManager
      Parameters:
      context - the LayoutContext used to store layout information
      alignment - the desired text alignment
      Returns:
      the list of KnuthElements
    • setYOffset

      public void setYOffset(int off)
      Set the y offset of this cell. This offset is used to set the absolute position of the cell.
      Parameters:
      off - the y direction offset
    • setXOffset

      public void setXOffset(int off)
      Set the x offset of this cell (usually the same as its parent row). This offset is used to determine the absolute position of the cell.
      Parameters:
      off - the x offset
    • setContentHeight

      public void setContentHeight(int h)
      Set the content height for this cell. This method is used during addAreas() stage.
      Parameters:
      h - the height of the contents of this cell
    • setTotalHeight

      public void setTotalHeight(int h)
      Sets the total height of this cell on the current page. That is, the cell's bpd plus before and after borders and paddings, plus the table's border-separation.
      Parameters:
      h - the height of cell
    • repeatAddAreas

      protected void repeatAddAreas()
      Calls the addAreas() using the original arguments.
    • addAreas

      public void addAreas(PositionIterator parentIter, LayoutContext layoutContext, int[] spannedGridRowHeights, int startRow, int endRow, int borderBeforeWhich, int borderAfterWhich, boolean firstOnPage, boolean lastOnPage, org.apache.fop.layoutmgr.table.RowPainter painter, int firstRowHeight)
      Add the areas for the break points. The cell contains block stacking layout managers that add block areas.

      In the collapsing-border model, the borders of a cell that spans over several rows or columns are drawn separately for each grid unit. Therefore we must know the height of each grid row spanned over by the cell. Also, if the cell is broken over two pages we must know which spanned grid rows are present on the current page.

      Parameters:
      parentIter - the iterator of the break positions
      layoutContext - the layout context for adding the areas
      spannedGridRowHeights - in collapsing-border model for a spanning cell, height of each spanned grid row
      startRow - first grid row on the current page spanned over by the cell, inclusive
      endRow - last grid row on the current page spanned over by the cell, inclusive
      borderBeforeWhich - one of ConditionalBorder.NORMAL, ConditionalBorder.LEADING_TRAILING or ConditionalBorder.REST
      borderAfterWhich - one of ConditionalBorder.NORMAL, ConditionalBorder.LEADING_TRAILING or ConditionalBorder.REST
      firstOnPage - true if the cell will be the very first one on the page, in which case collapsed before borders must be drawn in the outer mode
      lastOnPage - true if the cell will be the very last one on the page, in which case collapsed after borders must be drawn in the outer mode
      painter - painter
      firstRowHeight - height of the first row spanned by this cell (may be zero if this row is placed on a previous page). Used to calculate the placement of the row's background image if any
    • getParentArea

      public Area getParentArea(Area childArea)
      Return an Area which can contain the passed childArea. The childArea may not yet have any content, but it has essential traits set. In general, if the LayoutManager already has an Area it simply returns it. Otherwise, it makes a new Area of the appropriate class. It gets a parent area for its area by calling its parent LM. Finally, based on the dimensions of the parent area, it initializes its own area. This includes setting the content IPD and the maximum BPD.
      Specified by:
      getParentArea in interface LayoutManager
      Overrides:
      getParentArea in class AbstractLayoutManager
      Parameters:
      childArea - the child area to get the parent for
      Returns:
      the parent area
    • addChildArea

      public void addChildArea(Area childArea)
      Add the child to the cell block area.
      Specified by:
      addChildArea in interface LayoutManager
      Overrides:
      addChildArea in class BlockStackingLayoutManager
      Parameters:
      childArea - the child to add to the cell
    • negotiateBPDAdjustment

      public int negotiateBPDAdjustment(int adj, KnuthElement lastElement)
      Negotiate BPD adjustment.
      Specified by:
      negotiateBPDAdjustment in interface BlockLevelLayoutManager
      Overrides:
      negotiateBPDAdjustment in class BlockStackingLayoutManager
      Parameters:
      adj - amount to adjust
      lastElement - the last knuth element
      Returns:
      the resulting adjusted BPD
    • discardSpace

      public void discardSpace(KnuthGlue spaceGlue)
      Discard space.
      Specified by:
      discardSpace in interface BlockLevelLayoutManager
      Overrides:
      discardSpace in class BlockStackingLayoutManager
      Parameters:
      spaceGlue - the space
    • getKeepTogether

      public Keep getKeepTogether()
      Returns the keep-together strength for this element.
      Specified by:
      getKeepTogether in interface BlockLevelLayoutManager
      Overrides:
      getKeepTogether in class BlockStackingLayoutManager
      Returns:
      the keep-together strength
    • getKeepWithNext

      public Keep getKeepWithNext()
      Returns the keep-with-next strength for this element.
      Specified by:
      getKeepWithNext in interface BlockLevelLayoutManager
      Overrides:
      getKeepWithNext in class BlockStackingLayoutManager
      Returns:
      the keep-with-next strength
    • getKeepWithPrevious

      public Keep getKeepWithPrevious()
      Returns the keep-with-previous strength for this element.
      Specified by:
      getKeepWithPrevious in interface BlockLevelLayoutManager
      Overrides:
      getKeepWithPrevious in class BlockStackingLayoutManager
      Returns:
      the keep-with-previous strength
    • getContentAreaIPD

      public int getContentAreaIPD()
      Returns the IPD of the content area
      Specified by:
      getContentAreaIPD in interface LayoutManager
      Overrides:
      getContentAreaIPD in class BlockStackingLayoutManager
      Returns:
      the IPD of the content area
    • getContentAreaBPD

      public int getContentAreaBPD()
      Returns the BPD of the content area
      Specified by:
      getContentAreaBPD in interface LayoutManager
      Overrides:
      getContentAreaBPD in class BlockStackingLayoutManager
      Returns:
      the BPD of the content area
    • getGeneratesReferenceArea

      public boolean getGeneratesReferenceArea()
      Returns an indication if the layout manager generates a reference area.
      Specified by:
      getGeneratesReferenceArea in interface LayoutManager
      Overrides:
      getGeneratesReferenceArea in class AbstractBaseLayoutManager
      Returns:
      True if the layout manager generates a reference area
    • getGeneratesBlockArea

      public boolean getGeneratesBlockArea()
      Returns an indication if the layout manager generates a block area.
      Specified by:
      getGeneratesBlockArea in interface LayoutManager
      Overrides:
      getGeneratesBlockArea in class AbstractBaseLayoutManager
      Returns:
      True if the layout manager generates a block area
    • registerMarkers

      protected void registerMarkers(boolean isStarting, boolean isFirst, boolean isLast)
      Registers the FO's markers on the current PageViewport and parent Table.
      Overrides:
      registerMarkers in class AbstractLayoutManager
      Parameters:
      isStarting - boolean indicating whether the markers qualify as 'starting'
      isFirst - boolean indicating whether the markers qualify as 'first'
      isLast - boolean indicating whether the markers qualify as 'last'
    • setParent

      public void setParent(LayoutManager lm)
      Set the parent layout manager. The parent layout manager is required for adding areas.
      Specified by:
      setParent in interface LayoutManager
      Overrides:
      setParent in class AbstractLayoutManager
      Parameters:
      lm - the parent layout manager