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 je...@apache.org on 2010/08/14 19:17:13 UTC
svn commit: r985537 [6/11] - in /xmlgraphics/fop/trunk: ./
src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/data/
src/codegen/unicode/java/org/apache/fop/hyphenation/
src/codegen/unicode/java/org/apache/fop/text/linebreak/
src/codegen/unicode...
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakElement.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakElement.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakElement.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/ElementListObserver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListObserver.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListObserver.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListObserver.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/Keep.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Keep.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Keep.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Keep.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthGlue.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthSequence.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/LMiter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LMiter.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LMiter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LMiter.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutContext.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/LayoutException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutException.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutException.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutException.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Sat Aug 14 17:17:00 2010
@@ -93,11 +93,13 @@ 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 // CSOK: ConstantName
+ = LogFactory.getLog(LayoutManagerMapping.class);
/** The map of LayoutManagerMakers */
private Map makers = new HashMap();
+ /** default constructor */
public LayoutManagerMapping() {
initialize();
}
@@ -152,9 +154,7 @@ 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) {
@@ -170,9 +170,7 @@ public class LayoutManagerMapping implem
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public LayoutManager makeLayoutManager(FONode node) {
List lms = new ArrayList();
makeLayoutManagers(node, lms);
@@ -188,30 +186,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 +222,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 +245,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 +263,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 +300,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 +335,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 +346,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 +412,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 +428,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 +447,4 @@ public class LayoutManagerMapping implem
}
}
- public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager(
- AreaTreeHandler ath, ExternalDocument ed) {
- return new ExternalDocumentLayoutManager(ath, ed);
- }
-
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafPosition.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafPosition.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LeafPosition.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java Sat Aug 14 17:17:00 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 {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/Position.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Position.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Position.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Position.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/PositionIterator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PositionIterator.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PositionIterator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PositionIterator.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java Sat Aug 14 17:17:00 2010
@@ -32,10 +32,11 @@ 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 // CSOK: ConstantName
+ = LogFactory.getLog(SpaceResolver.class);
private UnresolvedListElementWithLength[] firstPart;
private BreakElement breakPoss;
@@ -439,7 +440,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 +545,7 @@ public class SpaceResolver {
return this.originalPosition;
}
+ /** {@inheritDoc} */
public Position getPosition() {
return originalPosition;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/TraitSetter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/TraitSetter.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/TraitSetter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/TraitSetter.java Sat Aug 14 17:17:00 2010
@@ -39,10 +39,14 @@ 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 // CSOK: ConstantName
+ = LogFactory.getLog(TraitSetter.class);
/**
* Sets border and padding traits on areas.
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java Sat Aug 14 17:17:00 2010
@@ -237,6 +237,8 @@ public class AlignmentContext implements
case EN_MATHEMATICAL:
this.alignmentBaselineIdentifier = alignmentBaseline;
break;
+ default:
+ break;
}
}
@@ -330,6 +332,9 @@ public class AlignmentContext implements
, LengthBase.CUSTOM_BASE
, parentAlignmentContext.getLineHeight()));
break;
+ default:
+ break;
+
}
}
@@ -353,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/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BasicScaledBaselineTable.java Sat Aug 14 17:17:00 2010
@@ -96,39 +96,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 +173,8 @@ public class BasicScaledBaselineTable im
case EN_TEXT_AFTER_EDGE:
offset = depth;
break;
+ default:
+ break;
}
return offset;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java Sat Aug 14 17:17:00 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/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ICLayoutManager.java Sat Aug 14 17:17:00 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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org