You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2010/08/17 20:57:15 UTC
svn commit: r986451 [7/13] - in
/xmlgraphics/fop/branches/Temp_ComplexScripts: ./
examples/plan/src/org/apache/fop/plan/
src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/data/
src/codegen/unicode/java/org/apache/fop/hyphenation/ src/codegen/u...
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Tue Aug 17 18:57:04 2010
@@ -42,15 +42,19 @@ public abstract class AbstractBreaker {
/** logging instance */
protected static Log log = LogFactory.getLog(AbstractBreaker.class);
+ /**
+ * A page break position.
+ */
public static class PageBreakPosition extends LeafPosition {
- double bpdAdjust; // Percentage to adjust (stretch or shrink)
- int difference;
- int footnoteFirstListIndex;
- int footnoteFirstElementIndex;
- int footnoteLastListIndex;
- int footnoteLastElementIndex;
+ // Percentage to adjust (stretch or shrink)
+ double bpdAdjust; // CSOK: VisibilityModifier
+ int difference; // CSOK: VisibilityModifier
+ int footnoteFirstListIndex; // CSOK: VisibilityModifier
+ int footnoteFirstElementIndex; // CSOK: VisibilityModifier
+ int footnoteLastListIndex; // CSOK: VisibilityModifier
+ int footnoteLastElementIndex; // CSOK: VisibilityModifier
- PageBreakPosition(LayoutManager lm, int breakIndex,
+ PageBreakPosition(LayoutManager lm, int breakIndex, // CSOK: ParameterNumber
int ffli, int ffei, int flli, int flei,
double bpdA, int diff) {
super(lm, breakIndex);
@@ -90,9 +94,9 @@ public abstract class AbstractBreaker {
public class BlockSequence extends BlockKnuthSequence {
/** Number of elements to ignore at the beginning of the list. */
- public int ignoreAtStart = 0;
+ int ignoreAtStart = 0; // CSOK: VisibilityModifier
/** Number of elements to ignore at the end of the list. */
- public int ignoreAtEnd = 0;
+ int ignoreAtEnd = 0; // CSOK: VisibilityModifier
/**
* startOn represents where on the page/which page layout
@@ -198,15 +202,34 @@ public abstract class AbstractBreaker {
private List blockLists = null;
+ /** desired text alignment */
protected int alignment;
+
private int alignmentLast;
+ /** footnote separator length */
protected MinOptMax footnoteSeparatorLength = MinOptMax.ZERO;
+ /** @return current display alignment */
protected abstract int getCurrentDisplayAlign();
+
+ /** @return true if content not exhausted */
protected abstract boolean hasMoreContent();
+
+ /**
+ * Tell the layout manager to add all the child areas implied
+ * by Position objects which will be returned by the
+ * Iterator.
+ *
+ * @param posIter the position iterator
+ * @param context the context
+ */
protected abstract void addAreas(PositionIterator posIter, LayoutContext context);
+
+ /** @return top level layout manager */
protected abstract LayoutManager getTopLevelLM();
+
+ /** @return current child layout manager */
protected abstract LayoutManager getCurrentChildLM();
/**
@@ -244,13 +267,27 @@ public abstract class AbstractBreaker {
return null;
}
- /*
- * This method is to contain the logic to determine the LM's
- * getNextKnuthElements() implementation(s) that are to be called.
- * @return LinkedList of Knuth elements.
+ /**
+ * Get a sequence of KnuthElements representing the content
+ * of the node assigned to the LM
+ *
+ * @param context the LayoutContext used to store layout information
+ * @param alignment the desired text alignment
+ * @return the list of KnuthElements
*/
protected abstract List getNextKnuthElements(LayoutContext context, int alignment);
+ /**
+ * Get a sequence of KnuthElements representing the content
+ * of the node assigned to the LM
+ *
+ * @param context the LayoutContext used to store layout information
+ * @param alignment the desired text alignment
+ * @param positionAtIPDChange last element on the part before an IPD change
+ * @param restartAtLM the layout manager from which to restart, if IPD
+ * change occurs between two LMs
+ * @return the list of KnuthElements
+ */
protected List getNextKnuthElements(LayoutContext context, int alignment,
Position positionAtIPDChange, LayoutManager restartAtLM) {
throw new UnsupportedOperationException("TODO: implement acceptable fallback");
@@ -261,6 +298,11 @@ public abstract class AbstractBreaker {
return (this.blockLists.isEmpty());
}
+ /**
+ * Start part.
+ * @param list a block sequence
+ * @param breakClass a break class
+ */
protected void startPart(BlockSequence list, int breakClass) {
//nop
}
@@ -272,6 +314,11 @@ public abstract class AbstractBreaker {
//nop
}
+ /**
+ * Finish part.
+ * @param alg a page breaking algorithm
+ * @param pbp a page break posittion
+ */
protected abstract void finishPart(PageBreakingAlgorithm alg, PageBreakPosition pbp);
/**
@@ -809,8 +856,8 @@ public abstract class AbstractBreaker {
* @param availableBPD the available BPD
* @return the effective list
*/
- private BlockSequence justifyBoxes(BlockSequence blockList, PageBreakingAlgorithm alg,
- int availableBPD) {
+ private BlockSequence justifyBoxes // CSOK: MethodLength
+ (BlockSequence blockList, PageBreakingAlgorithm alg, int availableBPD) {
int iOptPageNumber;
alg.setConstantLineWidth(availableBPD);
iOptPageNumber = alg.findBreakingPoints(blockList, /*availableBPD,*/
@@ -843,15 +890,18 @@ public abstract class AbstractBreaker {
// inside the
// while loop must be a box
KnuthElement firstElement;
- while (!(firstElement = (KnuthElement) sequenceIterator
- .next()).isBox()) {
- //
- log.debug("PLM> ignoring glue or penalty element "
- + "at the beginning of the sequence");
- if (firstElement.isGlue()) {
- ((BlockLevelLayoutManager) firstElement
- .getLayoutManager())
+ while ( sequenceIterator.hasNext() ) {
+ firstElement = (KnuthElement) sequenceIterator.next();
+ if ( !firstElement.isBox() ) {
+ log.debug("PLM> ignoring glue or penalty element "
+ + "at the beginning of the sequence");
+ if (firstElement.isGlue()) {
+ ((BlockLevelLayoutManager) firstElement
+ .getLayoutManager())
.discardSpace((KnuthGlue) firstElement);
+ }
+ } else {
+ break;
}
}
firstElementIndex = sequenceIterator.previousIndex();
@@ -904,8 +954,10 @@ public abstract class AbstractBreaker {
// blockSpaceList
KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
.removeFirst();
- spaceMaxAdjustment = spaceMaxAdjustment.plusMax(blockSpace.getStretch());
- spaceMaxAdjustment = spaceMaxAdjustment.minusMin(blockSpace.getShrink());
+ spaceMaxAdjustment
+ = spaceMaxAdjustment.plusMax(blockSpace.getStretch());
+ spaceMaxAdjustment
+ = spaceMaxAdjustment.minusMin(blockSpace.getShrink());
blockSpacesList.add(blockSpace);
}
}
@@ -995,7 +1047,9 @@ public abstract class AbstractBreaker {
+ (((int)((float) partial * difference / total)) - adjustedDiff)
+ " / " + difference);
}
- int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace);
+ int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager())
+ .negotiateBPDAdjustment
+ (((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace);
adjustedDiff += newAdjust;
}
return adjustedDiff;
@@ -1003,7 +1057,13 @@ public abstract class AbstractBreaker {
private int adjustLineNumbers(LinkedList lineList, int difference, int total) {
if (log.isDebugEnabled()) {
- log.debug("AdjustLineNumbers: difference " + difference + " / " + total + " on " + lineList.size() + " elements");
+ log.debug("AdjustLineNumbers: difference "
+ + difference
+ + " / "
+ + total
+ + " on "
+ + lineList.size()
+ + " elements");
}
ListIterator lineListIterator = lineList.listIterator();
@@ -1012,7 +1072,9 @@ public abstract class AbstractBreaker {
while (lineListIterator.hasNext()) {
KnuthGlue line = (KnuthGlue)lineListIterator.next();
partial += (difference > 0 ? line.getStretch() : line.getShrink());
- int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line);
+ int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager())
+ .negotiateBPDAdjustment
+ (((int) ((float) partial * difference / total)) - adjustedDiff, line);
adjustedDiff += newAdjust;
}
return adjustedDiff;
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -123,6 +123,10 @@ public abstract class AbstractLayoutMana
return null;
}
+ /**
+ * Set currently active child layout manager.
+ * @param childLM the child layout manager
+ */
protected void setCurrentChildLM(LayoutManager childLM) {
curChildLM = childLM;
childLMiter = new LMiter(this);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -275,8 +275,8 @@ public abstract class AbstractPageSequen
/**
* Makes a new page
*
- * @param bIsBlank whether this page is blank or not
- * @param bIsLast whether this page is the last page or not
+ * @param isBlank whether this page is blank or not
+ * @param isLast whether this page is the last page or not
* @return a new page
*/
protected Page makeNewPage(boolean isBlank, boolean isLast) {
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Tue Aug 17 18:57:04 2010
@@ -27,7 +27,10 @@ import org.apache.fop.layoutmgr.SpaceRes
/**
* Utility class which provides common code for the addAreas stage.
*/
-public class AreaAdditionUtil {
+public final class AreaAdditionUtil {
+
+ private AreaAdditionUtil() {
+ }
private static class StackingIter extends PositionIterator {
StackingIter(Iterator parentIter) {
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java Tue Aug 17 18:57:04 2010
@@ -21,6 +21,8 @@ package org.apache.fop.layoutmgr;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.fo.Constants;
import org.apache.fop.traits.MinOptMax;
/**
@@ -29,13 +31,32 @@ import org.apache.fop.traits.MinOptMax;
*/
public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
- private Log log = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
+ private static final Log LOG = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
private int columnCount;
private int fullLen;
private int idealPartLen;
- public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
+ /**
+ * Construct a balancing column breaking algorithm.
+ * @param topLevelLM the top level layout manager
+ * @param pageProvider the page provider
+ * @param layoutListener the layout listener
+ * @param alignment alignment of the paragraph/page. One of {@link Constants#EN_START},
+ * {@link Constants#EN_JUSTIFY}, {@link Constants#EN_CENTER},
+ * {@link Constants#EN_END}.
+ * For pages, {@link Constants#EN_BEFORE} and {@link Constants#EN_AFTER}
+ * are mapped to the corresponding inline properties,
+ * {@link Constants#EN_START} and {@link Constants#EN_END}.
+ * @param alignmentLast alignment of the paragraph's last line
+ * @param footnoteSeparatorLength length of footnote separator
+ * @param partOverflowRecovery {@code true} if too long elements should be moved to
+ * the next line/part
+ * @param columnCount number of columns
+ * @see PageBreakingAlgorithm
+ */
+ public BalancingColumnBreakingAlgorithm // CSOK: ParameterNumber
+ (LayoutManager topLevelLM,
PageProvider pageProvider,
PageBreakingLayoutListener layoutListener,
int alignment, int alignmentLast,
@@ -53,8 +74,8 @@ public class BalancingColumnBreakingAlgo
protected double computeDemerits(KnuthNode activeNode,
KnuthElement element, int fitnessClass, double r) {
double dem = super.computeDemerits(activeNode, element, fitnessClass, r);
- if (log.isTraceEnabled()) {
- log.trace("original demerit=" + dem + " " + totalWidth
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("original demerit=" + dem + " " + totalWidth
+ " line=" + activeNode.line + "/" + columnCount
+ " pos=" + activeNode.position + "/" + (par.size() - 1));
}
@@ -70,13 +91,13 @@ public class BalancingColumnBreakingAlgo
if (remParts > 0) {
avgRestLen = restLen / remParts;
}
- if (log.isTraceEnabled()) {
- log.trace("remaining parts: " + remParts + " rest len: " + restLen
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("remaining parts: " + remParts + " rest len: " + restLen
+ " avg=" + avgRestLen);
}
double balance = (idealPartLen - partLen) / 1000f;
- if (log.isTraceEnabled()) {
- log.trace("balance=" + balance);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("balance=" + balance);
}
double absBalance = Math.abs(balance);
dem = absBalance;
@@ -99,8 +120,8 @@ public class BalancingColumnBreakingAlgo
//We don't want more columns than available
dem = Double.MAX_VALUE;
}
- if (log.isTraceEnabled()) {
- log.trace("effective dem=" + dem + " " + totalWidth);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("effective dem=" + dem + " " + totalWidth);
}
return dem;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -187,7 +187,8 @@ public class BlockContainerLayoutManager
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment) {
resetSpaces();
if (isAbsoluteOrFixed()) {
return getNextKnuthElementsAbsolute(context, alignment);
@@ -404,8 +405,9 @@ public class BlockContainerLayoutManager
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
- Position restartPosition, LayoutManager restartAtLM) {
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment, Stack lmStack,
+ Position restartPosition, LayoutManager restartAtLM) {
resetSpaces();
if (isAbsoluteOrFixed()) {
return getNextKnuthElementsAbsolute(context, alignment);
@@ -990,8 +992,8 @@ public class BlockContainerLayoutManager
}
/** {@inheritDoc} */
- public void addAreas(PositionIterator parentIter,
- LayoutContext layoutContext) {
+ public void addAreas // CSOK: MethodLength
+ (PositionIterator parentIter, LayoutContext layoutContext) {
getParentArea(null);
// if this will create the first block area in a page
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -234,8 +234,8 @@ public class BlockLayoutManager extends
}
/** {@inheritDoc} */
- public void addAreas(PositionIterator parentIter,
- LayoutContext layoutContext) {
+ public void addAreas // CSOK: MethodLength
+ (PositionIterator parentIter, LayoutContext layoutContext) {
getParentArea(null);
// if this will create the first block area in a page
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -26,8 +26,18 @@ import org.apache.fop.fo.properties.Keep
*/
public interface BlockLevelLayoutManager extends LayoutManager {
+ /**
+ * Negotiate BPD adjustment.
+ * @param adj amount to adjust
+ * @param lastElement the last knuth element
+ * @return the resulting adjusted BPD
+ */
int negotiateBPDAdjustment(int adj, KnuthElement lastElement);
+ /**
+ * Discard space.
+ * @param spaceGlue the space
+ */
void discardSpace(KnuthGlue spaceGlue);
/**
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -55,6 +55,7 @@ public abstract class BlockStackingLayou
*/
private static Log log = LogFactory.getLog(BlockStackingLayoutManager.class);
+ /** parent area */
protected BlockParent parentArea;
/** Value of the block-progression-unit (non-standard property) */
@@ -360,7 +361,8 @@ public abstract class BlockStackingLayou
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
referenceIPD = context.getRefIPD();
updateContentAreaIPDwithOverconstrainedAdjust();
@@ -582,8 +584,8 @@ public abstract class BlockStackingLayou
/**
* Adds a break element to the content list between individual child elements.
- * @param contentList
- * @param parentLC
+ * @param contentList the content list
+ * @param parentLC the parent layout context
* @param childLC the currently active child layout context
*/
protected void addInBetweenBreak(List contentList, LayoutContext parentLC,
@@ -758,7 +760,7 @@ public abstract class BlockStackingLayou
/**
* {@inheritDoc}
*/
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) { // CSOK: MethodLength
/*LF*/ //log.debug("");
/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
// + oldList.size());
@@ -1377,7 +1379,12 @@ public abstract class BlockStackingLayou
}*/
}
- protected List createUnitElements(List oldList) {
+ /**
+ * Create unit elements.
+ * @param oldList the old list
+ * @return the new list
+ */
+ protected List createUnitElements(List oldList) { // CSOK: MethodLength
//log.debug("Start conversion: " + oldList.size()
// + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min
// + " space-after.min=" + layoutProps.spaceAfter.getSpace().min);
@@ -1640,7 +1647,8 @@ public abstract class BlockStackingLayou
// insert the correct elements
newList.addFirst(new KnuthBox(wrongBox.getWidth() - decreasedLength,
wrongBox.getPosition(), false));
- newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, Adjustment.SPACE_BEFORE_ADJUSTMENT,
+ newList.addFirst(new KnuthGlue(decreasedLength, 0, 0,
+ Adjustment.SPACE_BEFORE_ADJUSTMENT,
wrongBox.getPosition(), false));
//log.debug(" rimosso box " + neededUnits(wrongBox.getWidth()));
//log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
@@ -1692,34 +1700,58 @@ public abstract class BlockStackingLayou
return newList;
}
+ /** A stack iterator. */
protected static class StackingIter extends PositionIterator {
+
+ /**
+ * Construct a stacking iterator.
+ * @param parentIter the parent iterator
+ */
StackingIter(Iterator parentIter) {
super(parentIter);
}
+ /**
+ * @param nextObj the next position
+ * @return the layout manager of the next position
+ */
protected LayoutManager getLM(Object nextObj) {
return ((Position) nextObj).getLM();
}
+ /**
+ * @param nextObj the next position
+ * @return the next position
+ */
protected Position getPos(Object nextObj) {
return ((Position) nextObj);
}
}
+ /** A mapping position. */
protected static class MappingPosition extends Position {
+
private int iFirstIndex;
private int iLastIndex;
+ /**
+ * Construct mapping position.
+ * @param lm layout manager
+ * @param first position
+ * @param last position
+ */
public MappingPosition(LayoutManager lm, int first, int last) {
super(lm);
iFirstIndex = first;
iLastIndex = last;
}
+ /** @return first index */
public int getFirstIndex() {
return iFirstIndex;
}
+ /** @return last index */
public int getLastIndex() {
return iLastIndex;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakElement.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakElement.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakElement.java Tue Aug 17 18:57:04 2010
@@ -55,7 +55,8 @@ public class BreakElement extends Unreso
* @param breakClass the break class
* @param context the {@link LayoutContext}
*/
- public BreakElement(Position position, int penaltyValue, int breakClass, LayoutContext context) {
+ public BreakElement(Position position, int penaltyValue, int breakClass,
+ LayoutContext context) {
this(position, 0, penaltyValue, breakClass, context);
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Tue Aug 17 18:57:04 2010
@@ -59,12 +59,18 @@ public abstract class BreakingAlgorithm
/** Holder for symbolic literals for the fitness classes */
static final class FitnessClasses {
+
+ private FitnessClasses() {
+ }
+
static final int VERY_TIGHT = 0;
static final int TIGHT = 1;
static final int LOOSE = 2;
static final int VERY_LOOSE = 3;
- static final String[] NAMES = { "VERY TIGHT", "TIGHT", "LOOSE", "VERY LOOSE" };
+ static final String[] NAMES = {
+ "VERY TIGHT", "TIGHT", "LOOSE", "VERY LOOSE"
+ };
/**
* Figure out the fitness class of this line (tight, loose,
@@ -178,6 +184,9 @@ public abstract class BreakingAlgorithm
*/
protected int totalShrink = 0;
+ /**
+ * Best records.
+ */
protected BestRecords best;
private boolean partOverflowRecoveryActivated = true;
@@ -217,51 +226,67 @@ public abstract class BreakingAlgorithm
*/
public class KnuthNode {
/** index of the breakpoint represented by this node */
- public final int position;
+ public final int position; // CSOK: VisibilityModifier
/** number of the line ending at this breakpoint */
- public final int line;
+ public final int line; // CSOK: VisibilityModifier
/** fitness class of the line ending at this breakpoint. One of 0, 1, 2, 3. */
- public final int fitness;
+ public final int fitness; // CSOK: VisibilityModifier
/** accumulated width of the KnuthElements up to after this breakpoint. */
- public final int totalWidth;
+ public final int totalWidth; // CSOK: VisibilityModifier
/** accumulated stretchability of the KnuthElements up to after this breakpoint. */
- public final int totalStretch;
+ public final int totalStretch; // CSOK: VisibilityModifier
/** accumulated shrinkability of the KnuthElements up to after this breakpoint. */
- public final int totalShrink;
+ public final int totalShrink; // CSOK: VisibilityModifier
/** adjustment ratio if the line ends at this breakpoint */
- public final double adjustRatio;
+ public final double adjustRatio; // CSOK: VisibilityModifier
/** available stretch of the line ending at this breakpoint */
- public final int availableShrink;
+ public final int availableShrink; // CSOK: VisibilityModifier
/** available shrink of the line ending at this breakpoint */
- public final int availableStretch;
+ public final int availableStretch; // CSOK: VisibilityModifier
/** difference between target and actual line width */
- public final int difference;
+ public final int difference; // CSOK: VisibilityModifier
/** minimum total demerits up to this breakpoint */
- public double totalDemerits;
+ public double totalDemerits; // CSOK: VisibilityModifier
/** best node for the preceding breakpoint */
- public KnuthNode previous;
+ public KnuthNode previous; // CSOK: VisibilityModifier
/** next possible node in the same line */
- public KnuthNode next;
+ public KnuthNode next; // CSOK: VisibilityModifier
/**
* Holds the number of subsequent recovery attempty that are made to get content fit
* into a line.
*/
- public int fitRecoveryCounter = 0;
+ public int fitRecoveryCounter = 0; // CSOK: VisibilityModifier
- public KnuthNode(int position, int line, int fitness,
+ /**
+ * Construct node.
+ * @param position an integer
+ * @param line an integer
+ * @param fitness an integer
+ * @param totalWidth an integer
+ * @param totalStretch an integer
+ * @param totalShrink an integer
+ * @param adjustRatio a real number
+ * @param availableShrink an integer
+ * @param availableStretch an integer
+ * @param difference an integer
+ * @param totalDemerits a real number
+ * @param previous a node
+ */
+ public KnuthNode // CSOK: ParameterNumber
+ (int position, int line, int fitness,
int totalWidth, int totalStretch, int totalShrink,
double adjustRatio, int availableShrink, int availableStretch,
int difference, double totalDemerits, KnuthNode previous) {
@@ -279,6 +304,7 @@ public abstract class BreakingAlgorithm
this.previous = previous;
}
+ /** {@inheritDoc} */
public String toString() {
return "<KnuthNode at " + position + " "
+ totalWidth + "+" + totalStretch + "-" + totalShrink
@@ -303,6 +329,7 @@ public abstract class BreakingAlgorithm
/** Points to the fitness class which currently leads to the best demerits. */
private int bestIndex = -1;
+ /** default constructor */
public BestRecords() {
reset();
}
@@ -334,6 +361,7 @@ public abstract class BreakingAlgorithm
}
}
+ /** @return true if has records (best index not -1) */
public boolean hasRecords() {
return (bestIndex != -1);
}
@@ -347,30 +375,55 @@ public abstract class BreakingAlgorithm
return (bestDemerits[fitness] != INFINITE_DEMERITS);
}
+ /**
+ * @param fitness to use
+ * @return best demerits
+ */
public double getDemerits(int fitness) {
return bestDemerits[fitness];
}
+ /**
+ * @param fitness to use
+ * @return best node
+ */
public KnuthNode getNode(int fitness) {
return bestNode[fitness];
}
+ /**
+ * @param fitness to use
+ * @return adjustment
+ */
public double getAdjust(int fitness) {
return bestAdjust[fitness];
}
+ /**
+ * @param fitness to use
+ * @return available shrink
+ */
public int getAvailableShrink(int fitness) {
return bestAvailableShrink[fitness];
}
+ /**
+ * @param fitness to use
+ * @return available stretch
+ */
public int getAvailableStretch(int fitness) {
return bestAvailableStretch[fitness];
}
+ /**
+ * @param fitness to use
+ * @return difference
+ */
public int getDifference(int fitness) {
return bestDifference[fitness];
}
+ /** @return minimum demerits */
public double getMinDemerits() {
if (bestIndex != -1) {
return getDemerits(bestIndex);
@@ -427,11 +480,22 @@ public abstract class BreakingAlgorithm
KnuthSequence sequence,
int total);
+ /** @param lineWidth the line width */
public void setConstantLineWidth(int lineWidth) {
this.lineWidth = lineWidth;
}
- /** @see #findBreakingPoints(KnuthSequence, int, double, boolean, int) */
+ /**
+ * @param par the paragraph to break
+ * @param threshold upper bound of the adjustment ratio
+ * @param force {@code true} if a set of breakpoints must be found, even
+ * if there are no feasible ones
+ * @param allowedBreaks the type(s) of breaks allowed. One of {@link #ONLY_FORCED_BREAKS},
+ * {@link #NO_FLAGGED_PENALTIES} or {@link #ALL_BREAKS}.
+ *
+ * @return the number of effective breaks
+ * @see #findBreakingPoints(KnuthSequence, int, double, boolean, int)
+ */
public int findBreakingPoints(KnuthSequence par,
double threshold,
boolean force,
@@ -538,10 +602,18 @@ public abstract class BreakingAlgorithm
return line;
}
+ /**
+ * obtain ipd difference
+ * @return an integer
+ */
protected int getIPDdifference() {
return 0;
}
+ /**
+ * handle ipd change
+ * @return an integer
+ */
protected int handleIpdChange() {
throw new IllegalStateException();
}
@@ -572,8 +644,10 @@ public abstract class BreakingAlgorithm
this.totalWidth = 0;
this.totalStretch = 0;
this.totalShrink = 0;
- this.lastTooShort = this.lastTooLong = null;
- this.startLine = this.endLine = 0;
+ this.lastTooShort = null;
+ this.lastTooLong = null;
+ this.startLine = 0;
+ this.endLine = 0;
this.activeLines = new KnuthNode[20];
}
@@ -597,7 +671,8 @@ public abstract class BreakingAlgorithm
* @param previous active node for the preceding breakpoint
* @return a new node
*/
- protected KnuthNode createNode(int position, int line, int fitness,
+ protected KnuthNode createNode // CSOK: ParameterNumber
+ (int position, int line, int fitness,
int totalWidth, int totalStretch, int totalShrink,
double adjustRatio, int availableShrink, int availableStretch,
int difference, double totalDemerits, KnuthNode previous) {
@@ -609,7 +684,17 @@ public abstract class BreakingAlgorithm
/** 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.
- * @see #createNode(int, int, int, int, int, int, double, int, int, int, double, org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode)
+ * @param position index of the element in the Knuth sequence
+ * @param line number of the line ending at the breakpoint
+ * @param fitness fitness class of the line ending at the breakpoint. One of 0, 1, 2, 3.
+ * @param totalWidth accumulated width of the KnuthElements up to after the breakpoint
+ * @param totalStretch accumulated stretchability of the KnuthElements up to after the
+ * breakpoint
+ * @param totalShrink accumulated shrinkability of the KnuthElements up to after the
+ * breakpoint
+ * @return a new node
+ * @see #createNode(int, int, int, int, int, int, double, int, int, int, double,
+ * org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode)
* @see BreakingAlgorithm.BestRecords
*/
protected KnuthNode createNode(int position, int line, int fitness,
@@ -655,7 +740,7 @@ public abstract class BreakingAlgorithm
handleBox((KnuthBox) element);
} else if (element.isGlue()) {
handleGlueAt((KnuthGlue) element, position, previousIsBox, allowedBreaks);
- } else if (element.isPenalty()){
+ } else if (element.isPenalty()) {
handlePenaltyAt((KnuthPenalty) element, position, allowedBreaks);
} else {
throw new IllegalArgumentException(
@@ -875,7 +960,7 @@ public abstract class BreakingAlgorithm
* number.
* @param element the element
* @param line the line number
- * @param difference
+ * @param difference an integer
* @return {@code true} if the element can end the line
*/
protected boolean elementCanEndLine(KnuthElement element, int line, int difference) {
@@ -896,7 +981,7 @@ public abstract class BreakingAlgorithm
* @param availableShrink the available amount of shrink
* @param availableStretch tha available amount of stretch
*/
- protected void forceNode(KnuthNode node,
+ protected void forceNode(KnuthNode node, // CSOK: ParameterNumber
int line,
int elementIdx,
int difference,
@@ -1320,6 +1405,10 @@ public abstract class BreakingAlgorithm
return sb.toString();
}
+ /**
+ * Filter active nodes.
+ * @return an integer
+ */
protected abstract int filterActiveNodes();
/**
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/ElementListObserver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/ElementListObserver.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/ElementListObserver.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/ElementListObserver.java Tue Aug 17 18:57:04 2010
@@ -27,7 +27,10 @@ import java.util.List;
* is mainly used for the purpose of automated testing. This implementation here does nothing.
* Please see the subclass within the test code.
*/
-public class ElementListObserver {
+public final class ElementListObserver {
+
+ private ElementListObserver() {
+ }
private static List activeObservers = null;
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -36,7 +36,7 @@ import org.apache.fop.fo.pagination.Flow
* Its parent LM is the PageSequenceLayoutManager.
* This LM is responsible for getting columns of the appropriate size
* and filling them with block-level areas generated by its children.
- * @todo Reintroduce emergency counter (generate error to avoid endless loop)
+ * @asf.todo Reintroduce emergency counter (generate error to avoid endless loop)
*/
public class FlowLayoutManager extends BlockStackingLayoutManager
implements BlockLevelLayoutManager {
@@ -79,7 +79,16 @@ public class FlowLayoutManager extends B
return elements;
}
- /** {@inheritDoc} */
+ /**
+ * Get a sequence of KnuthElements representing the content
+ * of the node assigned to the LM.
+ * @param context the LayoutContext used to store layout information
+ * @param alignment the desired text alignment
+ * @param positionAtIPDChange position at ipd change
+ * @param restartAtLM restart at this layout manager
+ * @return the list of KnuthElements
+ * @see LayoutManager#getNextKnuthElements(LayoutContext,int)
+ */
public List getNextKnuthElements(LayoutContext context, int alignment,
Position positionAtIPDChange, LayoutManager restartAtLM) {
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java Tue Aug 17 18:57:04 2010
@@ -95,6 +95,9 @@ public class InlineKnuthSequence extends
return this;
}
+ /**
+ * Add letter space.
+ */
public void addALetterSpace() {
KnuthBox prevBox = (KnuthBox) getLast();
if (prevBox.isAuxiliary()
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Keep.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Keep.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Keep.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Keep.java Tue Aug 17 18:57:04 2010
@@ -1,16 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
/* $Id$ */
@@ -25,7 +27,7 @@ import org.apache.fop.fo.properties.Prop
* Object representing a keep constraint, corresponding
* to the XSL-FO <a href="http://www.w3.org/TR/xsl/#d0e26492">keep properties</a>.
*/
-public class Keep {
+public final class Keep {
/** The integer value for "auto" keep strength. */
private static final int STRENGTH_AUTO = Integer.MIN_VALUE;
@@ -33,8 +35,10 @@ public class Keep {
/** The integer value for "always" keep strength. */
private static final int STRENGTH_ALWAYS = Integer.MAX_VALUE;
+ /** keep auto */
public static final Keep KEEP_AUTO = new Keep(STRENGTH_AUTO, Constants.EN_AUTO);
+ /** keep always */
public static final Keep KEEP_ALWAYS = new Keep(STRENGTH_ALWAYS, Constants.EN_LINE);
private int strength;
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthGlue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthGlue.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthGlue.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthGlue.java Tue Aug 17 18:57:04 2010
@@ -87,6 +87,16 @@ public class KnuthGlue extends KnuthElem
this.adjustmentClass = Adjustment.NO_ADJUSTMENT;
}
+ /**
+ * Creates a new <code>KnuthGlue</code>.
+ *
+ * @param width the width of this glue
+ * @param stretch the stretchability of this glue
+ * @param shrink the shrinkability of this glue
+ * @param adjustmentClass the adjsutment class
+ * @param pos the Position stored in this glue
+ * @param auxiliary is this glue auxiliary?
+ */
public KnuthGlue(int width, int stretch, int shrink, Adjustment adjustmentClass,
Position pos, boolean auxiliary) {
super(width, pos, auxiliary);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java Tue Aug 17 18:57:04 2010
@@ -21,6 +21,9 @@ package org.apache.fop.layoutmgr;
import java.util.List;
+/**
+ * A Knuth element position iterator.
+ */
public class KnuthPossPosIter extends PositionIterator {
private int iterCount;
@@ -46,9 +49,7 @@ public class KnuthPossPosIter extends Po
// Check position < endPos
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected boolean checkNext() {
if (iterCount > 0) {
return super.checkNext();
@@ -58,22 +59,26 @@ public class KnuthPossPosIter extends Po
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Object next() {
--iterCount;
return super.next();
}
+ /**
+ * Peek at next, returning as ListElement.
+ * @return peek at next as ListElement
+ */
public ListElement getKE() {
return (ListElement) peekNext();
}
+ /** {@inheritDoc} */
protected LayoutManager getLM(Object nextObj) {
return ((ListElement) nextObj).getLayoutManager();
}
+ /** {@inheritDoc} */
protected Position getPos(Object nextObj) {
return ((ListElement) nextObj).getPosition();
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthSequence.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/KnuthSequence.java Tue Aug 17 18:57:04 2010
@@ -182,13 +182,20 @@ public abstract class KnuthSequence exte
ListElement element = null;
int posIndex = startIndex;
int lastIndex = size();
- while (posIndex < lastIndex
- && !(element = getElement(posIndex)).isBox()) {
- posIndex++;
+ while ( posIndex < lastIndex ) {
+ element = getElement(posIndex);
+ if ( !element.isBox() ) {
+ posIndex++;
+ } else {
+ break;
+ }
}
- if (posIndex != startIndex
- && element.isBox()) {
- return posIndex - 1;
+ if ( posIndex != startIndex ) {
+ if ( ( element != null ) && element.isBox() ) {
+ return posIndex - 1;
+ } else {
+ return startIndex;
+ }
} else {
return startIndex;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LMiter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LMiter.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LMiter.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LMiter.java Tue Aug 17 18:57:04 2010
@@ -23,27 +23,36 @@ import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
+/** An iterator for layout managers. */
public class LMiter implements ListIterator {
-
+ /** list of layout managers */
protected List listLMs;
+ /** current position in iteration */
protected int curPos = 0;
/** The LayoutManager to which this LMiter is attached **/
private LayoutManager lp;
+ /**
+ * Construct a layout manager iterator.
+ * @param lp the associated layout manager (parent)
+ */
public LMiter(LayoutManager lp) {
this.lp = lp;
listLMs = lp.getChildLMs();
}
+ /** {@inheritDoc} */
public boolean hasNext() {
return (curPos < listLMs.size()) ? true : lp.createNextChildLMs(curPos);
}
+ /** {@inheritDoc} */
public boolean hasPrevious() {
return (curPos > 0);
}
+ /** {@inheritDoc} */
public Object previous() throws NoSuchElementException {
if (curPos > 0) {
return listLMs.get(--curPos);
@@ -52,6 +61,7 @@ public class LMiter implements ListItera
}
}
+ /** {@inheritDoc} */
public Object next() throws NoSuchElementException {
if (curPos < listLMs.size()) {
return listLMs.get(curPos++);
@@ -60,7 +70,8 @@ public class LMiter implements ListItera
}
}
- public void remove() throws NoSuchElementException {
+ /** {@inheritDoc} */
+ public void remove() throws NoSuchElementException {
if (curPos > 0) {
listLMs.remove(--curPos);
// Note: doesn't actually remove it from the base!
@@ -70,18 +81,22 @@ public class LMiter implements ListItera
}
- public void add(Object o) throws UnsupportedOperationException {
+ /** {@inheritDoc} */
+ public void add(Object o) throws UnsupportedOperationException {
throw new UnsupportedOperationException("LMiter doesn't support add");
}
+ /** {@inheritDoc} */
public void set(Object o) throws UnsupportedOperationException {
throw new UnsupportedOperationException("LMiter doesn't support set");
}
+ /** {@inheritDoc} */
public int nextIndex() {
return curPos;
}
+ /** {@inheritDoc} */
public int previousIndex() {
return curPos - 1;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutContext.java Tue Aug 17 18:57:04 2010
@@ -33,12 +33,12 @@ import org.apache.fop.traits.MinOptMax;
* method. It is set up by higher level LM and used by lower level LM.
*/
public class LayoutContext {
- /**
- * Values for flags.
- */
+
+ /** linebreak at line feed only flag */
public static final int LINEBREAK_AT_LF_ONLY = 0x01;
/** Generated break possibility is first in a new area */
public static final int NEW_AREA = 0x02;
+ /** ipd unknown flag */
public static final int IPD_UNKNOWN = 0x04;
/** Signal to a Line LM that a higher level LM may provoke a change
* in the reference area, thus ref area IPD. The LineLM should return
@@ -51,10 +51,13 @@ public class LayoutContext {
* not cause a mandatory break as this break was already handled by a parent layout manager.
*/
public static final int SUPPRESS_BREAK_BEFORE = 0x10;
+ /** first area flag */
public static final int FIRST_AREA = 0x20;
+ /** try hypenate flag */
public static final int TRY_HYPHENATE = 0x40;
+ /** last area flag */
public static final int LAST_AREA = 0x80;
-
+ /** resolve leading space flag */
public static final int RESOLVE_LEADING_SPACE = 0x100;
/**
@@ -178,6 +181,7 @@ public class LayoutContext {
trailingSpace = null;
}
+ /** @param source from which pending marks are copied */
public void copyPendingMarksFrom(LayoutContext source) {
if (source.pendingAfterMarks != null) {
this.pendingAfterMarks = new java.util.ArrayList(source.pendingAfterMarks);
@@ -187,10 +191,15 @@ public class LayoutContext {
}
}
+ /** @param flags to set */
public void setFlags(int flags) {
setFlags(flags, true);
}
+ /**
+ * @param flags to set or clear
+ * @param bSet true to set, false to clear
+ */
public void setFlags(int flags, boolean bSet) {
if (bSet) {
this.flags |= flags;
@@ -199,26 +208,32 @@ public class LayoutContext {
}
}
+ /** @param flags to clear */
public void unsetFlags(int flags) {
setFlags(flags, false);
}
+ /** @return true if new area is set */
public boolean isStart() {
return ((this.flags & NEW_AREA) != 0);
}
+ /** @return true if new area is set and leading space is non-null */
public boolean startsNewArea() {
return ((this.flags & NEW_AREA) != 0 && leadingSpace != null);
}
+ /** @return true if first area is set */
public boolean isFirstArea() {
return ((this.flags & FIRST_AREA) != 0);
}
+ /** @return true if last area is set */
public boolean isLastArea() {
return ((this.flags & LAST_AREA) != 0);
}
+ /** @return true if suppress break before is set */
public boolean suppressBreakBefore() {
return ((this.flags & SUPPRESS_BREAK_BEFORE) != 0);
}
@@ -293,22 +308,27 @@ public class LayoutContext {
return !getKeepWithPreviousPending().isAuto();
}
+ /** @param space leading space */
public void setLeadingSpace(SpaceSpecifier space) {
leadingSpace = space;
}
+ /** @return leading space */
public SpaceSpecifier getLeadingSpace() {
return leadingSpace;
}
+ /** @return true if resolve leading space is set */
public boolean resolveLeadingSpace() {
return ((this.flags & RESOLVE_LEADING_SPACE) != 0);
}
+ /** @param space trailing space */
public void setTrailingSpace(SpaceSpecifier space) {
trailingSpace = space;
}
+ /** @return trailing space */
public SpaceSpecifier getTrailingSpace() {
return trailingSpace;
}
@@ -389,6 +409,7 @@ public class LayoutContext {
/**
* Sets the inline-progression-dimension of the nearest ancestor reference area.
+ * @param ipd of nearest ancestor reference area
*/
public void setRefIPD(int ipd) {
refIPD = ipd;
@@ -403,14 +424,17 @@ public class LayoutContext {
return refIPD;
}
+ /** @param hyph a hyphenation context */
public void setHyphContext(HyphContext hyph) {
hyphContext = hyph;
}
+ /** @return hyphenation context */
public HyphContext getHyphContext() {
return hyphContext;
}
+ /** @return true if try hyphenate is set */
public boolean tryHyphenate() {
return ((this.flags & TRY_HYPHENATE) != 0);
}
@@ -428,30 +452,39 @@ public class LayoutContext {
return this.bpAlignment;
}
+ /** @param adjust space adjustment */
public void setSpaceAdjust(double adjust) {
dSpaceAdjust = adjust;
}
+ /** @return space adjustment */
public double getSpaceAdjust() {
return dSpaceAdjust;
}
+ /** @param ipdA ipd adjustment */
public void setIPDAdjust(double ipdA) {
ipdAdjust = ipdA;
}
+ /** @return ipd adjustment */
public double getIPDAdjust() {
return ipdAdjust;
}
+ /** @param alignmentContext alignment context */
public void setAlignmentContext(AlignmentContext alignmentContext) {
this.alignmentContext = alignmentContext;
}
+ /** @return alignment context */
public AlignmentContext getAlignmentContext() {
return this.alignmentContext;
}
+ /**
+ * Reset alignment context.
+ */
public void resetAlignmentContext() {
if (this.alignmentContext != null) {
this.alignmentContext = this.alignmentContext.getParentAlignmentContext();
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutException.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutException.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutException.java Tue Aug 17 18:57:04 2010
@@ -29,7 +29,7 @@ import org.apache.fop.events.EventExcept
* Exception thrown by FOP if an unrecoverable layout error occurs. An example: An area overflows
* a viewport that has overflow="error-if-overflow".
*
- * @todo Discuss if this should become a checked exception.
+ * @asf.todo Discuss if this should become a checked exception.
*/
public class LayoutException extends RuntimeException {
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManager.java Tue Aug 17 18:57:04 2010
@@ -132,7 +132,7 @@ public interface LayoutManager extends P
/**
* Get a sequence of KnuthElements representing the content
- * of the node assigned to the LM
+ * of the node assigned to the LM.
*
* @param context the LayoutContext used to store layout information
* @param alignment the desired text alignment
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java Tue Aug 17 18:57:04 2010
@@ -16,6 +16,7 @@
*/
/* $Id$ */
+
package org.apache.fop.layoutmgr;
import java.util.List;
@@ -40,7 +41,7 @@ public interface LayoutManagerMaker {
* @param node the FO node for which the LayoutManagers are made
* @param lms the list to which the LayoutManagers are added
*/
- public void makeLayoutManagers(FONode node, List lms);
+ void makeLayoutManagers(FONode node, List lms);
/**
* Make a specific LayoutManager for the node.
@@ -48,10 +49,8 @@ public interface LayoutManagerMaker {
* an IllegalStateException is thrown.
* @param node the FO node for which the LayoutManagers are made
* @return The created LayoutManager
- * @throws IllegalStateException if not exactly one
- * LayoutManager is available for the requested node
*/
- public LayoutManager makeLayoutManager(FONode node);
+ LayoutManager makeLayoutManager(FONode node);
/**
* Make a PageSequenceLayoutManager object.
@@ -59,7 +58,7 @@ public interface LayoutManagerMaker {
* @param ps the fo:page-sequence object this PSLM will process
* @return The created PageSequenceLayoutManager object
*/
- public PageSequenceLayoutManager makePageSequenceLayoutManager(
+ PageSequenceLayoutManager makePageSequenceLayoutManager(
AreaTreeHandler ath, PageSequence ps);
/**
@@ -68,7 +67,7 @@ public interface LayoutManagerMaker {
* @param ed the fox:external-document object to be processed
* @return The created ExternalDocumentLayoutManager object
*/
- public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager(
+ ExternalDocumentLayoutManager makeExternalDocumentLayoutManager(
AreaTreeHandler ath, ExternalDocument ed);
/**
@@ -77,7 +76,7 @@ public interface LayoutManagerMaker {
* @param flow the fo:flow object this FLM will process
* @return The created FlowLayoutManager object
*/
- public FlowLayoutManager makeFlowLayoutManager(
+ FlowLayoutManager makeFlowLayoutManager(
PageSequenceLayoutManager pslm, Flow flow);
/**
@@ -86,7 +85,7 @@ public interface LayoutManagerMaker {
* @param title the fo:title object this CLM will process
* @return The created ContentLayoutManager object
*/
- public ContentLayoutManager makeContentLayoutManager(
+ ContentLayoutManager makeContentLayoutManager(
PageSequenceLayoutManager pslm, Title title);
/**
@@ -97,7 +96,7 @@ public interface LayoutManagerMaker {
* needs to be processed.
* @return The created StaticContentLayoutManager object
*/
- public StaticContentLayoutManager makeStaticContentLayoutManager(
+ StaticContentLayoutManager makeStaticContentLayoutManager(
PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg);
/**
@@ -107,7 +106,7 @@ public interface LayoutManagerMaker {
* @param block the Block area this SCLM must add its areas to
* @return The created StaticContentLayoutManager object
*/
- public StaticContentLayoutManager makeStaticContentLayoutManager(
+ StaticContentLayoutManager makeStaticContentLayoutManager(
PageSequenceLayoutManager pslm, StaticContent sc, Block block);
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Tue Aug 17 18:57:04 2010
@@ -67,14 +67,12 @@ import org.apache.fop.fo.pagination.Side
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.layoutmgr.inline.BasicLinkLayoutManager;
-import org.apache.fop.layoutmgr.inline.BidiLayoutManager;
import org.apache.fop.layoutmgr.inline.CharacterLayoutManager;
import org.apache.fop.layoutmgr.inline.ContentLayoutManager;
import org.apache.fop.layoutmgr.inline.ExternalGraphicLayoutManager;
import org.apache.fop.layoutmgr.inline.FootnoteLayoutManager;
import org.apache.fop.layoutmgr.inline.ICLayoutManager;
import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
-import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.layoutmgr.inline.InstreamForeignObjectLM;
import org.apache.fop.layoutmgr.inline.LeaderLayoutManager;
import org.apache.fop.layoutmgr.inline.PageNumberCitationLastLayoutManager;
@@ -93,11 +91,12 @@ import org.apache.fop.util.CharUtilities
public class LayoutManagerMapping implements LayoutManagerMaker {
/** logging instance */
- protected static Log log = LogFactory.getLog(LayoutManagerMapping.class);
+ private static final Log LOG = LogFactory.getLog(LayoutManagerMapping.class);
/** The map of LayoutManagerMakers */
private Map makers = new HashMap();
+ /** default constructor */
public LayoutManagerMapping() {
initialize();
}
@@ -152,17 +151,15 @@ public class LayoutManagerMapping implem
makers.put(clazz, maker);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void makeLayoutManagers(FONode node, List lms) {
Maker maker = (Maker) makers.get(node.getClass());
if (maker == null) {
if (FOElementMapping.URI.equals(node.getNamespaceURI())) {
- log.error("No LayoutManager maker for class " + node.getClass());
+ LOG.error("No LayoutManager maker for class " + node.getClass());
} else {
- if (log.isDebugEnabled()) {
- log.debug("Skipping the creation of a layout manager for " + node.getClass());
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Skipping the creation of a layout manager for " + node.getClass());
}
}
} else {
@@ -170,9 +167,7 @@ public class LayoutManagerMapping implem
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public LayoutManager makeLayoutManager(FONode node) {
List lms = new ArrayList();
makeLayoutManagers(node, lms);
@@ -188,30 +183,31 @@ public class LayoutManagerMapping implem
return (LayoutManager) lms.get(0);
}
+ /** {@inheritDoc} */
public PageSequenceLayoutManager makePageSequenceLayoutManager(
AreaTreeHandler ath, PageSequence ps) {
return new PageSequenceLayoutManager(ath, ps);
}
- /*
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager(
+ AreaTreeHandler ath, ExternalDocument ed) {
+ return new ExternalDocumentLayoutManager(ath, ed);
+ }
+
+ /** {@inheritDoc} */
public FlowLayoutManager makeFlowLayoutManager(
PageSequenceLayoutManager pslm, Flow flow) {
return new FlowLayoutManager(pslm, flow);
}
- /*
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public ContentLayoutManager makeContentLayoutManager(PageSequenceLayoutManager pslm,
Title title) {
return new ContentLayoutManager(pslm, title);
}
- /*
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public StaticContentLayoutManager makeStaticContentLayoutManager(
PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg) {
return new StaticContentLayoutManager(pslm, sc, reg);
@@ -223,13 +219,21 @@ public class LayoutManagerMapping implem
return new StaticContentLayoutManager(pslm, sc, block);
}
+ /** a layout manager maker base class */
public static class Maker {
+ /**
+ * Create a layout manager.
+ * @param node the associated FO node
+ * @param lms a list of layout managers to which new manager is to be added
+ */
public void make(FONode node, List lms) {
// no layout manager
}
}
+ /** a layout manager maker */
public static class FOTextLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
FOText foText = (FOText) node;
if (foText.length() > 0) {
@@ -238,9 +242,11 @@ public class LayoutManagerMapping implem
}
}
+ /** a layout manager maker */
public static class BidiOverrideLayoutManagerMaker extends Maker {
- // public static class BidiOverrideLayoutManagerMaker extends FObjMixedLayoutManagerMaker {
- public void make(BidiOverride node, List lms) {
+ /** {@inheritDoc} */
+ public void make(FONode node, List lms) {
+ /* [GA] remove broken code
if (false) {
// this is broken; it does nothing
// it should make something like an InlineStackingLM
@@ -254,29 +260,36 @@ public class LayoutManagerMapping implem
LayoutManager lm = (LayoutManager) childList.get(count);
if (lm instanceof InlineLevelLayoutManager) {
LayoutManager blm = new BidiLayoutManager
- (node, (InlineLayoutManager) lm);
+ ((BidiOverride) node, (InlineLayoutManager) lm);
lms.add(blm);
} else {
lms.add(lm);
}
}
}
+ */
}
}
+ /** a layout manager maker */
public static class InlineLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new InlineLayoutManager((InlineLevel) node));
}
}
+ /** a layout manager maker */
public static class FootnodeLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new FootnoteLayoutManager((Footnote) node));
}
}
+ /** a layout manager maker */
public static class InlineContainerLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
ArrayList childList = new ArrayList();
super.make(node, childList);
@@ -284,25 +297,33 @@ public class LayoutManagerMapping implem
}
}
+ /** a layout manager maker */
public static class BasicLinkLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new BasicLinkLayoutManager((BasicLink) node));
}
}
+ /** a layout manager maker */
public static class BlockLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new BlockLayoutManager((Block) node));
}
}
+ /** a layout manager maker */
public static class LeaderLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new LeaderLayoutManager((Leader) node));
}
}
+ /** a layout manager maker */
public static class CharacterLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
Character foCharacter = (Character) node;
if (foCharacter.getCharacter() != CharUtilities.CODE_EOT) {
@@ -311,7 +332,9 @@ public class LayoutManagerMapping implem
}
}
+ /** a layout manager maker */
public static class ExternalGraphicLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
ExternalGraphic eg = (ExternalGraphic) node;
if (!eg.getSrc().equals("")) {
@@ -320,49 +343,65 @@ public class LayoutManagerMapping implem
}
}
+ /** a layout manager maker */
public static class BlockContainerLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new BlockContainerLayoutManager((BlockContainer) node));
}
}
+ /** a layout manager maker */
public static class ListItemLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new ListItemLayoutManager((ListItem) node));
}
}
+ /** a layout manager maker */
public static class ListBlockLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new ListBlockLayoutManager((ListBlock) node));
}
}
+ /** a layout manager maker */
public static class InstreamForeignObjectLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new InstreamForeignObjectLM((InstreamForeignObject) node));
}
}
+ /** a layout manager maker */
public static class PageNumberLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new PageNumberLayoutManager((PageNumber) node));
}
}
+ /** a layout manager maker */
public static class PageNumberCitationLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new PageNumberCitationLayoutManager((PageNumberCitation) node));
}
}
+ /** a layout manager maker */
public static class PageNumberCitationLastLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
lms.add(new PageNumberCitationLastLayoutManager((PageNumberCitationLast) node));
}
}
+ /** a layout manager maker */
public static class TableLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
Table table = (Table) node;
TableLayoutManager tlm = new TableLayoutManager(table);
@@ -370,7 +409,9 @@ public class LayoutManagerMapping implem
}
}
+ /** a layout manager maker */
public class RetrieveMarkerLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
Iterator baseIter;
baseIter = node.getChildNodes();
@@ -384,7 +425,9 @@ public class LayoutManagerMapping implem
}
}
+ /** a layout manager maker */
public class WrapperLayoutManagerMaker extends Maker {
+ /** {@inheritDoc} */
public void make(FONode node, List lms) {
//We insert the wrapper LM before it's children so an ID
//on the node can be registered on a page.
@@ -401,9 +444,4 @@ public class LayoutManagerMapping implem
}
}
- public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager(
- AreaTreeHandler ath, ExternalDocument ed) {
- return new ExternalDocumentLayoutManager(ath, ed);
- }
-
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LeafPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LeafPosition.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LeafPosition.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/LeafPosition.java Tue Aug 17 18:57:04 2010
@@ -19,24 +19,38 @@
package org.apache.fop.layoutmgr;
+/** A leaf position. */
public class LeafPosition extends Position {
private int leafPos;
+ /**
+ * Construct a leaf position.
+ * @param layoutManager the associated layout manager
+ * @param pos the leaf position
+ */
public LeafPosition(LayoutManager layoutManager, int pos) {
super(layoutManager);
leafPos = pos;
}
+ /**
+ * Construct a leaf position.
+ * @param layoutManager the associated layout manager
+ * @param pos the leaf position
+ * @param index the index
+ */
public LeafPosition(LayoutManager layoutManager, int pos, int index) {
super(layoutManager, index);
leafPos = pos;
}
+ /** @return leaf position */
public int getLeafPos() {
return leafPos;
}
+ /** {@inheritDoc} */
public boolean generatesAreas() {
return getLM() != null;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java Tue Aug 17 18:57:04 2010
@@ -19,19 +19,27 @@
package org.apache.fop.layoutmgr;
+/** A non-leaf position. */
public class NonLeafPosition extends Position {
private Position subPos;
+ /**
+ * Construct a leaf position.
+ * @param lm the associated layout manager
+ * @param sub the position
+ */
public NonLeafPosition(LayoutManager lm, Position sub) {
super(lm);
subPos = sub;
}
+ /** @return the sub position */
public Position getPosition() {
return subPos;
}
+ /** {@inheritDoc} */
public boolean generatesAreas() {
return (subPos != null ? subPos.generatesAreas() : false);
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreaker.java Tue Aug 17 18:57:04 2010
@@ -54,6 +54,10 @@ public class PageBreaker extends Abstrac
private StaticContentLayoutManager footnoteSeparatorLM = null;
+ /**
+ * Construct page breaker.
+ * @param pslm the page sequence layout manager
+ */
public PageBreaker(PageSequenceLayoutManager pslm) {
this.pslm = pslm;
this.pageProvider = pslm.getPageProvider();
@@ -382,7 +386,8 @@ public class PageBreaker extends Abstrac
+ " pageBreaks.size()= " + algRestart.getPageBreaks().size());
boolean fitsOnePage
- = optimalPageCount <= pslm.getCurrentPV().getBodyRegion().getMainReference().getCurrentSpan().getColumnCount();
+ = optimalPageCount <= pslm.getCurrentPV()
+ .getBodyRegion().getMainReference().getCurrentSpan().getColumnCount();
if (needColumnBalancing) {
if (!fitsOnePage) {
@@ -411,6 +416,7 @@ public class PageBreaker extends Abstrac
addAreas(algRestart, optimalPageCount, originalList, effectiveList);
}
+ /** {@inheritDoc} */
protected void startPart(BlockSequence list, int breakClass) {
AbstractBreaker.log.debug("startPart() breakClass=" + getBreakClassName(breakClass));
if (pslm.getCurrentPage() == null) {
@@ -442,6 +448,7 @@ public class PageBreaker extends Abstrac
pslm.getCurrentPV().getPage().fakeNonEmpty();
}
+ /** {@inheritDoc} */
protected void finishPart(PageBreakingAlgorithm alg, PageBreakPosition pbp) {
// add footnote areas
if (pbp.footnoteFirstListIndex < pbp.footnoteLastListIndex
@@ -473,7 +480,7 @@ public class PageBreaker extends Abstrac
pslm.getCurrentPV().getCurrentSpan().notifyFlowsFinished();
}
- /** @return the current child flow layout manager */
+ /** {@inheritDoc} */
protected LayoutManager getCurrentChildLM() {
return childFLM;
}
@@ -546,7 +553,8 @@ public class PageBreaker extends Abstrac
* @param breakVal - value of break-before or break-after trait.
*/
private boolean needBlankPageBeforeNew(int breakVal) {
- if (breakVal == Constants.EN_PAGE || (pslm.getCurrentPage().getPageViewport().getPage().isEmpty())) {
+ if (breakVal == Constants.EN_PAGE
+ || (pslm.getCurrentPage().getPageViewport().getPage().isEmpty())) {
// any page is OK or we already have an empty page
return false;
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org