aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2024-06-26 11:43:12 +0100
committerSimon Steiner <ssteiner@apache.org>2024-06-26 11:43:12 +0100
commita90458eea915f6f944a81c2cc73fafe83c8b9263 (patch)
tree54cd9c77dc5ea9d396ab282892f4e07c8ca7ec5b
parent3d750f3289559f3896a61ab694d7f1a4481d720b (diff)
downloadxmlgraphics-fop-a90458eea915f6f944a81c2cc73fafe83c8b9263.tar.gz
xmlgraphics-fop-a90458eea915f6f944a81c2cc73fafe83c8b9263.zip
Add generics to layout
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java6
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java8
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java3
-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.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java5
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java2
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java2
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<ListElement> 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<ListElement> 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<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM; // currently active LM
List<ListElement> returnList = new LinkedList<ListElement>();
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<ListElement> 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<ListElement> 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<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
return getNextKnuthElements(context, alignment, null, null, null);
}
/** {@inheritDoc} */
@Override
- public List getNextKnuthElements(LayoutContext context, int alignment,
+ public List<ListElement> 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<ListElement> getChangedKnuthElements(List oldList, int alignment) {
ListIterator<KnuthElement> oldListIterator = oldList.listIterator();
KnuthElement currElement = null;
KnuthElement prevElement = null;
List<KnuthElement> returnedList = new LinkedList<KnuthElement>();
- List<KnuthElement> returnList = new LinkedList<KnuthElement>();
+ List<ListElement> 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<ListElement> 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<ListElement> getNextKnuthElements(LayoutContext context, int alignment,
Position restartPosition, LayoutManager restartLM) {
List<ListElement> elements = new LinkedList<ListElement>();
@@ -289,11 +289,11 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
/** {@inheritDoc} */
@Override
- public List<KnuthElement> getChangedKnuthElements(List oldList, int alignment) {
+ public List<ListElement> getChangedKnuthElements(List oldList, int alignment) {
ListIterator<KnuthElement> oldListIterator = oldList.listIterator();
KnuthElement returnedElement;
List<KnuthElement> returnedList = new LinkedList<KnuthElement>();
- List<KnuthElement> returnList = new LinkedList<KnuthElement>();
+ List<ListElement> 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<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
if (isFinished()) {
return null;
}
- LinkedList<KnuthElement> returnList = new LinkedList<KnuthElement>();
+ LinkedList<ListElement> 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<ListElement> 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<KnuthSequence> 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<ListElement> getChangedKnuthElements(List<ListElement> 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<ListElement> getChangedKnuthElements(List<ListElement> 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<ListElement> 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<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
return getChangedKnuthElements(oldList, alignment);
}
/** {@inheritDoc} */
@Override
- public List getChangedKnuthElements(List oldList, int alignment) {
- List<KnuthElement> returnList = new LinkedList<KnuthElement>();
+ public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
+ List<ListElement> 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<KnuthSequence> 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<ListElement> 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<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
List<ListElement> elements = new LinkedList<ListElement>();
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<ListElement> 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<ListElement> 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<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> Columns: " + getTableLM().getColumns());
}