aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2024-06-26 09:51:53 +0100
committerSimon Steiner <ssteiner@apache.org>2024-06-26 09:51:53 +0100
commit3d750f3289559f3896a61ab694d7f1a4481d720b (patch)
tree17e732c333d9ce2d5cb10588e341f892ded4f3c3
parentca1d532dc3f4c9e4bfecbcb64caf63afa38a76a9 (diff)
downloadxmlgraphics-fop-3d750f3289559f3896a61ab694d7f1a4481d720b.tar.gz
xmlgraphics-fop-3d750f3289559f3896a61ab694d7f1a4481d720b.zip
Add generics to layout
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java12
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java9
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java3
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java9
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java3
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java4
33 files changed, 86 insertions, 76 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
index a84a243b0..a3edc2088 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
@@ -284,7 +284,7 @@ public abstract class AbstractBaseLayoutManager
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
+ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position positionAtIPDChange, LayoutManager restartAtLM) {
throw new UnsupportedOperationException("Not implemented");
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java
index 40b518af3..3fc3951fc 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java
@@ -288,7 +288,7 @@ public abstract class AbstractBreaker {
* @param alignment the desired text alignment
* @return the list of KnuthElements
*/
- protected abstract List<KnuthElement> getNextKnuthElements(LayoutContext context,
+ protected abstract List<ListElement> getNextKnuthElements(LayoutContext context,
int alignment);
/**
@@ -302,7 +302,7 @@ public abstract class AbstractBreaker {
* change occurs between two LMs
* @return the list of KnuthElements
*/
- protected List<KnuthElement> getNextKnuthElements(LayoutContext context, int alignment,
+ protected List<ListElement> getNextKnuthElements(LayoutContext context, int alignment,
Position positionAtIPDChange, LayoutManager restartAtLM) {
throw new UnsupportedOperationException("TODO: implement acceptable fallback");
}
@@ -673,13 +673,13 @@ public abstract class AbstractBreaker {
*/
protected int getNextBlockList(LayoutContext childLC, int nextSequenceStartsOn,
Position positionAtIPDChange, LayoutManager restartAtLM,
- List<KnuthElement> firstElements) {
+ List<ListElement> firstElements) {
updateLayoutContext(childLC);
//Make sure the span change signal is reset
childLC.signalSpanChange(Constants.NOT_SET);
BlockSequence blockList;
- List<KnuthElement> returnedList;
+ List<ListElement> returnedList;
if (firstElements == null) {
returnedList = getNextKnuthElements(childLC, alignment);
} else if (positionAtIPDChange == null) {
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 0060c4b11..f7f269df1 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -170,7 +170,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager im
}
/** {@inheritDoc} */
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
log.warn("null implementation of getChangeKnuthElement() called!");
return null;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
index 06c3c538d..375153f98 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
@@ -140,7 +140,7 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
boolean prevIsBox = false;
int colNumber = 1;
for (int i = startIndex; i < par.size(); i++) {
- KnuthElement element = (KnuthElement) par.get(i);
+ KnuthElement element = par.get(i);
if (isLegalBreak(i, prevIsBox)) {
int breakLength = totalLength
+ (element instanceof KnuthPenalty ? element.getWidth() : 0);
@@ -225,7 +225,7 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
}
private boolean isLegalBreak(int index, boolean prevIsBox) {
- KnuthElement element = (KnuthElement) par.get(index);
+ KnuthElement element = par.get(index);
return element instanceof KnuthPenalty && element.getPenalty() < KnuthPenalty.INFINITE
|| prevIsBox && element instanceof KnuthGlue;
}
@@ -235,7 +235,7 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
}
private int getPenaltyWidth(int index) {
- KnuthElement element = (KnuthElement) par.get(index);
+ KnuthElement element = par.get(index);
return element instanceof KnuthPenalty ? element.getWidth() : 0;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java
index 83c1ae585..030fe4a44 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java
@@ -42,7 +42,7 @@ public class BlockKnuthSequence extends KnuthSequence {
* Creates a new list from an existing list.
* @param list The list from which to create the new list.
*/
- public BlockKnuthSequence(List list) {
+ public BlockKnuthSequence(List<KnuthSequence> list) {
super(list);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
index 08c27404d..260d32ac8 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
@@ -113,7 +113,7 @@ public abstract class BreakingAlgorithm {
/**
* The paragraph of KnuthElements.
*/
- protected KnuthSequence par;
+ protected KnuthSequence<KnuthElement> par;
/**
* The width of a line (or height of a column in page-breaking mode).
@@ -1313,7 +1313,7 @@ public abstract class BreakingAlgorithm {
* @return the element at index idx in the paragraph.
*/
protected KnuthElement getElement(int idx) {
- return (KnuthElement) par.get(idx);
+ return par.get(idx);
}
/**
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
index e20826ca3..ccb318203 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
@@ -30,7 +30,7 @@ import org.apache.fop.fo.flow.FootnoteBody;
*/
public class FootnoteBodyLayoutManager extends BlockStackingLayoutManager {
- private List<KnuthElement> knuthElements;
+ private List<ListElement> knuthElements;
/**
* Creates a new FootnoteBodyLayoutManager.
@@ -41,7 +41,7 @@ public class FootnoteBodyLayoutManager extends BlockStackingLayoutManager {
}
@Override
- public List<KnuthElement> getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
if (knuthElements == null) {
knuthElements = super.getNextKnuthElements(context, alignment);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
index 1b38b9d8f..5e0bd37eb 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java
@@ -30,7 +30,7 @@ import org.apache.fop.layoutmgr.inline.KnuthInlineBox;
* Represents a list of inline Knuth elements.
* If closed, it represents all elements of a Knuth paragraph.
*/
-public class InlineKnuthSequence extends KnuthSequence {
+public class InlineKnuthSequence<T extends ListElement> extends KnuthSequence {
private static final long serialVersionUID = 1354774188859946549L;
@@ -47,7 +47,7 @@ public class InlineKnuthSequence extends KnuthSequence {
* Creates a new list from an existing list.
* @param list The list from which to create the new list.
*/
- public InlineKnuthSequence(List list) {
+ public InlineKnuthSequence(List<T> list) {
super(list);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java
index cd37f0d3a..ce85b686c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java
@@ -29,7 +29,7 @@ import org.apache.fop.util.ListUtil;
/**
* Represents a list of {@link KnuthElement Knuth elements}.
*/
-public abstract class KnuthSequence extends ArrayList {
+public abstract class KnuthSequence<T extends ListElement> extends ArrayList<T> {
//TODO: do not extend ArrayList
@@ -44,7 +44,7 @@ public abstract class KnuthSequence extends ArrayList {
* Creates a new list from an existing list.
* @param list The list from which to create the new list.
*/
- public KnuthSequence(List list) {
+ public KnuthSequence(List<T> list) {
super(list);
}
@@ -157,7 +157,7 @@ public abstract class KnuthSequence extends ArrayList {
public ListElement getElement(int index) {
return (index >= size() || index < 0)
? null
- : (ListElement) get(index);
+ : get(index);
}
/**
@@ -175,7 +175,7 @@ public abstract class KnuthSequence extends ArrayList {
} else {
int boxIndex = startIndex;
@SuppressWarnings("unchecked")
- Iterator<ListElement> iter = listIterator(startIndex);
+ Iterator<T> iter = listIterator(startIndex);
while (iter.hasNext() && !iter.next().isBox()) {
boxIndex++;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java
index 97449762b..3adaceebc 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java
@@ -175,7 +175,7 @@ public interface LayoutManager extends PercentBaseContext {
* @param alignment the desired text alignment
* @return the updated list of KnuthElements
*/
- List getChangedKnuthElements(List oldList, int alignment);
+ List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment);
/**
* Whether the FO handled by this layout manager has a descendant (including itself)
@@ -269,7 +269,7 @@ public interface LayoutManager extends PercentBaseContext {
* a paragraph
* @return an updated list of elements, taking the new IPD into account
*/
- List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
+ List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position positionAtIPDChange, LayoutManager restartAtLM);
boolean isFromFootnote();
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java
index f5882f119..41a7b3813 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java
@@ -90,9 +90,9 @@ public abstract class LocalBreaker extends AbstractBreaker {
return lc;
}
- protected List getNextKnuthElements(LayoutContext context, int alignment) {
+ protected List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM; // currently active LM
- List returnList = new LinkedList();
+ List<ListElement> returnList = new LinkedList<>();
while ((curLM = lm.getChildLM()) != null) {
LayoutContext childLC = LayoutContext.newInstance();
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
index cd9b7f363..3f246adfb 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java
@@ -201,9 +201,9 @@ public class PageBreaker extends AbstractBreaker {
return containsFootnotes;
}
- public static List<List<KnuthElement>> getFootnoteKnuthElements(FlowLayoutManager flowLM, LayoutContext context,
+ public static List<List<KnuthElement>> getFootnoteKnuthElements(FlowLayoutManager flowLM, LayoutContext context,
List<FootnoteBodyLayoutManager> footnoteBodyLMs) {
- List<List<KnuthElement>> footnotes = new ArrayList<List<KnuthElement>>();
+ List<List<KnuthElement>> footnotes = new ArrayList<>();
LayoutContext footnoteContext = LayoutContext.copyOf(context);
footnoteContext.setStackLimitBP(context.getStackLimitBP());
footnoteContext.setRefIPD(flowLM.getPSLM()
@@ -245,8 +245,8 @@ public class PageBreaker extends AbstractBreaker {
}
/** {@inheritDoc} */
- protected List getNextKnuthElements(LayoutContext context, int alignment) {
- List contentList = null;
+ protected List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
+ List<ListElement> contentList = null;
while (!childFLM.isFinished() && contentList == null) {
contentList = childFLM.getNextKnuthElements(context, alignment);
@@ -262,9 +262,9 @@ public class PageBreaker extends AbstractBreaker {
}
/** {@inheritDoc} */
- protected List getNextKnuthElements(LayoutContext context, int alignment,
+ protected List<ListElement> getNextKnuthElements(LayoutContext context, int alignment,
Position positionAtIPDChange, LayoutManager restartAtLM) {
- List contentList = null;
+ List<ListElement> contentList = null;
do {
contentList = childFLM.getNextKnuthElements(context, alignment, positionAtIPDChange,
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java
index 9d0979a29..c644d7f82 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java
@@ -39,7 +39,7 @@ public class RetrieveTableMarkerLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
setFinished(true);
FONode foNode = (FONode) getFObj();
foNode = getTableLayoutManager().resolveRetrieveTableMarker((RetrieveTableMarker) foNode);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index 83fa63151..20b337fe9 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -72,7 +72,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
throw new IllegalStateException();
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
index 8afec46e1..51e1a1c74 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
@@ -30,6 +30,7 @@ import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.flow.AbstractGraphics;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.TraitSetter;
@@ -111,8 +112,8 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context,
- int alignment) {
+ public List<KnuthSequence> getNextKnuthElements(LayoutContext context,
+ int alignment) {
InlineViewport areaCurrent = getInlineArea();
setCurrentArea(areaCurrent);
return super.getNextKnuthElements(context, alignment);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
index 3f68df0e2..1ba50e992 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
@@ -111,7 +111,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
Character fobj = (Character) this.fobj;
// TODO: may need some special handling for fo:character
@@ -152,7 +152,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager {
addKnuthElementsForBorderPaddingEnd(seq);
- LinkedList<KnuthSequence> returnList = new LinkedList<KnuthSequence>();
+ LinkedList<KnuthSequence> returnList = new LinkedList<>();
returnList.add(seq);
setFinished(true);
return returnList;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
index a5f128f85..0b419217c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
@@ -38,6 +38,7 @@ import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.PageSequenceLayoutManager;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
@@ -129,8 +130,8 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
stackSize = 0;
- List contentList = getNextKnuthElements(childLC, Constants.EN_START);
- for (Object aContentList : contentList) {
+ List<ListElement> contentList = getNextKnuthElements(childLC, Constants.EN_START);
+ for (ListElement aContentList : contentList) {
KnuthElement element = (KnuthElement) aContentList;
if (element instanceof KnuthInlineBox) {
KnuthInlineBox box = (KnuthInlineBox) element;
@@ -315,12 +316,12 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
}
/** {@inheritDoc} */
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
return null;
}
/** {@inheritDoc} */
- public List getChangedKnuthElements(List oldList, int alignment, int depth) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
return getChangedKnuthElements(oldList, alignment);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java
index fe63791bf..eb5cb8d8c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java
@@ -25,11 +25,11 @@ import java.util.List;
import org.apache.fop.fo.flow.Float;
import org.apache.fop.layoutmgr.FloatContentLayoutManager;
import org.apache.fop.layoutmgr.InlineKnuthSequence;
-import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceResolver;
@@ -38,7 +38,7 @@ public class FloatLayoutManager extends InlineStackingLayoutManager {
private FloatContentLayoutManager floatContentLM;
private KnuthInlineBox anchor;
- private List<KnuthElement> floatContentKnuthElements;
+ private List<ListElement> floatContentKnuthElements;
private Float floatContent;
private boolean floatContentAreaAdded;
@@ -51,7 +51,7 @@ public class FloatLayoutManager extends InlineStackingLayoutManager {
return null;
}
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public LinkedList<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
if (!floatContentAreaAdded && !floatContent.isDisabled()) {
floatContentLM = new FloatContentLayoutManager(floatContent);
@@ -62,7 +62,7 @@ public class FloatLayoutManager extends InlineStackingLayoutManager {
}
// the only knuth element is a zero width and height knuth box
- LinkedList knuthElements = new LinkedList();
+ LinkedList<KnuthSequence> knuthElements = new LinkedList<>();
KnuthSequence seq = new InlineKnuthSequence();
anchor = new KnuthInlineBox(0, null, null, true);
if (!floatContentAreaAdded) {
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
index 06e742434..1fd29eb59 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
@@ -86,7 +86,7 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager {
bodyLM.initialize();
// get Knuth elements representing the footnote citation
- List returnedList = new LinkedList();
+ List<KnuthSequence> returnedList = new LinkedList<>();
while (!citationLM.isFinished()) {
List partialList = citationLM.getNextKnuthElements(context, alignment);
if (partialList != null) {
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
index 54237a914..e589ab0b9 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java
@@ -319,7 +319,7 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen
return false;
}
- public List getChangedKnuthElements(List oldList, int alignment, int depth) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
return oldList;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
index 52418d816..08a85a931 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
@@ -259,7 +259,7 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
/** {@inheritDoc} */
@Override
- public List getNextKnuthElements(
+ public List<KnuthSequence> getNextKnuthElements(
LayoutContext context, int alignment) {
LayoutManager curLM;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java
index ac829a2fc..addad2b92 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java
@@ -22,6 +22,7 @@ package org.apache.fop.layoutmgr.inline;
import java.util.List;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
/**
@@ -91,6 +92,6 @@ List addALetterSpaceTo(List oldList, int depth);
* @param depth the depth at which the Positions for this LM in oldList are found
* @return the updated list of KnuthElements
**/
- List getChangedKnuthElements(List oldList, int alignment, int depth);
+ List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth);
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
index a0acd1cd3..d0ee9104b 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
@@ -32,6 +32,7 @@ import org.apache.fop.layoutmgr.BreakOpportunity;
import org.apache.fop.layoutmgr.BreakOpportunityHelper;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.LayoutContext;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.traits.MinOptMax;
@@ -320,12 +321,12 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager
/**
* {@inheritDoc}
*/
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
return getChangedKnuthElements(oldList, alignment, 0);
}
/** {@inheritDoc} */
- public List getChangedKnuthElements(List oldList, int alignment, int depth) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
// "unwrap" the Positions stored in the elements
ListIterator oldListIterator = oldList.listIterator();
KnuthElement oldElement;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
index a6d695b06..0ccea3840 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
@@ -41,6 +41,7 @@ import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
@@ -256,7 +257,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
MinOptMax ipd;
curArea = get(context);
KnuthSequence seq = new InlineKnuthSequence();
@@ -319,7 +320,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
if (isFinished()) {
return null;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
index ae337b0d0..04c6fd72c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
@@ -37,6 +37,7 @@ import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
@@ -261,7 +262,7 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
/** {@inheritDoc} */
@Override
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
curArea = get(context);
alignmentContext = makeAlignmentContext(context);
@@ -327,18 +328,18 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
* {@inheritDoc}
* No subclass has a meaningful implementation of this method
*/
- public List getChangedKnuthElements(List oldList, int alignment, int depth) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
return getChangedKnuthElements(oldList, alignment);
}
/** {@inheritDoc} */
@Override
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
if (isFinished()) {
return null;
}
- LinkedList returnList = new LinkedList();
+ LinkedList<ListElement> returnList = new LinkedList<>();
addKnuthElementsForBorderPaddingStart(returnList);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index 60d05b581..9ba707e3c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -607,7 +607,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
/** {@inheritDoc} */
@Override
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
if (alignmentContext == null) {
FontInfo fi = fobj.getFOEventHandler().getFontInfo();
FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
@@ -933,7 +933,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
*/
private List<ListElement> postProcessLineBreaks(int alignment, LayoutContext context) {
- List<ListElement> returnList = new LinkedList<ListElement>();
+ List<ListElement> returnList = new LinkedList<>();
int endIndex = -1;
for (int p = 0; p < knuthParagraphs.size(); p++) {
@@ -1366,7 +1366,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
processUpdates(currPar, updateList);
}
- private void processUpdates(Paragraph par, List updateList) {
+ private void processUpdates(Paragraph par, List<ListElement> updateList) {
// create iterator for the updateList
ListIterator updateListIterator = updateList.listIterator();
Update currUpdate;
@@ -1394,7 +1394,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
.applyChanges(par.subList(fromIndex + elementsAdded,
toIndex + elementsAdded))) {
// insert the new KnuthElements
- List newElements = currUpdate.inlineLM.getChangedKnuthElements(
+ List<ListElement> newElements = currUpdate.inlineLM.getChangedKnuthElements(
par.subList(fromIndex + elementsAdded,
toIndex + elementsAdded),
/*flaggedPenalty,*/ effectiveAlignment);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index e524b87ac..aab2dd56c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -45,6 +45,7 @@ import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
@@ -1189,7 +1190,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public List getChangedKnuthElements(final List oldList, final int alignment) {
+ public List<ListElement> getChangedKnuthElements(final List<ListElement> oldList, final int alignment) {
if (isFinished()) {
return null;
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
index c6a2b05b2..0dcba3efe 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
@@ -27,6 +27,7 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.fo.flow.Wrapper;
import org.apache.fop.layoutmgr.BlockLayoutManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
+import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
@@ -90,8 +91,8 @@ public class WrapperLayoutManager extends LeafNodeLayoutManager {
getPSLM().addIDToPage(fobj.getId());
}
- public List getNextKnuthElements(LayoutContext context, int alignment) {
- List list = super.getNextKnuthElements(context, alignment);
+ public List<KnuthSequence> getNextKnuthElements(LayoutContext context, int alignment) {
+ List<KnuthSequence> list = super.getNextKnuthElements(context, alignment);
if (parentLayoutManager instanceof LineLayoutManager && !fobj.hasId() && fobj.hasChildren()) {
return Collections.emptyList();
}
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
index 9473db66c..807d79b0e 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
@@ -636,11 +636,11 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage
}
}
- List returnedList = body.getChangedKnuthElements(oldList, alignment);
+ List<ListElement> returnedList = body.getChangedKnuthElements(oldList, alignment);
// "wrap" the Position inside each element
- List tempList = returnedList;
+ List<ListElement> tempList = returnedList;
KnuthElement tempElement;
- returnedList = new LinkedList();
+ returnedList = new LinkedList<>();
for (Object aTempList : tempList) {
tempElement = (KnuthElement) aTempList;
tempElement.setPosition(new NonLeafPosition(this, tempElement.getPosition()));
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
index 3b263b09f..6fce25c66 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
@@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.LayoutContext;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.util.BreakUtil;
@@ -58,8 +59,8 @@ class RowGroupLayoutManager {
this.tableStepper = tableStepper;
}
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment, int bodyType) {
- LinkedList returnList = new LinkedList();
+ public LinkedList<ListElement> getNextKnuthElements(LayoutContext context, int alignment, int bodyType) {
+ LinkedList<ListElement> returnList = new LinkedList<>();
createElementsForRowGroup(context, alignment, bodyType, returnList);
context.updateKeepWithPreviousPending(rowGroup[0].getKeepWithPrevious());
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
index cba4c2fae..b62e066d8 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
@@ -54,6 +54,7 @@ import org.apache.fop.layoutmgr.KnuthGlue;
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.LocalBreaker;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
@@ -168,7 +169,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager {
/**
* {@inheritDoc}
*/
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
MinOptMax stackLimit = context.getStackLimitBP();
referenceIPD = context.getRefIPD();
@@ -177,7 +178,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager {
List returnedList;
List contentList = new LinkedList();
- List returnList = new LinkedList();
+ List<ListElement> returnList = new LinkedList<>();
LayoutManager curLM; // currently active LM
LayoutManager prevLM = null; // previously active LM
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
index a887215f6..e656b505c 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
@@ -152,7 +152,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
KnuthBox headerAsFirst = null;
KnuthBox headerAsSecondToLast = null;
KnuthBox footerAsLast = null;
- LinkedList returnList = new LinkedList();
+ LinkedList<ListElement> returnList = new LinkedList<>();
int headerFootnoteBPD = 0;
if (headerIter != null && headerList == null) {
this.headerList = getKnuthElementsForRowIterator(
@@ -213,20 +213,20 @@ public class TableContentLayoutManager implements PercentBaseContext {
bodyIter, context, alignment, TableRowIterator.BODY));
if (headerAsFirst != null) {
int insertionPoint = 0;
- if (returnList.size() > 0 && ((ListElement)returnList.getFirst()).isForcedBreak()) {
+ if (returnList.size() > 0 && returnList.getFirst().isForcedBreak()) {
insertionPoint++;
}
returnList.add(insertionPoint, headerAsFirst);
} else if (headerAsSecondToLast != null) {
int insertionPoint = returnList.size();
- if (returnList.size() > 0 && ((ListElement)returnList.getLast()).isForcedBreak()) {
+ if (returnList.size() > 0 && returnList.getLast().isForcedBreak()) {
insertionPoint--;
}
returnList.add(insertionPoint, headerAsSecondToLast);
}
if (footerAsLast != null) {
int insertionPoint = returnList.size();
- if (returnList.size() > 0 && ((ListElement)returnList.getLast()).isForcedBreak()) {
+ if (returnList.size() > 0 && returnList.getLast().isForcedBreak()) {
insertionPoint--;
}
returnList.add(insertionPoint, footerAsLast);
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index 182f3e8f7..91390dbcd 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -203,9 +203,9 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
- List returnList = new LinkedList();
+ List<ListElement> returnList = new LinkedList<>();
/*
* Compute the IPD and adjust it if necessary (overconstrained)