Class ListItemLayoutManager

    • Constructor Detail

      • ListItemLayoutManager

        public ListItemLayoutManager​(ListItem node)
        Create a new list item layout manager.
        Parameters:
        node - list-item to create the layout manager for
    • Method Detail

      • getListItemFO

        protected ListItem getListItemFO()
        Convenience method.
        Returns:
        the ListBlock node
      • setLabel

        public void setLabel​(ListItemLabel node)
        Create a LM for the fo:list-item-label object
        Parameters:
        node - the fo:list-item-label FO
      • setBody

        public void setBody​(ListItemBody node)
        Create a LM for the fo:list-item-body object
        Parameters:
        node - the fo:list-item-body FO
      • getNextKnuthElements

        public java.util.List getNextKnuthElements​(LayoutContext context,
                                                   int alignment,
                                                   java.util.Stack lmStack,
                                                   Position restartPosition,
                                                   LayoutManager restartAtLM)
        Returns an updated list of Knuth elements corresponding to this layout manager, after a change of IPD has been detected.
        Specified by:
        getNextKnuthElements in interface LayoutManager
        Overrides:
        getNextKnuthElements in class BlockStackingLayoutManager
        Parameters:
        context - the layout context
        alignment - the alignment
        lmStack - the stack of LMs that are active at the IPD change
        restartPosition - the position corresponding to the element finishing the page before the IPD change
        restartAtLM - if not null, the layout manager from which to restart. That is, the IPD change occurs between two block elements and not inside a paragraph
        Returns:
        an updated list of elements, taking the new IPD into account
      • addFirstVisibleMarks

        protected void addFirstVisibleMarks​(java.util.List<ListElement> elements,
                                            LayoutContext context,
                                            int alignment)
        Overridden to unconditionally add elements for space-before. Checks if this LM's first "visible marks" (= borders, padding, spaces) have already been processed, and if necessary, adds corresponding elements to the specified list, and updates the given layout context accordingly.
        Overrides:
        addFirstVisibleMarks in class BlockStackingLayoutManager
        Parameters:
        elements - the element list
        context - the layout context
        alignment - the vertical alignment
      • getChangedKnuthElements

        public java.util.List getChangedKnuthElements​(java.util.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 BlockStackingLayoutManager
        Parameters:
        oldList - the elements to replace
        alignment - the desired text alignment
        Returns:
        the updated list of KnuthElements
      • 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 are for the child
      • addChildArea

        public void addChildArea​(Area childArea)
        Add the child. Rows return the areas returned by the child elements. This simply adds the area to the parent layout manager.
        Specified by:
        addChildArea in interface LayoutManager
        Overrides:
        addChildArea in class BlockStackingLayoutManager
        Parameters:
        childArea - the child area
      • isRestartable

        public boolean isRestartable()
        Returns true if this layout manager is able to re-generate its Knuth elements after an IPD change.
        Specified by:
        isRestartable in interface LayoutManager
        Overrides:
        isRestartable in class AbstractBaseLayoutManager
        Returns:
        true if this layout manager can be restarted after an IPD change