From a90458eea915f6f944a81c2cc73fafe83c8b9263 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Wed, 26 Jun 2024 11:43:12 +0100 Subject: Add generics to layout --- .../org/apache/fop/layoutmgr/BlockContainerLayoutManager.java | 6 +++--- .../main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java | 4 ++-- .../java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java | 8 ++++---- .../src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java | 8 ++++---- .../org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java | 5 +++-- .../org/apache/fop/layoutmgr/inline/ContentLayoutManager.java | 2 +- .../org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java | 4 ++-- .../java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java | 3 ++- .../java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java | 8 ++++---- .../java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java | 2 +- .../org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java | 5 +++-- .../apache/fop/layoutmgr/list/ListItemContentLayoutManager.java | 2 +- .../java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java | 4 ++-- .../org/apache/fop/layoutmgr/table/TableContentLayoutManager.java | 2 +- 14 files changed, 33 insertions(+), 30 deletions(-) diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index dced73317..ad49720e8 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -182,7 +182,7 @@ public class BlockContainerLayoutManager extends SpacedBorderedPaddedBlockLayout /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements(LayoutContext context, int alignment) { return getNextKnuthElements(context, alignment, null, null, null); } @@ -203,7 +203,7 @@ public class BlockContainerLayoutManager extends SpacedBorderedPaddedBlockLayout /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, + public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { resetSpaces(); @@ -659,7 +659,7 @@ public class BlockContainerLayoutManager extends SpacedBorderedPaddedBlockLayout return lc; } - protected List getNextKnuthElements(LayoutContext context, int alignment) { + protected List getNextKnuthElements(LayoutContext context, int alignment) { LayoutManager curLM; // currently active LM List returnList = new LinkedList(); diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 92fac64c4..afa90ef64 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -101,13 +101,13 @@ public class BlockLayoutManager extends SpacedBorderedPaddedBlockLayoutManager /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements(LayoutContext context, int alignment) { return getNextKnuthElements(context, alignment, null, null, null); } /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, + public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { resetSpaces(); return super.getNextKnuthElements( diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 1e55edd07..cecc3211e 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -237,13 +237,13 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements(LayoutContext context, int alignment) { return getNextKnuthElements(context, alignment, null, null, null); } /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment, + public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { isRestartAtLM = restartAtLM != null; referenceIPD = context.getRefIPD(); @@ -669,12 +669,12 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment) { + public List getChangedKnuthElements(List oldList, int alignment) { ListIterator oldListIterator = oldList.listIterator(); KnuthElement currElement = null; KnuthElement prevElement = null; List returnedList = new LinkedList(); - List returnList = new LinkedList(); + List returnList = new LinkedList<>(); int fromIndex = 0; // "unwrap" the Positions stored in the elements diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java index 9a625ad73..1d5acdee1 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -65,7 +65,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager { /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements(LayoutContext context, int alignment) { return getNextKnuthElements(context, alignment, null, null); } @@ -79,7 +79,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager { * @return the list of KnuthElements * @see LayoutManager#getNextKnuthElements(LayoutContext,int) */ - List getNextKnuthElements(LayoutContext context, int alignment, + List getNextKnuthElements(LayoutContext context, int alignment, Position restartPosition, LayoutManager restartLM) { List elements = new LinkedList(); @@ -289,11 +289,11 @@ public class FlowLayoutManager extends BlockStackingLayoutManager { /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment) { + public List getChangedKnuthElements(List oldList, int alignment) { ListIterator oldListIterator = oldList.listIterator(); KnuthElement returnedElement; List returnedList = new LinkedList(); - List returnList = new LinkedList(); + List returnList = new LinkedList<>(); KnuthElement prevElement = null; KnuthElement currElement = null; int fromIndex = 0; 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 1ba50e992..9bf6063f7 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 @@ -36,6 +36,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.TraitSetter; import org.apache.fop.traits.MinOptMax; @@ -188,12 +189,12 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment) { + public List getChangedKnuthElements(List oldList, int alignment) { if (isFinished()) { return null; } - LinkedList returnList = new LinkedList(); + LinkedList returnList = new LinkedList<>(); addKnuthElementsForBorderPaddingStart(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 0b419217c..ba520c5bc 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 @@ -252,7 +252,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements(LayoutContext context, int alignment) { List contentList = new LinkedList(); List returnedList; 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 1fd29eb59..289cb9a49 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 @@ -75,7 +75,7 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager { /** {@inheritDoc} */ @Override - public List getNextKnuthElements(LayoutContext context, + public List getNextKnuthElements(LayoutContext context, int alignment) { // for the moment, this LM is set as the citationLM's parent // later on, when this LM will have nothing more to do, the citationLM's parent @@ -125,7 +125,7 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager { /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment, int depth) { + public List getChangedKnuthElements(List oldList, int alignment, int depth) { List returnedList = super.getChangedKnuthElements(oldList, alignment, depth); addAnchor(returnedList); return returnedList; 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 08a85a931..360c1816e 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 @@ -51,6 +51,7 @@ import org.apache.fop.layoutmgr.KnuthBox; 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.NonLeafPosition; import org.apache.fop.layoutmgr.Position; import org.apache.fop.layoutmgr.PositionIterator; @@ -566,7 +567,7 @@ public class InlineLayoutManager extends InlineStackingLayoutManager { /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment, int depth) { + public List getChangedKnuthElements(List oldList, int alignment, int depth) { List returnedList = new LinkedList(); addKnuthElementsForBorderPaddingStart(returnedList); returnedList.addAll(super.getChangedKnuthElements(oldList, alignment, depth)); 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 9ba707e3c..1b186109c 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 @@ -649,7 +649,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager * @return the list of KnuthElements * @see LayoutManager#getNextKnuthElements(LayoutContext,int) */ - public List getNextKnuthElements(LayoutContext context, int alignment, + public List getNextKnuthElements(LayoutContext context, int alignment, LeafPosition restartPosition) { int parIndex = 0; int restartPositionIdx = 0; @@ -1220,14 +1220,14 @@ public class LineLayoutManager extends InlineStackingLayoutManager /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment, int depth) { + public List getChangedKnuthElements(List oldList, int alignment, int depth) { return getChangedKnuthElements(oldList, alignment); } /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment) { - List returnList = new LinkedList(); + public List getChangedKnuthElements(List oldList, int alignment) { + List returnList = new LinkedList<>(); for (int p = 0; p < knuthParagraphs.size(); p++) { LineLayoutPossibilities llPoss = lineLayoutsList[p]; //log.debug("demerits of the chosen layout: " + llPoss.getChosenDemerits()); 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 aab2dd56c..e6b64cb2d 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 @@ -760,7 +760,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager { } /** {@inheritDoc} */ - public List getNextKnuthElements(final LayoutContext context, final int alignment) { + public List getNextKnuthElements(final LayoutContext context, final int alignment) { lineStartBAP = context.getLineStartBorderAndPaddingWidth(); lineEndBAP = context.getLineEndBorderAndPaddingWidth(); diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index b73abeb0d..10c444cce 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -34,6 +34,7 @@ import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.layoutmgr.ElementListUtils; import org.apache.fop.layoutmgr.LayoutContext; import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.ListElement; import org.apache.fop.layoutmgr.NonLeafPosition; import org.apache.fop.layoutmgr.Position; import org.apache.fop.layoutmgr.PositionIterator; @@ -96,8 +97,8 @@ public class ListBlockLayoutManager extends SpacedBorderedPaddedBlockLayoutManag } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, - Position restartPosition, LayoutManager restartAtLM) { + public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, + Position restartPosition, LayoutManager restartAtLM) { resetSpaces(); List returnList; returnList = super.getNextKnuthElements(context, alignment, lmStack, restartPosition, restartAtLM); diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java index 0cc877e37..acb06bbf4 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java @@ -228,7 +228,7 @@ public class ListItemContentLayoutManager extends BlockStackingLayoutManager imp } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, + public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { List elements = new LinkedList(); do { 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 807d79b0e..94764ed4a 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 @@ -211,7 +211,7 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage } /** {@inheritDoc} */ - public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, + public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack, Position restartPosition, LayoutManager restartAtLM) { referenceIPD = context.getRefIPD(); LayoutContext childLC; @@ -614,7 +614,7 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage /** {@inheritDoc} */ @Override - public List getChangedKnuthElements(List oldList, int alignment) { + public List getChangedKnuthElements(List oldList, int alignment) { // label labelList = label.getChangedKnuthElements(labelList, alignment); 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 e656b505c..03d27b146 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 @@ -145,7 +145,7 @@ public class TableContentLayoutManager implements PercentBaseContext { * @return the list of KnuthElements * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int) */ - public List getNextKnuthElements(LayoutContext context, int alignment) { + public List getNextKnuthElements(LayoutContext context, int alignment) { if (LOG.isDebugEnabled()) { LOG.debug("==> Columns: " + getTableLM().getColumns()); } -- cgit v1.2.3