org.apache.fop.layoutmgr

## Class BreakElement

- java.lang.Object
- - org.apache.fop.layoutmgr.ListElement
  - - org.apache.fop.layoutmgr.UnresolvedListElement
    - - org.apache.fop.layoutmgr.BreakElement

-     public class BreakElement
      extends UnresolvedListElement

  This class represents an unresolved break possibility.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BreakElement(Position position, int penaltyWidth, int penaltyValue, int breakClass, LayoutContext context)` Constructor for hard breaks.
    `BreakElement(Position position, int penaltyValue, int breakClass, LayoutContext context)` Create a new BreakElement for the given `position`, `penaltyValue` and `breakClass`.
    `BreakElement(Position position, int penaltyValue, LayoutContext context)` Main constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearPendingMarks()` Clears all pending marks associated with this break element.
    `int` | `getBreakClass()` Returns the break class of this penalty.
    `int` | `getPenaltyValue()`
    `int` | `getPenaltyWidth()`
    `java.util.List` | `getPendingAfterMarks()`
    `java.util.List` | `getPendingBeforeMarks()`
    `boolean` | `isConditional()`
    `boolean` | `isForcedBreak()`
    `void` | `setBreakClass(int breakClass)` Sets the break class.
    `void` | `setPenaltyValue(int p)` Sets the penalty value.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.apache.fop.layoutmgr.UnresolvedListElement

      `getOriginatingLayoutManager`

    - ### Methods inherited from class org.apache.fop.layoutmgr.ListElement

      `getLayoutManager, getPosition, isBox, isGlue, isPenalty, isUnresolvedElement, setPosition`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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

    - #### 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.

    - #### getBreakClass

          public int getBreakClass()

      Returns the break class of this penalty.
      Returns:
        one of `Constants.EN_AUTO`, `Constants.EN_COLUMN`, `Constants.EN_PAGE`, `Constants.EN_EVEN_PAGE`, `Constants.EN_ODD_PAGE`.

    - #### setBreakClass

          public void setBreakClass(int breakClass)

      Sets the break class.
      Parameters:
        `breakClass` - one of `Constants.EN_AUTO`, `Constants.EN_LINE`, `Constants.EN_COLUMN`, `Constants.EN_PAGE`, `Constants.EN_EVEN_PAGE`, `Constants.EN_ODD_PAGE`.

    - #### 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`

Copyright 1999-2022 The Apache Software Foundation. All Rights Reserved.