Class PageBreakPositionList
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.layout.model.PageBreakPositionList
-
- All Implemented Interfaces:
PageBreakPositions
- Direct Known Subclasses:
FlowPageBreakPositionList
public class PageBreakPositionList extends Object implements PageBreakPositions
-
-
Constructor Summary
Constructors Constructor Description PageBreakPositionList()
PageBreakPositionList(PageBreakPositionList parentList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMajorBreak(long position, long pageHeaderSize)
void
addMinorBreak(long position)
long
computeFixedPositionInFlow(long shiftedBoxPosition, long fixedPositionResolved)
Computes the box's position in the normal-flow that will fullfill the 'fixed-position' constraint.void
copyFrom(PageBreakPositionList parentList)
boolean
equals(Object o)
long
findNextBreakPosition(long position)
Finds the closest break-position that is larger or equal to the given position.long
findNextMajorBreakPosition(long position)
Finds the closest master break-position that is larger or equal to the given position.long
findPageEndForPageStartPosition(long pageOffset)
Locates the page-end for a given page-start position.long
findPageStartPositionForPageEndPosition(long pageOffset)
Locates the page-start for a given page-end position.long
findPreviousBreakPosition(long position)
long
getLastMasterBreak()
long
getMasterBreak(int index)
int
getMasterBreakSize()
protected long
getPageHeaderHeight(long position)
int
hashCode()
boolean
isCrossingPagebreak(long boxY, long boxHeight, long pagebreakShift)
Checks, whether the given box will cross a pagebreak.boolean
isCrossingPagebreakWithFixedPosition(long shiftedBoxPosition, long boxHeight, long fixedPositionResolved)
boolean
isPageStart(long position)
String
toString()
-
-
-
Constructor Detail
-
PageBreakPositionList
public PageBreakPositionList()
-
PageBreakPositionList
public PageBreakPositionList(PageBreakPositionList parentList)
-
-
Method Detail
-
copyFrom
public void copyFrom(PageBreakPositionList parentList)
-
addMinorBreak
public void addMinorBreak(long position)
-
addMajorBreak
public void addMajorBreak(long position, long pageHeaderSize)
-
findNextBreakPosition
public long findNextBreakPosition(long position)
Finds the closest break-position that is larger or equal to the given position. This returns the next pagebreak in the flow after the given position. If the position given is larger than the largest posible page-break, then this returns the last pagebreak instead.- Specified by:
findNextBreakPosition
in interfacePageBreakPositions
- Parameters:
position
- the position from where to search the next pagebreak.- Returns:
- the position.
-
findPreviousBreakPosition
public long findPreviousBreakPosition(long position)
- Specified by:
findPreviousBreakPosition
in interfacePageBreakPositions
-
isCrossingPagebreak
public boolean isCrossingPagebreak(long boxY, long boxHeight, long pagebreakShift)
Checks, whether the given box will cross a pagebreak. The box's y-position is shifted by the given amount before testing the result. A box will cross a pagebreak if its shifted y position and its shifted y2 position (y + height) are located on different pages. A box with a height of zero cannot cross a pagebreak by definition.- Specified by:
isCrossingPagebreak
in interfacePageBreakPositions
- Parameters:
boxY
- the box Y, unshifted.boxHeight
- the box height.pagebreakShift
- the current shift that should be applied for the test- Returns:
- true, if the box crosses a pagebreak, false otherwise.
-
isCrossingPagebreakWithFixedPosition
public boolean isCrossingPagebreakWithFixedPosition(long shiftedBoxPosition, long boxHeight, long fixedPositionResolved)
- Specified by:
isCrossingPagebreakWithFixedPosition
in interfacePageBreakPositions
-
computeFixedPositionInFlow
public long computeFixedPositionInFlow(long shiftedBoxPosition, long fixedPositionResolved)
Computes the box's position in the normal-flow that will fullfill the 'fixed-position' constraint. The result will be the position on the current page. This position might sit on already processed content, so the caller has to check whether the return value of this function is less than the shifted box position. In that case, the band must cause a pagebreak before it can be positioned.- Specified by:
computeFixedPositionInFlow
in interfacePageBreakPositions
- Parameters:
shiftedBoxPosition
-fixedPositionResolved
-- Returns:
- the computed fixed position, which may be invalid.
-
getPageHeaderHeight
protected long getPageHeaderHeight(long position)
-
findNextMajorBreakPosition
public long findNextMajorBreakPosition(long position)
Finds the closest master break-position that is larger or equal to the given position. A master pagebreak is the boundary of a logical page, which in itself can consist of several physical pages. This returns the next master pagebreak in the flow after the given position. If the position given is larger than the largest posible page-break, then this returns the last pagebreak instead.- Specified by:
findNextMajorBreakPosition
in interfacePageBreakPositions
- Parameters:
position
- the position from where to search the next pagebreak.- Returns:
- the position.
-
getLastMasterBreak
public long getLastMasterBreak()
-
getMasterBreakSize
public int getMasterBreakSize()
-
getMasterBreak
public long getMasterBreak(int index)
-
findPageEndForPageStartPosition
public long findPageEndForPageStartPosition(long pageOffset)
Description copied from interface:PageBreakPositions
Locates the page-end for a given page-start position.- Specified by:
findPageEndForPageStartPosition
in interfacePageBreakPositions
- Parameters:
pageOffset
- the current page-start for which to find the page-end.- Returns:
- the end position for the page starting on
pageStartPosition
.
-
findPageStartPositionForPageEndPosition
public long findPageStartPositionForPageEndPosition(long pageOffset)
Description copied from interface:PageBreakPositions
Locates the page-start for a given page-end position.- Specified by:
findPageStartPositionForPageEndPosition
in interfacePageBreakPositions
- Parameters:
pageOffset
- the current page-end for which to find the page-start.- Returns:
- the start position for the page ending on
pageEndPosition
.
-
isPageStart
public boolean isPageStart(long position)
- Specified by:
isPageStart
in interfacePageBreakPositions
-
-