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 [8/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/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Tue Aug 17 18:57:04 2010
@@ -103,8 +103,26 @@ class PageBreakingAlgorithm extends Brea
private int currentKeepContext = Constants.EN_AUTO;
private KnuthNode lastBeforeKeepContextSwitch;
-
- public PageBreakingAlgorithm(LayoutManager topLevelLM,
+ /**
+ * Construct a page 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 autoHeight true if auto height
+ * @param favorSinglePart true if favoring single part
+ * @see BreakingAlgorithm
+ */
+ public PageBreakingAlgorithm(LayoutManager topLevelLM, // CSOK: ParameterNumber
PageProvider pageProvider,
PageBreakingLayoutListener layoutListener,
int alignment, int alignmentLast,
@@ -128,15 +146,16 @@ class PageBreakingAlgorithm extends Brea
protected class KnuthPageNode extends KnuthNode {
/** Additional length due to footnotes. */
- public int totalFootnotes;
+ public int totalFootnotes; // CSOK: VisibilityModifier
/** Index of the last inserted footnote. */
- public int footnoteListIndex;
+ public int footnoteListIndex; // CSOK: VisibilityModifier
/** Index of the last inserted element of the last inserted footnote. */
- public int footnoteElementIndex;
+ public int footnoteElementIndex; // CSOK: VisibilityModifier
- public KnuthPageNode(int position, int line, int fitness,
+ public KnuthPageNode(int position, // CSOK: ParameterNumber
+ int line, int fitness,
int totalWidth, int totalStretch, int totalShrink,
int totalFootnotes, int footnoteListIndex, int footnoteElementIndex,
double adjustRatio, int availableShrink, int availableStretch,
@@ -206,7 +225,8 @@ class PageBreakingAlgorithm extends Brea
log.debug("Recovering from too long: " + lastTooLong);
log.debug("\tlastTooShort = " + getLastTooShort());
log.debug("\tlastBeforeKeepContextSwitch = " + lastBeforeKeepContextSwitch);
- log.debug("\tcurrentKeepContext = " + AbstractBreaker.getBreakClassName(currentKeepContext));
+ log.debug("\tcurrentKeepContext = "
+ + AbstractBreaker.getBreakClassName(currentKeepContext));
}
if (lastBeforeKeepContextSwitch == null
@@ -261,7 +281,8 @@ class PageBreakingAlgorithm extends Brea
}
/** {@inheritDoc} */
- protected KnuthNode createNode(int position, int line, int fitness,
+ protected KnuthNode createNode(int position, // CSOK: ParameterNumber
+ int line, int fitness,
int totalWidth, int totalStretch, int totalShrink,
double adjustRatio, int availableShrink, int availableStretch,
int difference, double totalDemerits, KnuthNode previous) {
@@ -473,7 +494,7 @@ class PageBreakingAlgorithm extends Brea
KnuthPageNode pageNode = (KnuthPageNode) activeNode;
int actualWidth = totalWidth - pageNode.totalWidth;
int footnoteSplit = 0;
- boolean canDeferOldFootnotes;
+ boolean canDeferOldFN;
if (element.isPenalty()) {
actualWidth += element.getWidth();
}
@@ -492,11 +513,12 @@ class PageBreakingAlgorithm extends Brea
footnoteListIndex = footnotesList.size() - 1;
footnoteElementIndex
= getFootnoteList(footnoteListIndex).size() - 1;
- } else if (((canDeferOldFootnotes
- = checkCanDeferOldFootnotes(pageNode, elementIndex))
+ } else if (((canDeferOldFN = canDeferOldFootnotes // CSOK: InnerAssignment
+ (pageNode, elementIndex))
|| newFootnotes)
- && (footnoteSplit = getFootnoteSplit(pageNode,
- getLineWidth(activeNode.line) - actualWidth, canDeferOldFootnotes)) > 0) {
+ && (footnoteSplit = getFootnoteSplit // CSOK: InnerAssignment
+ (pageNode, getLineWidth(activeNode.line) - actualWidth,
+ canDeferOldFN)) > 0) {
// it is allowed to break or even defer footnotes if either:
// - there are new footnotes in the last piece of content, and
// there is space to add at least a piece of the first one
@@ -541,7 +563,7 @@ class PageBreakingAlgorithm extends Brea
* @param contentElementIndex index of the Knuth element considered for the
* current page break
*/
- private boolean checkCanDeferOldFootnotes(KnuthPageNode node, int contentElementIndex) {
+ private boolean canDeferOldFootnotes(KnuthPageNode node, int contentElementIndex) {
return (noBreakBetween(node.position, contentElementIndex)
&& deferredFootnotes(node.footnoteListIndex,
node.footnoteElementIndex, node.totalFootnotes));
@@ -584,7 +606,8 @@ class PageBreakingAlgorithm extends Brea
index++) {
if (par.getElement(index).isGlue() && par.getElement(index - 1).isBox()
|| par.getElement(index).isPenalty()
- && ((KnuthElement) par.getElement(index)).getPenalty() < KnuthElement.INFINITE) {
+ && ((KnuthElement) par
+ .getElement(index)).getPenalty() < KnuthElement.INFINITE) {
// break found
break;
}
@@ -865,8 +888,9 @@ class PageBreakingAlgorithm extends Brea
insertedFootnotesLength = tmpLength;
footnoteElementIndex
= getFootnoteList(footnoteListIndex).size() - 1;
- } else if ((split = getFootnoteSplit(footnoteListIndex, footnoteElementIndex,
- insertedFootnotesLength, availableBPD, true)) > 0) {
+ } else if ((split = getFootnoteSplit // CSOK: InnerAssignment
+ (footnoteListIndex, footnoteElementIndex,
+ insertedFootnotesLength, availableBPD, true)) > 0) {
// add a piece of a footnote
availableBPD -= split;
insertedFootnotesLength += split;
@@ -1101,7 +1125,7 @@ class PageBreakingAlgorithm extends Brea
*/
protected void addNode(int line, KnuthNode node) {
if (node.position < par.size() - 1 && line > 0
- && (ipdDifference = compareIPDs(line - 1)) != 0) {
+ && (ipdDifference = compareIPDs(line - 1)) != 0) { // CSOK: InnerAssignment
log.trace("IPD changes at page " + line);
if (bestNodeForIPDChange == null
|| node.totalDemerits < bestNodeForIPDChange.totalDemerits) {
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Position.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Position.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Position.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/Position.java Tue Aug 17 18:57:04 2010
@@ -19,20 +19,30 @@
package org.apache.fop.layoutmgr;
+/** A position. */
public class Position {
private LayoutManager layoutManager;
private int index = -1;
+ /**
+ * Construct a position.
+ * @param lm the associated layout manager
+ */
public Position(LayoutManager lm) {
layoutManager = lm;
}
+ /**
+ * Construct a position.
+ * @param lm the associated layout manager
+ * @param index the index
+ */
public Position(LayoutManager lm, int index) {
this(lm);
setIndex(index);
}
-
+ /** @return associated layout manager */
public LayoutManager getLM() {
return layoutManager;
}
@@ -40,11 +50,13 @@ public class Position {
/**
* Overridden by NonLeafPosition to return the Position of its
* child LM.
+ * @return a position or null
*/
public Position getPosition() {
return null;
}
+ /** @return true if generates areas */
public boolean generatesAreas() {
return false;
}
@@ -67,12 +79,13 @@ public class Position {
return this.index;
}
- public String getShortLMName() {
+ /** @return short name of associated layout manager */
+ protected String getShortLMName() {
if (getLM() != null) {
String lm = getLM().toString();
int idx = lm.lastIndexOf('.');
if (idx >= 0 && lm.indexOf('@') > 0) {
- return(lm.substring(idx + 1));
+ return lm.substring(idx + 1);
} else {
return lm;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PositionIterator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PositionIterator.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PositionIterator.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/PositionIterator.java Tue Aug 17 18:57:04 2010
@@ -22,6 +22,7 @@ package org.apache.fop.layoutmgr;
import java.util.Iterator;
import java.util.NoSuchElementException;
+/** A position iterator. */
public abstract class PositionIterator implements Iterator {
private Iterator parentIter;
@@ -29,12 +30,17 @@ public abstract class PositionIterator i
private LayoutManager childLM;
private boolean bHasNext;
+ /**
+ * Construct position iterator.
+ * @param pIter an iterator to use as parent
+ */
protected PositionIterator(Iterator pIter) {
parentIter = pIter;
lookAhead();
//checkNext();
}
+ /** @return layout manager of next child layout manager or null */
public LayoutManager getNextChildLM() {
// Move to next "segment" of iterator, ie: new childLM
if (childLM == null && nextObj != null) {
@@ -44,8 +50,16 @@ public abstract class PositionIterator i
return childLM;
}
+ /**
+ * @param nextObj next object from which to obtain position
+ * @return layout manager
+ */
protected abstract LayoutManager getLM(Object nextObj);
+ /**
+ * @param nextObj next object from which to obtain position
+ * @return position of next object
+ */
protected abstract Position getPos(Object nextObj);
private void lookAhead() {
@@ -57,6 +71,7 @@ public abstract class PositionIterator i
}
}
+ /** @return true if not at end of sub-sequence with same child layout manager */
protected boolean checkNext() {
LayoutManager lm = getLM(nextObj);
if (childLM == null) {
@@ -70,17 +85,20 @@ public abstract class PositionIterator i
return true;
}
+ /** end (reset) iterator */
protected void endIter() {
bHasNext = false;
nextObj = null;
childLM = null;
}
+ /** {@inheritDoc} */
public boolean hasNext() {
return (bHasNext && checkNext());
}
+ /** {@inheritDoc} */
public Object next() throws NoSuchElementException {
if (bHasNext) {
Object retObj = getPos(nextObj);
@@ -91,10 +109,12 @@ public abstract class PositionIterator i
}
}
+ /** @return peek at next object */
public Object peekNext() {
return nextObj;
}
+ /** {@inheritDoc} */
public void remove() throws UnsupportedOperationException {
throw new UnsupportedOperationException("PositionIterator doesn't support remove");
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceResolver.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceResolver.java Tue Aug 17 18:57:04 2010
@@ -32,10 +32,10 @@ import org.apache.fop.traits.MinOptMax;
* UnresolvedListElements descendants by the right combination of KnuthElements on an element
* list.
*/
-public class SpaceResolver {
+public final class SpaceResolver {
/** Logger instance */
- protected static Log log = LogFactory.getLog(SpaceResolver.class);
+ private static final Log LOG = LogFactory.getLog(SpaceResolver.class);
private UnresolvedListElementWithLength[] firstPart;
private BreakElement breakPoss;
@@ -93,25 +93,25 @@ public class SpaceResolver {
//Add pending elements from higher level FOs
if (breakPoss != null) {
if (breakPoss.getPendingAfterMarks() != null) {
- if (log.isTraceEnabled()) {
- log.trace(" adding pending before break: "
+ if (LOG.isTraceEnabled()) {
+ LOG.trace(" adding pending before break: "
+ breakPoss.getPendingAfterMarks());
}
first.addAll(0, breakPoss.getPendingAfterMarks());
}
if (breakPoss.getPendingBeforeMarks() != null) {
- if (log.isTraceEnabled()) {
- log.trace(" adding pending after break: "
+ if (LOG.isTraceEnabled()) {
+ LOG.trace(" adding pending after break: "
+ breakPoss.getPendingBeforeMarks());
}
second.addAll(0, breakPoss.getPendingBeforeMarks());
}
}
- if (log.isTraceEnabled()) {
- log.trace("before: " + first);
- log.trace(" break: " + breakPoss);
- log.trace("after: " + second);
- log.trace("NO-BREAK: " + toString(noBreak, noBreakLengths));
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("before: " + first);
+ LOG.trace(" break: " + breakPoss);
+ LOG.trace("after: " + second);
+ LOG.trace("NO-BREAK: " + toString(noBreak, noBreakLengths));
}
if (first != null) {
@@ -163,15 +163,15 @@ public class SpaceResolver {
if (elems[effIndex] instanceof BorderOrPaddingElement) {
BorderOrPaddingElement bop = (BorderOrPaddingElement)elems[effIndex];
if (bop.isConditional() && !(bop.isFirst() || bop.isLast())) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling conditional element: " + bop);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling conditional element: " + bop);
}
lengths[effIndex] = null;
}
}
}
- if (log.isTraceEnabled() && elems.length > 0) {
- log.trace("-->Resulting list: " + toString(elems, lengths));
+ if (LOG.isTraceEnabled() && elems.length > 0) {
+ LOG.trace("-->Resulting list: " + toString(elems, lengths));
}
}
@@ -193,20 +193,20 @@ public class SpaceResolver {
} else if (!elems[effIndex].isConditional()) {
break;
}
- if (log.isDebugEnabled()) {
- log.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling conditional element using 4.3.1, rule 1: " + elems[effIndex]);
}
lengths[effIndex] = null;
}
- if (log.isTraceEnabled() && elems.length > 0) {
- log.trace("-->Resulting list: " + toString(elems, lengths));
+ if (LOG.isTraceEnabled() && elems.length > 0) {
+ LOG.trace("-->Resulting list: " + toString(elems, lengths));
}
}
private void performSpaceResolutionRules2to3(UnresolvedListElement[] elems,
MinOptMax[] lengths, int start, int end) {
- if (log.isTraceEnabled()) {
- log.trace("rule 2-3: " + start + "-" + end);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("rule 2-3: " + start + "-" + end);
}
SpaceElement space;
int remaining;
@@ -235,8 +235,8 @@ public class SpaceResolver {
}
space = (SpaceElement)elems[i];
if (!space.isForcing()) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling non-forcing space-specifier using 4.3.1, rule 2: "
+ elems[i]);
}
lengths[i] = null;
@@ -255,8 +255,8 @@ public class SpaceResolver {
space = (SpaceElement)elems[i];
highestPrecedence = Math.max(highestPrecedence, space.getPrecedence());
}
- if (highestPrecedence != 0 && log.isDebugEnabled()) {
- log.debug("Highest precedence is " + highestPrecedence);
+ if (highestPrecedence != 0 && LOG.isDebugEnabled()) {
+ LOG.debug("Highest precedence is " + highestPrecedence);
}
//Suppress space-specifiers with lower precedence
remaining = 0;
@@ -267,8 +267,8 @@ public class SpaceResolver {
}
space = (SpaceElement)elems[i];
if (space.getPrecedence() != highestPrecedence) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling space-specifier with precedence "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling space-specifier with precedence "
+ space.getPrecedence() + " using 4.3.1, rule 3: "
+ elems[i]);
}
@@ -278,8 +278,8 @@ public class SpaceResolver {
remaining++;
}
}
- if (log.isDebugEnabled()) {
- log.debug("Greatest optimum: " + greatestOptimum);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Greatest optimum: " + greatestOptimum);
}
if (remaining <= 1) {
return;
@@ -292,8 +292,8 @@ public class SpaceResolver {
}
space = (SpaceElement)elems[i];
if (space.getLength().getOpt() < greatestOptimum) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling space-specifier with smaller optimum length "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling space-specifier with smaller optimum length "
+ "using 4.3.1, rule 3: "
+ elems[i]);
}
@@ -316,8 +316,8 @@ public class SpaceResolver {
min = Math.max(min, space.getLength().getMin());
max = Math.min(max, space.getLength().getMax());
if (remaining > 1) {
- if (log.isDebugEnabled()) {
- log.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: "
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Nulling non-last space-specifier using 4.3.1, rule 3, second part: "
+ elems[i]);
}
lengths[i] = null;
@@ -327,9 +327,9 @@ public class SpaceResolver {
}
}
- if (log.isTraceEnabled() && elems.length > 0) {
- log.trace("Remaining spaces: " + remaining);
- log.trace("-->Resulting list: " + toString(elems, lengths));
+ if (LOG.isTraceEnabled() && elems.length > 0) {
+ LOG.trace("Remaining spaces: " + remaining);
+ LOG.trace("-->Resulting list: " + toString(elems, lengths));
}
}
@@ -389,7 +389,7 @@ public class SpaceResolver {
if (hasFirstPart()) {
//Now that we've handled isFirst/isLast conditions, we need to look at the
//active part in its normal order so swap it back.
- log.trace("Swapping first and second parts.");
+ LOG.trace("Swapping first and second parts.");
UnresolvedListElementWithLength[] tempList;
MinOptMax[] tempLengths;
tempList = secondPart;
@@ -439,7 +439,8 @@ public class SpaceResolver {
}
// No break
- // TODO: We can't use a MinOptMax for glue2, because min <= opt <= max is not always true - why?
+ // TODO: We can't use a MinOptMax for glue2,
+ // because min <= opt <= max is not always true - why?
MinOptMax noBreakLength = sum(noBreakLengths);
MinOptMax spaceSum = spaceBeforeBreak.plus(spaceAfterBreak);
int glue2width = noBreakLength.getOpt() - spaceSum.getOpt();
@@ -543,6 +544,7 @@ public class SpaceResolver {
return this.originalPosition;
}
+ /** {@inheritDoc} */
public Position getPosition() {
return originalPosition;
}
@@ -595,8 +597,8 @@ public class SpaceResolver {
* @param elems the element list
*/
public static void resolveElementList(List elems) {
- if (log.isTraceEnabled()) {
- log.trace(elems);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace(elems);
}
boolean first = true;
boolean last = false;
@@ -608,8 +610,8 @@ public class SpaceResolver {
while (iter.hasNext()) {
ListElement el = (ListElement)iter.next();
if (el.isUnresolvedElement()) {
- if (log.isTraceEnabled()) {
- log.trace("unresolved found: " + el + " " + first + "/" + last);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("unresolved found: " + el + " " + first + "/" + last);
}
BreakElement breakPoss = null;
//Clear temp lists
@@ -646,7 +648,7 @@ public class SpaceResolver {
}
//last = !iter.hasNext();
if (breakPoss == null && unresolvedSecond.size() == 0 && !last) {
- log.trace("Swap first and second parts in no-break condition,"
+ LOG.trace("Swap first and second parts in no-break condition,"
+ " second part is empty.");
//The first list is reversed, so swap if this shouldn't happen
List swapList = unresolvedSecond;
@@ -654,7 +656,7 @@ public class SpaceResolver {
unresolvedFirst = swapList;
}
- log.debug("----start space resolution (first=" + first + ", last=" + last + ")...");
+ LOG.debug("----start space resolution (first=" + first + ", last=" + last + ")...");
SpaceResolver resolver = new SpaceResolver(
unresolvedFirst, breakPoss, unresolvedSecond, first, last);
if (!last) {
@@ -664,7 +666,7 @@ public class SpaceResolver {
if (!last && skipNextElement) {
iter.next();
}
- log.debug("----end space resolution.");
+ LOG.debug("----end space resolution.");
}
first = false;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java Tue Aug 17 18:57:04 2010
@@ -155,6 +155,7 @@ public class SpaceSpecifier implements C
return resolvedSpace;
}
+ /** {@inheritDoc} */
public String toString() {
return "Space Specifier (resolved at begin/end of ref. area:):\n"
+ resolve(false) + "\n" + resolve(true);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -33,18 +33,18 @@ public interface TopLevelLayoutManager {
* page sequence will be created and sent to the AreaTreeModel
* for rendering.
*/
- public void activateLayout();
+ void activateLayout();
/**
* Act upon the force-page-count trait,
* in relation to the initial-page-number trait of the following page-sequence.
* @param nextPageSeqInitialPageNumber initial-page-number trait of next page-sequence
*/
- public void doForcePageCount(Numeric nextPageSeqInitialPageNumber);
+ void doForcePageCount(Numeric nextPageSeqInitialPageNumber);
/**
* Finished the page-sequence and notifies everyone about it.
*/
- public void finishPageSequence();
+ void finishPageSequence();
}
\ No newline at end of file
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TraitSetter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TraitSetter.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TraitSetter.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/TraitSetter.java Tue Aug 17 18:57:04 2010
@@ -39,10 +39,13 @@ import org.apache.fop.traits.MinOptMax;
/**
* This is a helper class used for setting common traits on areas.
*/
-public class TraitSetter {
+public final class TraitSetter {
+
+ private TraitSetter() {
+ }
/** logger */
- protected static Log log = LogFactory.getLog(TraitSetter.class);
+ private static final Log LOG = LogFactory.getLog(TraitSetter.class);
/**
* Sets border and padding traits on areas.
@@ -339,7 +342,7 @@ public class TraitSetter {
+ backProps.backgroundPositionHorizontal.getValue(refContext));
} else {
// TODO Area IPD has to be set for this to work
- log.warn("Horizontal background image positioning ignored"
+ LOG.warn("Horizontal background image positioning ignored"
+ " because the IPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
@@ -356,7 +359,7 @@ public class TraitSetter {
+ backProps.backgroundPositionVertical.getValue(refContext));
} else {
// TODO Area BPD has to be set for this to work
- log.warn("Vertical background image positioning ignored"
+ LOG.warn("Vertical background image positioning ignored"
+ " because the BPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
@@ -407,7 +410,7 @@ public class TraitSetter {
back.setHoriz(horizontal);
} else {
//TODO Area IPD has to be set for this to work
- log.warn("Horizontal background image positioning ignored"
+ LOG.warn("Horizontal background image positioning ignored"
+ " because the IPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
@@ -431,7 +434,7 @@ public class TraitSetter {
back.setVertical(vertical);
} else {
//TODO Area BPD has to be set for this to work
- log.warn("Vertical background image positioning ignored"
+ LOG.warn("Vertical background image positioning ignored"
+ " because the BPD was not set on the area."
+ " (Yes, it's a bug in FOP)");
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -30,7 +30,6 @@ import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
@@ -99,10 +98,9 @@ public abstract class AbstractPageNumber
}
/**
- * If id can be resolved then simply return a word, otherwise
+ * If id can be resolved then simply return a text area, otherwise
* return a resolvable area
*
- * @param parentLM the parent LayoutManager
* @return a corresponding InlineArea
*/
private InlineArea getPageNumberCitationInlineArea() {
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java Tue Aug 17 18:57:04 2010
@@ -237,6 +237,8 @@ public class AlignmentContext implements
case EN_MATHEMATICAL:
this.alignmentBaselineIdentifier = alignmentBaseline;
break;
+ default:
+ break;
}
}
@@ -307,7 +309,6 @@ public class AlignmentContext implements
* Calculates the baseline shift value based on the baseline-shift
* property value.
* @param baselineShift the baseline shift property value
- * @return the computed baseline shift value
*/
private void setBaselineShift(Length baselineShift) {
baselineShiftValue = 0;
@@ -331,6 +332,9 @@ public class AlignmentContext implements
, LengthBase.CUSTOM_BASE
, parentAlignmentContext.getLineHeight()));
break;
+ default:
+ break;
+
}
}
@@ -354,10 +358,12 @@ public class AlignmentContext implements
return parentAlignmentContext.getScaledBaselineTable()
.getBaseline(alignmentBaselineIdentifier)
- scaledBaselineTable
- .deriveScaledBaselineTable(parentAlignmentContext.getDominantBaselineIdentifier())
+ .deriveScaledBaselineTable(parentAlignmentContext
+ .getDominantBaselineIdentifier())
.getBaseline(alignmentBaselineIdentifier)
- scaledBaselineTable
- .getBaseline(parentAlignmentContext.getDominantBaselineIdentifier())
+ .getBaseline(parentAlignmentContext
+ .getDominantBaselineIdentifier())
+ baselineShiftValue;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java Tue Aug 17 18:57:04 2010
@@ -21,9 +21,7 @@ package org.apache.fop.layoutmgr.inline;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.SimplePercentBaseContext;
+
import org.apache.fop.fo.Constants;
@@ -96,39 +94,44 @@ public class BasicScaledBaselineTable im
* @return the baseline offset
*/
public int getBaseline(int baselineIdentifier) {
- int offset = 0;
+ int offset;
if (!isHorizontalWritingMode()) {
switch (baselineIdentifier) {
+ default:
case EN_TOP:
case EN_TEXT_TOP:
case EN_TEXT_BOTTOM:
case EN_BOTTOM:
log.warn("The given baseline is only supported for horizontal"
+ " writing modes");
- return 0;
+ offset = 0;
+ }
+ } else {
+ switch (baselineIdentifier) {
+ case EN_TOP: // fall through
+ case EN_BEFORE_EDGE:
+ offset = beforeEdgeOffset;
+ break;
+ case EN_TEXT_TOP:
+ case EN_TEXT_BEFORE_EDGE:
+ case EN_HANGING:
+ case EN_CENTRAL:
+ case EN_MIDDLE:
+ case EN_MATHEMATICAL:
+ case EN_ALPHABETIC:
+ case EN_IDEOGRAPHIC:
+ case EN_TEXT_BOTTOM:
+ case EN_TEXT_AFTER_EDGE:
+ offset = getBaselineDefaultOffset(baselineIdentifier) - dominantBaselineOffset;
+ break;
+ case EN_BOTTOM: // fall through
+ case EN_AFTER_EDGE:
+ offset = afterEdgeOffset;
+ break;
+ default:
+ offset = 0;
+ break;
}
- }
- switch (baselineIdentifier) {
- case EN_TOP: // fall through
- case EN_BEFORE_EDGE:
- offset = beforeEdgeOffset;
- break;
- case EN_TEXT_TOP:
- case EN_TEXT_BEFORE_EDGE:
- case EN_HANGING:
- case EN_CENTRAL:
- case EN_MIDDLE:
- case EN_MATHEMATICAL:
- case EN_ALPHABETIC:
- case EN_IDEOGRAPHIC:
- case EN_TEXT_BOTTOM:
- case EN_TEXT_AFTER_EDGE:
- offset = getBaselineDefaultOffset(baselineIdentifier) - dominantBaselineOffset;
- break;
- case EN_BOTTOM: // fall through
- case EN_AFTER_EDGE:
- offset = afterEdgeOffset;
- break;
}
return offset;
}
@@ -168,6 +171,8 @@ public class BasicScaledBaselineTable im
case EN_TEXT_AFTER_EDGE:
offset = depth;
break;
+ default:
+ break;
}
return offset;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -35,6 +35,11 @@ public class BidiLayoutManager extends L
private List children;
+ /**
+ * Construct bidi layout manager.
+ * @param node bidi override FO
+ * @param cLM parent layout manager
+ */
public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) {
super(node);
setParent(cLM);
@@ -53,10 +58,15 @@ public class BidiLayoutManager extends L
*/
}
+ /** @return number of children */
public int size() {
return children.size();
}
+ /**
+ * @param index of child inline area
+ * @return a child inline area
+ */
public InlineArea get(int index) {
return (InlineArea) children.get(index);
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -207,7 +207,8 @@ public class CharacterLayoutManager exte
new LeafPosition(this, -1), true));
returnList.add(new KnuthGlue(letterSpaceIPD.mult(areaInfo.iLScount),
new LeafPosition(this, -1), true));
- returnList.add(new KnuthInlineBox(0, null, notifyPos(new LeafPosition(this, -1)), true));
+ returnList.add
+ (new KnuthInlineBox(0, null, notifyPos(new LeafPosition(this, -1)), true));
if (areaInfo.bHyphenated) {
returnList.add(new KnuthPenalty(hyphIPD, KnuthPenalty.FLAGGED_PENALTY, true,
new LeafPosition(this, -1), false));
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -67,6 +67,7 @@ public class ContentLayoutManager extend
* Constructs a new ContentLayoutManager
*
* @param area The parent area
+ * @param parentLM the parent layout manager
*/
public ContentLayoutManager(Area area, LayoutManager parentLM) {
holder = area;
@@ -100,11 +101,12 @@ public class ContentLayoutManager extend
}
}
+ /** {@inheritDoc} */
public void initialize() {
// Empty
}
- public void fillArea(LayoutManager curLM) {
+ private void fillArea(LayoutManager curLM) {
int ipd = 1000000;
@@ -150,6 +152,7 @@ public class ContentLayoutManager extend
curLM.addAreas(contentPosIter, lc);
}
+ /** {@inheritDoc} */
public void addAreas(PositionIterator posIter, LayoutContext context) {
// add the content areas
// the area width has already been adjusted, and it must remain unchanged
@@ -163,6 +166,7 @@ public class ContentLayoutManager extend
((InlineArea)holder).setIPD(savedIPD);
}
+ /** @return stack size */
public int getStackingSize() {
return stackSize;
}
@@ -248,6 +252,7 @@ public class ContentLayoutManager extend
}
}
+ /** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context, int alignment) {
List contentList = new LinkedList();
List returnedList;
@@ -264,7 +269,7 @@ public class ContentLayoutManager extend
Object obj = returnedList.remove(0);
if (obj instanceof KnuthSequence) {
KnuthSequence ks = (KnuthSequence)obj;
- for (Iterator it = ks.iterator(); it.hasNext(); ) {
+ for (Iterator it = ks.iterator(); it.hasNext();) {
contentElement = (KnuthElement)it.next();
stackSize += contentElement.getWidth();
contentList.add(contentElement);
@@ -282,6 +287,7 @@ public class ContentLayoutManager extend
return contentList;
}
+ /** {@inheritDoc} */
public List addALetterSpaceTo(List oldList) {
return oldList;
}
@@ -296,23 +302,28 @@ public class ContentLayoutManager extend
log.warn(this.getClass().getName() + " should not receive a call to removeWordSpace(list)");
}
+ /** {@inheritDoc} */
public String getWordChars(Position pos) {
return "";
}
+ /** {@inheritDoc} */
public void hyphenate(Position pos, HyphContext hc) {
}
+ /** {@inheritDoc} */
public boolean applyChanges(List oldList) {
return false;
}
+ /** {@inheritDoc} */
public List getChangedKnuthElements(List oldList,
/*int flaggedPenalty,*/
int alignment) {
return null;
}
+ /** {@inheritDoc} */
public PageSequenceLayoutManager getPSLM() {
return parentLM.getPSLM();
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java Tue Aug 17 18:57:04 2010
@@ -32,10 +32,14 @@ public class HyphContext {
private int currentOffset = 0;
private int currentIndex = 0;
+ /**
+ * @param hyphPoints number of hyphenation points
+ */
public HyphContext(int[] hyphPoints) {
this.hyphPoints = hyphPoints;
}
+ /** @return next hyphenation point */
public int getNextHyphPoint() {
for (; currentIndex < hyphPoints.length; currentIndex++) {
if (hyphPoints[currentIndex] > currentOffset) {
@@ -45,6 +49,7 @@ public class HyphContext {
return -1; // AT END!
}
+ /** @return true if more hyphenation points */
public boolean hasMoreHyphPoints() {
for (; currentIndex < hyphPoints.length; currentIndex++) {
if (hyphPoints[currentIndex] > currentOffset) {
@@ -54,6 +59,7 @@ public class HyphContext {
return false;
}
+ /** @param iCharsProcessed amount to extend offset */
public void updateOffset(int iCharsProcessed) {
currentOffset += iCharsProcessed;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -33,11 +33,20 @@ import org.apache.fop.fo.flow.InlineCont
public class ICLayoutManager extends LeafNodeLayoutManager {
private List childrenLM;
+ /**
+ * Construct inline container layout manager.
+ * @param node inline container FO node
+ * @param childLM child layout manager
+ */
public ICLayoutManager(InlineContainer node, List childLM) {
super(node);
childrenLM = childLM;
}
+ /**
+ * @param index an integer
+ * @return an inline area or null
+ */
public InlineArea get(int index) {
return null;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -239,7 +239,8 @@ public class InlineLayoutManager extends
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment) {
LayoutManager curLM;
// the list returned by child LM
@@ -434,7 +435,7 @@ public class InlineLayoutManager extends
// layout context given to the other LMs.
List positionList = new LinkedList();
NonLeafPosition pos;
- LayoutManager lastLM = null;// last child LM in this iterator
+ LayoutManager lastLM = null; // last child LM in this iterator
Position lastPos = null;
while (parentIter.hasNext()) {
pos = (NonLeafPosition) parentIter.next();
@@ -553,13 +554,13 @@ public class InlineLayoutManager extends
if (returnList instanceof BlockKnuthSequence) {
return;
}
- CommonBorderPaddingBackground borderAndPadding =
- ((InlineLevel)fobj).getCommonBorderPaddingBackground();
+ CommonBorderPaddingBackground borderAndPadding
+ = ((InlineLevel)fobj).getCommonBorderPaddingBackground();
if (borderAndPadding != null) {
int ipStart = borderAndPadding.getBorderStartWidth(false)
+ borderAndPadding.getPaddingStart(false, this);
if (ipStart > 0) {
- returnList.add(0,new KnuthBox(ipStart, getAuxiliaryPosition(), true));
+ returnList.add(0, new KnuthBox(ipStart, getAuxiliaryPosition(), true));
}
}
}
@@ -578,8 +579,8 @@ public class InlineLayoutManager extends
if (returnList instanceof BlockKnuthSequence) {
return;
}
- CommonBorderPaddingBackground borderAndPadding =
- ((InlineLevel)fobj).getCommonBorderPaddingBackground();
+ CommonBorderPaddingBackground borderAndPadding
+ = ((InlineLevel)fobj).getCommonBorderPaddingBackground();
if (borderAndPadding != null) {
int ipEnd = borderAndPadding.getBorderEndWidth(false)
+ borderAndPadding.getPaddingEnd(false, this);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java Tue Aug 17 18:57:04 2010
@@ -32,7 +32,10 @@ public interface InlineLevelEventProduce
/**
* Provider class for the event producer.
*/
- class Provider {
+ final class Provider {
+
+ private Provider() {
+ }
/**
* Returns an event producer.
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -51,6 +51,7 @@ public interface InlineLevelLayoutManage
* Get the word chars corresponding to the given position.
*
* @param pos the position referring to the needed word chars.
+ * @return the word chars
*/
String getWordChars(Position pos);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -46,16 +46,27 @@ public abstract class InlineStackingLayo
implements InlineLevelLayoutManager {
+ /**
+ * A stacking iterator.
+ */
protected static class StackingIter extends PositionIterator {
StackingIter(Iterator parentIter) {
super(parentIter);
}
+ /**
+ * @param nextObj the next object
+ * @return layout manager of next object
+ */
protected LayoutManager getLM(Object nextObj) {
return ((Position) nextObj).getLM();
}
+ /**
+ * @param nextObj the next object
+ * @return position of next object
+ */
protected Position getPos(Object nextObj) {
return ((Position) nextObj);
}
@@ -218,10 +229,10 @@ public abstract class InlineStackingLayo
// The last element may not have a layout manager (its position == null);
// this may happen if it is a padding box; see bug 39571.
- InlineLevelLayoutManager LM =
- (InlineLevelLayoutManager) element.getLayoutManager();
- if (LM != null) {
- oldList = LM.addALetterSpaceTo(oldList);
+ InlineLevelLayoutManager lm
+ = (InlineLevelLayoutManager) element.getLayoutManager();
+ if (lm != null) {
+ oldList = lm.addALetterSpaceTo(oldList);
}
// "wrap" again the Position stored in each element of oldList
oldListIterator = oldList.listIterator();
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java Tue Aug 17 18:57:04 2010
@@ -23,6 +23,9 @@ import org.apache.fop.layoutmgr.Footnote
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.Position;
+/**
+ * A knuth inline box.
+ */
public class KnuthInlineBox extends KnuthBox {
private FootnoteBodyLayoutManager footnoteBodyLM = null;
@@ -36,7 +39,8 @@ public class KnuthInlineBox extends Knut
* @param pos the Position stored in this box
* @param auxiliary is this box auxiliary?
*/
- public KnuthInlineBox(int width, AlignmentContext alignmentContext, Position pos, boolean auxiliary) {
+ public KnuthInlineBox
+ (int width, AlignmentContext alignmentContext, Position pos, boolean auxiliary) {
super(width, pos, auxiliary);
this.alignmentContext = alignmentContext;
}
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -48,6 +48,7 @@ import org.apache.fop.traits.MinOptMax;
* an exception to this rule.)
* This class can be extended to handle the creation and adding of the
* inline area.
+ * @asf.todo [GA] replace use of hungarian notation with normalized java naming
*/
public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
implements InlineLevelLayoutManager {
@@ -75,11 +76,22 @@ public abstract class LeafNodeLayoutMana
* Store information about the inline area
*/
protected class AreaInfo {
+ /** letter space count */
protected short iLScount;
+ /** ipd of area */
protected MinOptMax ipdArea;
+ /** true if hyphenated */
protected boolean bHyphenated;
+ /** alignment context */
protected AlignmentContext alignmentContext;
+ /**
+ * Construct an area information item.
+ * @param iLS letter space count
+ * @param ipd inline progression dimension
+ * @param bHyph true if hyphenated
+ * @param alignmentContext an alignment context
+ */
public AreaInfo(short iLS, MinOptMax ipd, boolean bHyph,
AlignmentContext alignmentContext) {
iLScount = iLS;
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -132,10 +132,10 @@ public class LineLayoutManager extends I
private int spaceAfter;
private int baseline;
- LineBreakPosition(LayoutManager lm, int index, int startIndex, int breakIndex,
- int shrink, int stretch, int diff,
- double ipdA, double adjust, int ind,
- int lh, int lw, int sb, int sa, int bl) {
+ LineBreakPosition // CSOK: ParameterNumber
+ (LayoutManager lm, int index, int startIndex, int breakIndex,
+ int shrink, int stretch, int diff, double ipdA, double adjust, int ind,
+ int lh, int lw, int sb, int sa, int bl) {
super(lm, breakIndex);
availableShrink = shrink;
availableStretch = stretch;
@@ -204,6 +204,12 @@ public class LineLayoutManager extends I
inlineLM = lm;
firstIndex = index;
}
+ InlineLevelLayoutManager getInlineLM() {
+ return inlineLM;
+ }
+ int getFirstIndex() {
+ return firstIndex;
+ }
}
// this class represents a paragraph
@@ -325,11 +331,9 @@ public class LineLayoutManager extends I
private int follow;
private static final double MAX_DEMERITS = 10e6;
- public LineBreakingAlgorithm (int pageAlign,
- int textAlign, int textAlignLast,
- int indent, int fillerWidth,
- int lh, int ld, int fl, boolean first,
- int maxFlagCount, LineLayoutManager llm) {
+ public LineBreakingAlgorithm // CSOK: ParameterNumber
+ (int pageAlign, int textAlign, int textAlignLast, int indent, int fillerWidth,
+ int lh, int ld, int fl, boolean first, int maxFlagCount, LineLayoutManager llm) {
super(textAlign, textAlignLast, first, false, maxFlagCount);
pageAlignment = pageAlign;
textIndent = indent;
@@ -357,7 +361,8 @@ public class LineLayoutManager extends I
int textAlign = (bestActiveNode.line < total) ? alignment : alignmentLast;
indent += (textAlign == Constants.EN_CENTER)
? difference / 2 : (textAlign == Constants.EN_END) ? difference : 0;
- indent += (bestActiveNode.line == 1 && indentFirstPart && isFirstInBlock) ? textIndent : 0;
+ indent += (bestActiveNode.line == 1 && indentFirstPart && isFirstInBlock)
+ ? textIndent : 0;
double ratio = (textAlign == Constants.EN_JUSTIFY
|| difference < 0 && -difference <= bestActiveNode.availableShrink)
? bestActiveNode.adjustRatio : 0;
@@ -405,14 +410,9 @@ public class LineLayoutManager extends I
activePossibility = -1;
}
- private LineBreakPosition makeLineBreakPosition(KnuthSequence par,
- int firstElementIndex,
- int lastElementIndex,
- int availableShrink,
- int availableStretch,
- int difference,
- double ratio,
- int indent) {
+ private LineBreakPosition makeLineBreakPosition // CSOK: ParameterNumber
+ (KnuthSequence par, int firstElementIndex, int lastElementIndex, int availableShrink,
+ int availableStretch, int difference, double ratio, int indent) {
// line height calculation - spaceBefore may differ from spaceAfter
// by 1mpt due to rounding
int spaceBefore = (lineHeight - lead - follow) / 2;
@@ -501,7 +501,8 @@ public class LineLayoutManager extends I
//log.debug("LBA.filterActiveNodes> " + activeNodeCount + " layouts");
for (int i = startLine; i < endLine; i++) {
for (KnuthNode node = getNode(i); node != null; node = node.next) {
- //log.debug(" + lines = " + node.line + " demerits = " + node.totalDemerits);
+ //log.debug(" + lines = "
+ //+ node.line + " demerits = " + node.totalDemerits);
bestActiveNode = compareNodes(bestActiveNode, node);
}
}
@@ -514,10 +515,12 @@ public class LineLayoutManager extends I
//if (false) {
if (node.line != bestActiveNode.line
&& node.totalDemerits > MAX_DEMERITS) {
- //log.debug(" XXX lines = " + node.line + " demerits = " + node.totalDemerits);
+ //log.debug(" XXX lines = "
+ //+ node.line + " demerits = " + node.totalDemerits);
removeNode(i, node);
} else {
- //log.debug(" ok lines = " + node.line + " demerits = " + node.totalDemerits);
+ //log.debug(" ok lines = "
+ //+ node.line + " demerits = " + node.totalDemerits);
}
}
}
@@ -592,6 +595,15 @@ public class LineLayoutManager extends I
return createLineBreaks(context.getBPAlignment(), context);
}
+ /**
+ * 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 restartPosition position at restart
+ * @return the list of KnuthElements
+ * @see LayoutManager#getNextKnuthElements(LayoutContext,int)
+ */
public List getNextKnuthElements(LayoutContext context, int alignment,
LeafPosition restartPosition) {
log.trace("Restarting line breaking from index " + restartPosition.getIndex());
@@ -705,7 +717,7 @@ public class LineLayoutManager extends I
// finish last paragraph if it was closed with a linefeed
if (lastElement.isPenalty()
- && ((KnuthPenalty) lastElement).getPenalty() == -KnuthPenalty.INFINITE) {
+ && ((KnuthPenalty) lastElement).getPenalty() == -KnuthPenalty.INFINITE) {
// a penalty item whose value is -inf
// represents a preserved linefeed,
// which forces a line break
@@ -818,7 +830,8 @@ public class LineLayoutManager extends I
}
// now try something different
- log.debug("Hyphenation possible? " + (hyphenationProperties.hyphenate.getEnum() == EN_TRUE));
+ log.debug("Hyphenation possible? "
+ + (hyphenationProperties.hyphenate.getEnum() == EN_TRUE));
if (hyphenationProperties.hyphenate.getEnum() == EN_TRUE
&& !(allowedBreaks == BreakingAlgorithm.ONLY_FORCED_BREAKS)) {
// consider every hyphenation point as a legal break
@@ -828,9 +841,8 @@ public class LineLayoutManager extends I
maxAdjustment = 5;
}
- if ((iBPcount
- = alg.findBreakingPoints(currPar,
- maxAdjustment, false, allowedBreaks)) == 0) {
+ iBPcount = alg.findBreakingPoints(currPar, maxAdjustment, false, allowedBreaks);
+ if (iBPcount == 0) {
// the second try failed too, try with a huge threshold
// and force the algorithm to find
// a set of breaking points
@@ -853,9 +865,12 @@ public class LineLayoutManager extends I
is justify and the paragraph has only one layout, try using
shorter or longer lines */
//TODO This code snippet is disabled. Reenable?
+ /* [GA] remove dead code
if (false && alignment == EN_JUSTIFY && textAlignment == EN_JUSTIFY) {
- //log.debug("LLM.getNextKnuthElements> layouts with more lines? " + lineLayouts.canUseMoreLines());
- //log.debug(" layouts with fewer lines? " + lineLayouts.canUseLessLines());
+ //log.debug("LLM.getNextKnuthElements> layouts with more lines? "
+ //+ lineLayouts.canUseMoreLines());
+ //log.debug(" layouts with fewer lines? "
+ //+ lineLayouts.canUseLessLines());
if (!lineLayouts.canUseMoreLines()) {
alg.resetAlgorithm();
lineLayouts.savePossibilities(true);
@@ -881,9 +896,12 @@ public class LineLayoutManager extends I
lineLayouts.restorePossibilities();
ipd = savedLineWidth;
}
- //log.debug("LLM.getNextKnuthElements> now, layouts with more lines? " + lineLayouts.canUseMoreLines());
- //log.debug(" now, layouts with fewer lines? " + lineLayouts.canUseLessLines());
+ //log.debug("LLM.getNextKnuthElements> now, layouts with more lines? "
+ //+ lineLayouts.canUseMoreLines());
+ //log.debug(" now, layouts with fewer lines? "
+ //+ lineLayouts.canUseLessLines());
}
+ */
}
return lineLayouts;
}
@@ -1068,7 +1086,8 @@ public class LineLayoutManager extends I
//log.debug("first=" + firstLines + " inner=" + innerLines
// + " optional=" + optionalLines + " eliminable=" + eliminableLines
// + " last=" + lastLines
- // + " (condOpt=" + conditionalOptionalLines + " condEl=" + conditionalEliminableLines + ")");
+ // + " (condOpt=" + conditionalOptionalLines
+ // + " condEl=" + conditionalEliminableLines + ")");
// creation of the elements:
// first group of lines
@@ -1172,8 +1191,9 @@ public class LineLayoutManager extends I
//}
//int lineNumberDifference = (int)((double) totalAdj / constantLineHeight);
int lineNumberDifference = (int) Math.round((double) adj / constantLineHeight
- + (adj > 0 ? - 0.4 : 0.4));
- //log.debug(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + " variazione applicata = " + lineNumberDifference);
+ + (adj > 0 ? -0.4 : 0.4));
+ //log.debug(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight)
+ //+ " variazione applicata = " + lineNumberDifference);
LineLayoutPossibilities llPoss;
llPoss = lineLayoutsList[pos.getLeafPos()];
lineNumberDifference = llPoss.applyLineCountAdjustment(lineNumberDifference);
@@ -1198,10 +1218,12 @@ public class LineLayoutManager extends I
returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
LineBreakPosition lbp = (LineBreakPosition) llPoss.getChosenPosition(i);
- //log.debug("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference);
- //log.debug(" shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch);
-
- //log.debug("linewidth= " + lbp.lineWidth + " difference= " + lbp.difference + " indent= " + lbp.startIndent);
+ //log.debug("LLM.getChangedKnuthElements> lineWidth= "
+ // + lbp.lineWidth + " difference= " + lbp.difference);
+ //log.debug(" shrink= "
+ // + lbp.availableShrink + " stretch= " + lbp.availableStretch);
+ //log.debug("linewidth= " + lbp.lineWidth + " difference= "
+ //+ lbp.difference + " indent= " + lbp.startIndent);
MinOptMax contentIPD;
if (alignment == EN_JUSTIFY) {
contentIPD = MinOptMax.getInstance(
@@ -1213,7 +1235,8 @@ public class LineLayoutManager extends I
} else if (alignment == EN_END) {
contentIPD = MinOptMax.getInstance(lbp.lineWidth - lbp.startIndent);
} else {
- contentIPD = MinOptMax.getInstance(lbp.lineWidth - lbp.difference + lbp.startIndent);
+ contentIPD
+ = MinOptMax.getInstance(lbp.lineWidth - lbp.difference + lbp.startIndent);
}
returnList.add(new KnuthBlockBox(lbp.lineHeight, contentIPD, (lbp.ipdAdjust != 0
? lbp.lineWidth - lbp.difference : 0),
@@ -1528,6 +1551,7 @@ public class LineLayoutManager extends I
* have been optimized, recompute indents and / or adjust ratio, according
* to the paragraph horizontal alignment
*/
+ /* [GA] remove dead code
if (false && textAlignment == EN_JUSTIFY) {
// re-compute space adjust ratio
int updatedDifference = context.getRefIPD()
@@ -1539,8 +1563,10 @@ public class LineLayoutManager extends I
updatedRatio = (float) updatedDifference / lbp.availableShrink;
}
lc.setIPDAdjust(updatedRatio);
- //log.debug("LLM.addAreas> old difference = " + lbp.difference + " new difference = " + updatedDifference);
- //log.debug(" old ratio = " + lbp.ipdAdjust + " new ratio = " + updatedRatio);
+ //log.debug("LLM.addAreas> old difference = " + lbp.difference
+ //+ " new difference = " + updatedDifference);
+ //log.debug(" old ratio = " + lbp.ipdAdjust
+ //+ " new ratio = " + updatedRatio);
} else if (false && textAlignment == EN_CENTER) {
// re-compute indent
int updatedIndent = lbp.startIndent
@@ -1552,6 +1578,7 @@ public class LineLayoutManager extends I
+ (context.getRefIPD() - lbp.lineWidth);
lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
}
+ */
setCurrentArea(lineArea);
setChildContext(lc);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java Tue Aug 17 18:57:04 2010
@@ -23,14 +23,18 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.layoutmgr.Position;
+/**
+ * Line layout possibilities.
+ */
public class LineLayoutPossibilities {
/** logger instance */
- protected static Log log = LogFactory.getLog(LineLayoutPossibilities.class);
+ private static final Log LOG = LogFactory.getLog(LineLayoutPossibilities.class);
- private class Possibility {
+ private final class Possibility {
private int lineCount;
private double demerits;
private List breakPositions;
@@ -69,12 +73,18 @@ public class LineLayoutPossibilities {
private int chosenIndex;
private int savedOptLineCount;
+ /** default constructor */
public LineLayoutPossibilities() {
possibilitiesList = new java.util.ArrayList();
savedPossibilities = new java.util.ArrayList();
optimumIndex = -1;
}
+ /**
+ * Add possibility.
+ * @param ln line number
+ * @param dem demerits
+ */
public void addPossibility(int ln, double dem) {
possibilitiesList.add(new Possibility(ln, dem));
if (possibilitiesList.size() == 1) {
@@ -97,8 +107,10 @@ public class LineLayoutPossibilities {
}
}
- /* save in a different array the computed Possibilities,
- * so possibilitiesList is ready to store different Possibilities
+ /**
+ * Save in a different array the computed Possibilities,
+ * so possibilitiesList is ready to store different Possibilities.
+ * @param bSaveOptLineCount true if should save optimum line count
*/
public void savePossibilities(boolean bSaveOptLineCount) {
if (bSaveOptLineCount) {
@@ -110,8 +122,9 @@ public class LineLayoutPossibilities {
possibilitiesList = new java.util.ArrayList();
}
- /* replace the Possibilities stored in possibilitiesList with
- * the ones stored in savedPossibilities and having the same line number
+ /**
+ * Replace the Possibilities stored in possibilitiesList with
+ * the ones stored in savedPossibilities and having the same line number.
*/
public void restorePossibilities() {
int index = 0;
@@ -124,9 +137,9 @@ public class LineLayoutPossibilities {
// update minimumIndex
minimumIndex = 0;
// shift the other indexes;
- optimumIndex ++;
- maximumIndex ++;
- chosenIndex ++;
+ optimumIndex++;
+ maximumIndex++;
+ chosenIndex++;
} else if (restoredPossibility.getLineCount() > getMaxLineCount()) {
// if the line number of restoredPossibility is greater than the maximum one,
// add restoredPossibility at the end of the list
@@ -138,13 +151,13 @@ public class LineLayoutPossibilities {
// find the index of the Possibility that will be replaced
while (index < maximumIndex
&& getLineCount(index) < restoredPossibility.getLineCount()) {
- index ++;
+ index++;
}
if (getLineCount(index) == restoredPossibility.getLineCount()) {
possibilitiesList.set(index, restoredPossibility);
} else {
// this should not happen
- log.error("LineLayoutPossibilities restorePossibilities(),"
+ LOG.error("LineLayoutPossibilities restorePossibilities(),"
+ " min= " + getMinLineCount()
+ " max= " + getMaxLineCount()
+ " restored= " + restoredPossibility.getLineCount());
@@ -152,8 +165,10 @@ public class LineLayoutPossibilities {
}
}
// update optimumIndex and chosenIndex
- if (savedOptLineCount == 0 && getDemerits(optimumIndex) > restoredPossibility.getDemerits()
- || savedOptLineCount != 0 && restoredPossibility.getLineCount() == savedOptLineCount) {
+ if (savedOptLineCount == 0
+ && getDemerits(optimumIndex) > restoredPossibility.getDemerits()
+ || savedOptLineCount != 0
+ && restoredPossibility.getLineCount() == savedOptLineCount) {
optimumIndex = index;
chosenIndex = optimumIndex;
}
@@ -162,73 +177,102 @@ public class LineLayoutPossibilities {
// + " optLineCount = " + getOptLineCount() + " maxLineCount() = " + getMaxLineCount());
}
+ /**
+ * @param pos a position
+ * @param i an index into posibilities list
+ */
public void addBreakPosition(Position pos, int i) {
((Possibility)possibilitiesList.get(i)).addBreakPosition(pos);
}
+ /** @return true if can use more lines */
public boolean canUseMoreLines() {
return (getOptLineCount() < getMaxLineCount());
}
+ /** @return true if can use fewer lines */
public boolean canUseLessLines() {
return (getMinLineCount() < getOptLineCount());
}
+ /** @return the line count of the minimum index */
public int getMinLineCount() {
return getLineCount(minimumIndex);
}
+ /** @return the line count of the optimum index */
public int getOptLineCount() {
return getLineCount(optimumIndex);
}
+ /** @return the line count of the maximum index */
public int getMaxLineCount() {
return getLineCount(maximumIndex);
}
+ /** @return the line count of the chosen index */
public int getChosenLineCount() {
return getLineCount(chosenIndex);
}
+ /**
+ * @param i the posibilities list index
+ * @return the line count
+ */
public int getLineCount(int i) {
return ((Possibility)possibilitiesList.get(i)).getLineCount();
}
+ /** @return the demerits of the chosen index */
public double getChosenDemerits() {
return getDemerits(chosenIndex);
}
+ /**
+ * @param i the posibilities list index
+ * @return the demerits
+ */
public double getDemerits(int i) {
return ((Possibility)possibilitiesList.get(i)).getDemerits();
}
+ /** @return the possibilities count */
public int getPossibilitiesNumber() {
return possibilitiesList.size();
}
+ /**
+ * @param i the break position index
+ * @return the chosen position
+ */
public Position getChosenPosition(int i) {
return ((Possibility)possibilitiesList.get(chosenIndex)).getBreakPosition(i);
}
+ /**
+ * @param adj the adjustment
+ * @return the adjustment or zero
+ */
public int applyLineCountAdjustment(int adj) {
if (adj >= (getMinLineCount() - getChosenLineCount())
&& adj <= (getMaxLineCount() - getChosenLineCount())
&& getLineCount(chosenIndex + adj) == getChosenLineCount() + adj) {
chosenIndex += adj;
- log.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj
+ LOG.debug("chosenLineCount= " + (getChosenLineCount() - adj) + " adjustment= " + adj
+ " => chosenLineCount= " + getLineCount(chosenIndex));
return adj;
} else {
// this should not happen!
- log.warn("Cannot apply the desired line count adjustment.");
+ LOG.warn("Cannot apply the desired line count adjustment.");
return 0;
}
}
+ /** print all */
public void printAll() {
System.out.println("++++++++++");
System.out.println(" " + possibilitiesList.size() + " possibility':");
- for (int i = 0; i < possibilitiesList.size(); i ++) {
+ for (int i = 0; i < possibilitiesList.size(); i++) {
System.out.println(" " + ((Possibility)possibilitiesList.get(i)).getLineCount()
+ (i == optimumIndex ? " *" : "")
+ (i == minimumIndex ? " -" : "")
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -37,7 +37,7 @@ public class PageNumberCitationLastLayou
* Constructor
*
* @param node the formatting object that creates this area
- * @todo better retrieval of font info
+ * @asf.todo better retrieval of font info
*/
public PageNumberCitationLastLayoutManager(PageNumberCitationLast node) {
super(node);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java Tue Aug 17 18:57:04 2010
@@ -25,7 +25,6 @@ import org.apache.fop.area.inline.TextAr
import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.fo.flow.PageNumberCitation;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.LayoutManager;
/**
* LayoutManager for the fo:page-number-citation formatting object
@@ -36,7 +35,7 @@ public class PageNumberCitationLayoutMan
* Constructor
*
* @param node the formatting object that creates this area
- * @todo better retrieval of font info
+ * @asf.todo better retrieval of font info
*/
public PageNumberCitationLayoutManager(PageNumberCitation node) {
super(node);
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java Tue Aug 17 18:57:04 2010
@@ -19,8 +19,6 @@
package org.apache.fop.layoutmgr.inline;
-import org.apache.fop.datatypes.Length;
-
/**
* The FOP specific incarnation of the XSL-FO scaled baseline table.
* All baseline tables are scaled to the font size of the font they
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java?rev=986451&r1=986450&r2=986451&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTableFactory.java Tue Aug 17 18:57:04 2010
@@ -28,7 +28,10 @@ import org.apache.fop.fonts.Font;
* Currently supports alignment contexts for basic fonts
* and graphic inlines.
*/
-public class ScaledBaselineTableFactory implements Constants {
+public final class ScaledBaselineTableFactory implements Constants {
+
+ private ScaledBaselineTableFactory() {
+ }
/**
* Creates a new instance of BasicScaledBaselineTable for the given
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org