Class LeaderLayoutManager

All Implemented Interfaces:
PercentBaseContext, Constants, InlineLevelLayoutManager, LayoutManager

public class LeaderLayoutManager extends LeafNodeLayoutManager
LayoutManager for the fo:leader formatting object
  • Constructor Details

    • LeaderLayoutManager

      public LeaderLayoutManager(Leader node)
      Constructor
      Parameters:
      node - the formatting object that creates this area
  • Method Details

    • 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
    • get

      public InlineArea get(LayoutContext context)
      Return the inline area for this leader.
      Overrides:
      get in class LeafNodeLayoutManager
      Parameters:
      context - the layout context
      Returns:
      the inline area
    • getAllocationIPD

      protected MinOptMax getAllocationIPD(int refIPD)
      Return the allocated IPD for this area.
      Overrides:
      getAllocationIPD in class LeafNodeLayoutManager
      Parameters:
      refIPD - the IPD of the reference area
      Returns:
      the allocated IPD
    • addAreas

      public void addAreas(PositionIterator posIter, LayoutContext context)
      Add the area for this layout manager. This adds the single inline area to the parent.
      Specified by:
      addAreas in interface LayoutManager
      Overrides:
      addAreas in class LeafNodeLayoutManager
      Parameters:
      posIter - the position iterator
      context - the layout context for adding the area
    • 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 LeafNodeLayoutManager
      Parameters:
      context - the LayoutContext used to store layout information
      alignment - the desired text alignment
      Returns:
      the list of KnuthElements
    • hyphenate

      public void hyphenate(Position pos, HyphContext hc)
      Tell the LM to hyphenate a word
      Specified by:
      hyphenate in interface InlineLevelLayoutManager
      Overrides:
      hyphenate in class LeafNodeLayoutManager
      Parameters:
      pos - the Position referring to the word
      hc - the HyphContext storing hyphenation information
    • applyChanges

      public boolean applyChanges(List oldList)
      Tell the LM to apply the changes due to hyphenation
      Specified by:
      applyChanges in interface InlineLevelLayoutManager
      Overrides:
      applyChanges in class LeafNodeLayoutManager
      Parameters:
      oldList - the list of the old elements the changes refer to
      Returns:
      true if the LM had to change its data, false otherwise
    • getChangedKnuthElements

      public List getChangedKnuthElements(List oldList, int alignment)
      Get a sequence of KnuthElements representing the content of the node assigned to the LM, after changes have been applied In the context of line breaking, this method is called after hyphenation has been performed, in order to receive the sequence of elements representing the text together with all possible hyphenation points. For example, if the text "representation" originates a single box element when getNextKnuthElements() is called, it will be now split in syllables (rep-re-sen-ta-tion) each one originating a box and divided by additional elements allowing a line break. In the context of page breaking, this method is called only if the pages need to be "vertically justified" modifying (also) the quantity of lines created by the paragraphs, and after a first page breaking has been performed. According to the result of the first page breaking, each paragraph now knows how many lines it must create (among the existing layout possibilities) and has to create a sequence of elements representing this layout; in particular, each box, representing a line, will contain a LineBreakPositions that will be used in the addAreas() phase. LMs having children look at the old list of elements in order to know which ones they must get the new elements from, as break conditions of preserved linefeeds can divide children into smaller groups (page sequences or paragraphs). LMs having no children can simply return the old elements if they have nothing to change. Inline LMs need to know the text alignment because it affects the elements representing feasible breaks between syllables.
      Specified by:
      getChangedKnuthElements in interface LayoutManager
      Overrides:
      getChangedKnuthElements in class LeafNodeLayoutManager
      Parameters:
      oldList - the elements to replace
      alignment - the desired text alignment
      Returns:
      the updated list of KnuthElements
    • 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
    • getContentAreaIPD

      public int getContentAreaIPD()
      Returns the IPD of the content area
      Specified by:
      getContentAreaIPD in interface LayoutManager
      Overrides:
      getContentAreaIPD in class AbstractBaseLayoutManager
      Returns:
      the IPD of the content area
    • 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 AbstractLayoutManager