Class AbstractAlignmentProcessor
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.layout.process.alignment.AbstractAlignmentProcessor
-
- All Implemented Interfaces:
LastLineTextAlignmentProcessor
,TextAlignmentProcessor
- Direct Known Subclasses:
CenterAlignmentProcessor
,LeftAlignmentProcessor
,RightAlignmentProcessor
public abstract class AbstractAlignmentProcessor extends Object implements TextAlignmentProcessor, LastLineTextAlignmentProcessor
Todo: The whole horizontal alignment is not suitable for spanned page breaks.- Author:
- Thomas Morgner
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAlignmentProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
computeInlineBlock(RenderBox box, long position, long itemElementWidth)
void
deinitialize()
protected int
getBreakableIndex()
protected long
getBreakableMaxAllowedWidth()
protected long[]
getElementDimensions()
protected long[]
getElementPositions()
protected long
getEndOfLine()
protected RenderNode[]
getNodes()
protected long
getPageBreak(int pageIndex)
int
getPagebreakCount()
protected long[]
getPageBreaks()
protected PageGrid
getPageGrid()
protected InlineSequenceElement[]
getSequenceElements()
protected int
getSequenceFill()
protected int
getSkipIndex()
protected long
getStartOfLine()
protected abstract int
handleElement(int start, int count)
Handle the next input chunk.boolean
hasNext()
void
initialize(OutputProcessorMetaData metaData, SequenceList sequence, long start, long end, PageGrid breaks, boolean overflowX)
Initializes the alignment process.protected void
initializeForLastLineAlignment(AbstractAlignmentProcessor proc)
protected void
initializeForSkipAlignment(AbstractAlignmentProcessor proc, int endIndex)
protected boolean
isBorderMarker(InlineSequenceElement element)
Returnstrue
ifelement
represents border type, namely if it is either StartSequenceElement or EndSequenceElementboolean
isLastLineAlignment()
protected int
iterate(InlineSequenceElement[] elements, int maxPos)
Processes the text and calls the layouting methods.RenderBox
next()
void
performLastLineAlignment()
void
performSkipAlignment(int endIndex)
protected void
reInitializeForHandlingComponentSplit(int breakableIndex, RenderNode[] replacement)
protected void
setBreakableIndex(int breakableIndex)
protected void
setBreakableMaxAllowedWidth(long breakableMaxAllowedWidth)
protected void
setSkipIndex(int skipIndex)
protected boolean
splitBreakableIfPossible()
Tries to split a breakable component if possible.protected void
updateBreaksForLastLineAlignment()
void
updateLineSize(long start, long end)
protected void
updatePageBreaks(long[] pagebreaks, int pageBreakCount)
-
-
-
Method Detail
-
isLastLineAlignment
public boolean isLastLineAlignment()
-
getStartOfLine
protected long getStartOfLine()
-
getPageGrid
protected PageGrid getPageGrid()
-
getSequenceElements
protected InlineSequenceElement[] getSequenceElements()
-
getNodes
protected RenderNode[] getNodes()
-
getElementPositions
protected long[] getElementPositions()
-
getElementDimensions
protected long[] getElementDimensions()
-
getEndOfLine
protected long getEndOfLine()
-
getPagebreakCount
public int getPagebreakCount()
-
getPageBreak
protected long getPageBreak(int pageIndex)
-
getPageBreaks
protected long[] getPageBreaks()
-
updatePageBreaks
protected void updatePageBreaks(long[] pagebreaks, int pageBreakCount)
-
getBreakableIndex
protected int getBreakableIndex()
-
setBreakableIndex
protected void setBreakableIndex(int breakableIndex)
-
getSkipIndex
protected int getSkipIndex()
-
setSkipIndex
protected void setSkipIndex(int skipIndex)
-
getBreakableMaxAllowedWidth
protected long getBreakableMaxAllowedWidth()
-
setBreakableMaxAllowedWidth
protected void setBreakableMaxAllowedWidth(long breakableMaxAllowedWidth)
-
iterate
protected int iterate(InlineSequenceElement[] elements, int maxPos)
Processes the text and calls the layouting methods. This method returns the index of the last element that fits on the current line.- Parameters:
elements
-maxPos
-- Returns:
-
initialize
public void initialize(OutputProcessorMetaData metaData, SequenceList sequence, long start, long end, PageGrid breaks, boolean overflowX)
Initializes the alignment process. The start and end parameters specify the line boundaries, and have been precomputed.- Specified by:
initialize
in interfaceLastLineTextAlignmentProcessor
- Specified by:
initialize
in interfaceTextAlignmentProcessor
- Parameters:
sequence
-start
-end
-breaks
-
-
updateLineSize
public void updateLineSize(long start, long end)
- Specified by:
updateLineSize
in interfaceLastLineTextAlignmentProcessor
- Specified by:
updateLineSize
in interfaceTextAlignmentProcessor
-
deinitialize
public void deinitialize()
- Specified by:
deinitialize
in interfaceLastLineTextAlignmentProcessor
- Specified by:
deinitialize
in interfaceTextAlignmentProcessor
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceTextAlignmentProcessor
-
next
public RenderBox next()
- Specified by:
next
in interfaceTextAlignmentProcessor
-
handleElement
protected abstract int handleElement(int start, int count)
Handle the next input chunk.- Parameters:
start
- the start indexcount
- the number of elements in the sequence- Returns:
- the processing position. Linebreaks will be inserted, if the returned value is equal or less the start index.
-
computeInlineBlock
protected void computeInlineBlock(RenderBox box, long position, long itemElementWidth)
-
getSequenceFill
protected int getSequenceFill()
-
performLastLineAlignment
public void performLastLineAlignment()
- Specified by:
performLastLineAlignment
in interfaceLastLineTextAlignmentProcessor
-
performSkipAlignment
public void performSkipAlignment(int endIndex)
-
initializeForSkipAlignment
protected void initializeForSkipAlignment(AbstractAlignmentProcessor proc, int endIndex)
-
initializeForLastLineAlignment
protected void initializeForLastLineAlignment(AbstractAlignmentProcessor proc)
-
updateBreaksForLastLineAlignment
protected void updateBreaksForLastLineAlignment()
-
isBorderMarker
protected boolean isBorderMarker(InlineSequenceElement element)
Returnstrue
ifelement
represents border type, namely if it is either StartSequenceElement or EndSequenceElement- Parameters:
element
- element- Returns:
true
, if element represents border type andfalse
otherwise
-
splitBreakableIfPossible
protected boolean splitBreakableIfPossible()
Tries to split a breakable component if possible. First, checks whether each of the following conditions is true:getBreakableIndex() >= 0
nodes[breakableIndex]
is an instance of SplittableRenderNodegetBreakableMaxAllowedWidth() > 0
null
. If the separation was successful, then the method re-initialises the processors internal fields by invoking reInitializeForHandlingComponentSplit(int, RenderNode[])- Returns:
true
if the split was done orfalse
otherwise
-
reInitializeForHandlingComponentSplit
protected void reInitializeForHandlingComponentSplit(int breakableIndex, RenderNode[] replacement)
-
-