|
fop 0.95 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.layoutmgr.BreakingAlgorithm
org.apache.fop.layoutmgr.BalancingColumnBreakingAlgorithm
public class BalancingColumnBreakingAlgorithm
This is a the breaking algorithm that is responsible for balancing columns in multi-column layout.
Nested Class Summary | |
---|---|
static interface |
PageBreakingAlgorithm.PageBreakingLayoutListener
Interface to notify about layout events during page breaking. |
Nested classes/interfaces inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm |
---|
BreakingAlgorithm.BestRecords, BreakingAlgorithm.KnuthNode |
Field Summary |
---|
Fields inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm |
---|
activeLines, activeNodeCount, alignment, alignmentLast, ALL_BREAKS, best, bFirst, considerTooShort, endLine, incompatibleFitnessDemerit, INFINITE_RATIO, lineWidth, maxFlaggedPenaltiesCount, NO_FLAGGED_PENALTIES, ONLY_FORCED_BREAKS, par, repeatedFlaggedDemerit, startLine, totalShrink, totalStretch, totalWidth |
Constructor Summary | |
---|---|
BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
PageProvider pageProvider,
PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener,
int alignment,
int alignmentLast,
MinOptMax footnoteSeparatorLength,
boolean partOverflowRecovery,
int columnCount)
|
Method Summary | |
---|---|
protected double |
computeAdjustmentRatio(BreakingAlgorithm.KnuthNode activeNode,
int difference)
Return the adjust ration needed to make up for the difference. |
protected double |
computeDemerits(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int fitnessClass,
double r)
Computes the demerits of the current breaking (that is, up to the given element), if the next-to-last chosen breakpoint is the given active node. |
protected int |
computeDifference(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int elementIndex)
Return the difference between the natural width of a line that would be made between the given active node and the given element, and the available width of the real line. |
protected void |
considerLegalBreak(KnuthElement element,
int elementIdx)
Determines if the given breakpoint is a feasible breakpoint. |
protected BreakingAlgorithm.KnuthNode |
createNode(int position,
int line,
int fitness,
int totalWidth,
int totalStretch,
int totalShrink)
Creates a new active node for a break from the best active node of the given fitness class to the element at the given position. |
protected BreakingAlgorithm.KnuthNode |
createNode(int position,
int line,
int fitness,
int totalWidth,
int totalStretch,
int totalShrink,
double adjustRatio,
int availableShrink,
int availableStretch,
int difference,
double totalDemerits,
BreakingAlgorithm.KnuthNode previous)
Creates a new active node for a feasible breakpoint at the given position. |
protected int |
filterActiveNodes()
|
protected void |
finish()
|
FObj |
getFObj()
|
java.util.LinkedList |
getFootnoteList(int index)
|
protected int |
getLineWidth(int line)
Returns the line/part width of a given line/part. |
java.util.LinkedList |
getPageBreaks()
|
protected void |
handleBox(KnuthBox box)
Page-breaking specific handling of the given box. |
protected void |
initialize()
Resets the algorithm's variables. |
void |
insertPageBreakAsFirst(AbstractBreaker.PageBreakPosition pageBreak)
|
void |
removeAllPageBreaks()
Removes all page breaks from the result list. |
protected int |
restartFrom(BreakingAlgorithm.KnuthNode restartingNode,
int currentIndex)
|
void |
updateData1(int total,
double demerits)
Empty method, hook for subclasses. |
void |
updateData2(BreakingAlgorithm.KnuthNode bestActiveNode,
KnuthSequence sequence,
int total)
Empty method, hook for subclasses. |
Methods inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm |
---|
addNode, compareNodes, findBreakingPoints, findBreakingPoints, getAlignment, getAlignmentLast, getElement, getLineWidth, getMaxRecoveryAttempts, getNode, isPartOverflowRecoveryActivated, removeNode, setConstantLineWidth, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount)
Method Detail |
---|
protected double computeDemerits(BreakingAlgorithm.KnuthNode activeNode, KnuthElement element, int fitnessClass, double r)
activeNode
- considered preceding line breakelement
- considered current line breakfitnessClass
- fitness of the current liner
- adjustment ratio for the current line
protected void initialize()
BreakingAlgorithm
initialize
in class BreakingAlgorithm
protected BreakingAlgorithm.KnuthNode createNode(int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, BreakingAlgorithm.KnuthNode previous)
BreakingAlgorithm
createNode
in class BreakingAlgorithm
position
- index of the element in the Knuth sequenceline
- number of the line ending at the breakpointfitness
- fitness class of the line ending at the breakpoint. One of 0, 1, 2, 3.totalWidth
- accumulated width of the KnuthElements up to after the breakpointtotalStretch
- accumulated stretchability of the KnuthElements up to after the
breakpointtotalShrink
- accumulated shrinkability of the KnuthElements up to after the
breakpointadjustRatio
- adjustment ratio if the line ends at this breakpointavailableShrink
- available stretch of the line ending at this breakpointavailableStretch
- available shrink of the line ending at this breakpointdifference
- difference between target and actual line widthtotalDemerits
- minimum total demerits up to the breakpointprevious
- active node for the preceding breakpointprotected BreakingAlgorithm.KnuthNode createNode(int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink)
BreakingAlgorithm
createNode
in class BreakingAlgorithm
BreakingAlgorithm.createNode(int, int, int, int, int, int, double, int, int, int, double, org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode)
,
BreakingAlgorithm.BestRecords
protected void handleBox(KnuthBox box)
handleBox
in class BreakingAlgorithm
box
- a block-level element possibly containing foonotes citationsprotected int restartFrom(BreakingAlgorithm.KnuthNode restartingNode, int currentIndex)
restartFrom
in class BreakingAlgorithm
protected void considerLegalBreak(KnuthElement element, int elementIdx)
BreakingAlgorithm
considerLegalBreak
in class BreakingAlgorithm
element
- the paragraph's element to considerelementIdx
- the element's index inside the paragraphprotected int computeDifference(BreakingAlgorithm.KnuthNode activeNode, KnuthElement element, int elementIndex)
BreakingAlgorithm
computeDifference
in class BreakingAlgorithm
activeNode
- node for the previous breakpointelement
- currently considered breakpoint
protected double computeAdjustmentRatio(BreakingAlgorithm.KnuthNode activeNode, int difference)
BreakingAlgorithm
computeAdjustmentRatio
in class BreakingAlgorithm
protected void finish()
finish
in class BreakingAlgorithm
public java.util.LinkedList getPageBreaks()
public void insertPageBreakAsFirst(AbstractBreaker.PageBreakPosition pageBreak)
public void removeAllPageBreaks()
public void updateData1(int total, double demerits)
BreakingAlgorithm
updateData1
in class BreakingAlgorithm
total
- number of lines for the active nodedemerits
- total demerits of the paragraph for the active nodepublic void updateData2(BreakingAlgorithm.KnuthNode bestActiveNode, KnuthSequence sequence, int total)
BreakingAlgorithm
updateData2
in class BreakingAlgorithm
bestActiveNode
- a node in the chain of best active nodes, corresponding to
one of the optimal breakpointssequence
- the corresponding paragraphtotal
- the number of lines into which the paragraph will be brokenBreakingAlgorithm.calculateBreakPoints(KnuthNode, KnuthSequence, int)
protected int filterActiveNodes()
filterActiveNodes
in class BreakingAlgorithm
public java.util.LinkedList getFootnoteList(int index)
public FObj getFObj()
protected int getLineWidth(int line)
getLineWidth
in class BreakingAlgorithm
line
- the line/part number
|
fop 0.95 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |