Class TableLayoutManager

All Implemented Interfaces:
PercentBaseContext, Constants, BlockLevelLayoutManager, BreakOpportunity, ConditionalElementListener, LayoutManager

public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager implements BreakOpportunity
LayoutManager for a table FO. A table consists of columns, table header, table footer and multiple table bodies. The header, footer and body add the areas created from the table cells. The table then creates areas for the columns, bodies and rows the render background.
  • Constructor Details

    • TableLayoutManager

      public TableLayoutManager(Table node)
      Create a new table layout manager.
      Parameters:
      node - the table FO
  • Method Details

    • getCommonBorderPaddingBackground

      protected CommonBorderPaddingBackground getCommonBorderPaddingBackground()
      Description copied from class: SpacedBorderedPaddedBlockLayoutManager
      Returns the CommonBorderPaddingBackground instance from the FO handled by this layout manager.
      Specified by:
      getCommonBorderPaddingBackground in class SpacedBorderedPaddedBlockLayoutManager
    • getTable

      public Table getTable()
      Returns:
      the table FO
    • getColumns

      public ColumnSetup getColumns()
      Returns:
      the column setup for this table.
    • initialize

      public void initialize()
      initialize the layout manager. Allows each layout manager to calculate often used values.
      Specified by:
      initialize in interface LayoutManager
      Overrides:
      initialize in class AbstractLayoutManager
    • getHalfBorderSeparationBPD

      public int getHalfBorderSeparationBPD()
      Returns:
      half the value of border-separation.block-progression-dimension, or 0 if border-collapse="collapse".
    • getHalfBorderSeparationIPD

      public int getHalfBorderSeparationIPD()
      Returns:
      half the value of border-separation.inline-progression-dimension, or 0 if border-collapse="collapse".
    • 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
    • getAuxiliaryPosition

      public Position getAuxiliaryPosition()
      Overrides:
      getAuxiliaryPosition in class BlockStackingLayoutManager
      Returns:
      a cached auxiliary Position instance used for things like spaces.
    • addAreas

      public void addAreas(PositionIterator parentIter, LayoutContext layoutContext)
      The table area is a reference area that contains areas for columns, bodies, rows and the contents are in cells.
      Specified by:
      addAreas in interface LayoutManager
      Overrides:
      addAreas in class AbstractLayoutManager
      Parameters:
      parentIter - the position iterator
      layoutContext - the layout context for adding areas
    • 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
      Returns:
      the parent area of the child
    • addChildArea

      public void addChildArea(Area childArea)
      Add the child area to this layout manager.
      Specified by:
      addChildArea in interface LayoutManager
      Overrides:
      addChildArea in class BlockStackingLayoutManager
      Parameters:
      childArea - the child area to add
    • 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
    • getKeepTogetherProperty

      public KeepProperty getKeepTogetherProperty()
      Returns the keep-together property specified on the FObj. Default implementation throws a IllegalStateException. Must be implemented by the subclass, if applicable.
      Specified by:
      getKeepTogetherProperty in interface BlockLevelLayoutManager
      Overrides:
      getKeepTogetherProperty in class BlockStackingLayoutManager
      Returns:
      the keep-together property
    • getKeepWithPreviousProperty

      public KeepProperty getKeepWithPreviousProperty()
      Returns the keep-with-previous property specified on the FObj. Default implementation throws a IllegalStateException. Must be implemented by the subclass, if applicable.
      Specified by:
      getKeepWithPreviousProperty in interface BlockLevelLayoutManager
      Overrides:
      getKeepWithPreviousProperty in class BlockStackingLayoutManager
      Returns:
      the keep-together property
    • getKeepWithNextProperty

      public KeepProperty getKeepWithNextProperty()
      Returns the keep-with-next property specified on the FObj. Default implementation throws a IllegalStateException. Must be implemented by the subclass, if applicable.
      Specified by:
      getKeepWithNextProperty in interface BlockLevelLayoutManager
      Overrides:
      getKeepWithNextProperty in class BlockStackingLayoutManager
      Returns:
      the keep-together property
    • getBaseLength

      public int getBaseLength(int lengthBase, FObj fobj)
      Returns the base length for the given length base. Length base should be one of the constants defined in LengthBase.
      Specified by:
      getBaseLength in interface PercentBaseContext
      Overrides:
      getBaseLength in class AbstractBaseLayoutManager
      Parameters:
      lengthBase - Indicates which type of the base length value is to be returned
      fobj - The FO object against which the percentage should be evaluated
      Returns:
      The base length value of the given kind
    • reset

      public void reset()
      Re-initializes this layout manager in order to re-generate its Knuth elements according to a new IPD value.
      Specified by:
      reset in interface LayoutManager
      Overrides:
      reset in class BlockStackingLayoutManager
    • saveTableHeaderTableCellLayoutManagers

      protected void saveTableHeaderTableCellLayoutManagers(TableCellLayoutManager tclm)
      Saves a TableCellLayoutManager for later use.
      Parameters:
      tclm - a TableCellLayoutManager that has a RetrieveTableMarker
    • repeatAddAreasForSavedTableHeaderTableCellLayoutManagers

      protected void repeatAddAreasForSavedTableHeaderTableCellLayoutManagers()
      Calls addAreas() for each of the saved TableCellLayoutManagers.
    • resolveRetrieveTableMarker

      public RetrieveTableMarker resolveRetrieveTableMarker(RetrieveTableMarker rtm)
      Resolves a RetrieveTableMarker by finding a qualifying Marker to which it is bound to.
      Parameters:
      rtm - the RetrieveTableMarker to be resolved
      Returns:
      a bound RetrieveTableMarker instance or null if no qualifying Marker found
    • registerMarkers

      public void registerMarkers(Map<String,Marker> marks, boolean starting, boolean isfirst, boolean islast)
      Register the markers for this table.
      Parameters:
      marks - the map of markers to add
      starting - if the area being added is starting or ending
      isfirst - if the area being added has is-first trait
      islast - if the area being added has is-last trait
    • clearTableFragmentMarkers

      protected void clearTableFragmentMarkers()
      Clears the list of markers in the current table fragment. Should be called just before starting a new header (that belongs to the next table fragment).
    • flagAsHavingRetrieveTableMarker

      public void flagAsHavingRetrieveTableMarker()
    • possiblyRegisterMarkersForTables

      protected void possiblyRegisterMarkersForTables(Map<String,Marker> markers, boolean isStarting, boolean isFirst, boolean isLast)
      Overrides:
      possiblyRegisterMarkersForTables in class AbstractLayoutManager
    • setRepeateHeader

      public void setRepeateHeader(boolean repeateHeader)