Class BreakElement


  • public class BreakElement
    extends UnresolvedListElement
    This class represents an unresolved break possibility.
    • Field Detail

      • penaltyWidth

        private int penaltyWidth
      • penaltyValue

        private int penaltyValue
      • breakClass

        private int breakClass
      • pendingBeforeMarks

        private java.util.List pendingBeforeMarks
      • pendingAfterMarks

        private java.util.List pendingAfterMarks
    • Constructor Detail

      • BreakElement

        public BreakElement​(Position position,
                            int penaltyValue,
                            LayoutContext context)
        Main constructor
        Parameters:
        position - the Position instance needed by the addAreas stage of the LMs.
        penaltyValue - the penalty value for the penalty element to be constructed
        context - the layout context which contains the pending conditional elements
      • BreakElement

        public BreakElement​(Position position,
                            int penaltyValue,
                            int breakClass,
                            LayoutContext context)
        Create a new BreakElement for the given position, penaltyValue and breakClass. (Used principally to generate break-possibilities in ranges of content that must be kept together within the context corresponding to the breakClass; expected to be one of Constants.EN_AUTO, Constants.EN_LINE, Constants.EN_COLUMN or Constants.EN_PAGE)
        Parameters:
        position - the corresponding Position
        penaltyValue - the penalty value
        breakClass - the break class
        context - the LayoutContext
      • BreakElement

        public BreakElement​(Position position,
                            int penaltyWidth,
                            int penaltyValue,
                            int breakClass,
                            LayoutContext context)
        Constructor for hard breaks.
        Parameters:
        position - the Position instance needed by the addAreas stage of the LMs.
        penaltyWidth - the penalty width
        penaltyValue - the penalty value for the penalty element to be constructed
        breakClass - the break class of this penalty (one of Constants.EN_AUTO, Constants.EN_COLUMN, Constants.EN_PAGE, Constants.EN_EVEN_PAGE, Constants.EN_ODD_PAGE)
        context - the layout context which contains the pending conditional elements
    • Method Detail

      • getBreakClassName

        private static java.lang.String getBreakClassName​(int breakClass)
      • isConditional

        public boolean isConditional()
        Specified by:
        isConditional in class UnresolvedListElement
        Returns:
        true if the element is conditional (conditionality="discard")
      • getPenaltyWidth

        public int getPenaltyWidth()
        Returns:
        the penalty width
      • getPenaltyValue

        public int getPenaltyValue()
        Returns:
        the penalty value
      • setPenaltyValue

        public void setPenaltyValue​(int p)
        Sets the penalty value.
        Parameters:
        p - the new penalty value
      • isForcedBreak

        public boolean isForcedBreak()
        Overrides:
        isForcedBreak in class ListElement
        Returns:
        true if the element is a penalty and represents a forced break.
      • getPendingBeforeMarks

        public java.util.List getPendingBeforeMarks()
        Returns:
        the pending border and padding elements at the before edge
      • getPendingAfterMarks

        public java.util.List getPendingAfterMarks()
        Returns:
        the pending border and padding elements at the after edge
      • clearPendingMarks

        public void clearPendingMarks()
        Clears all pending marks associated with this break element. This is used in break cases where we only know very late if the break is actually after all the content of an FO has been generated.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object