foray-commit Mailing List for FOray (Page 62)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(4) |
Dec
|
|
From: <vic...@us...> - 2022-01-07 11:40:17
|
Revision: 12352
http://sourceforge.net/p/foray/code/12352
Author: victormote
Date: 2022-01-07 11:40:15 +0000 (Fri, 07 Jan 2022)
Log Message:
-----------
Improvements to page-level overflow.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-06 14:58:34 UTC (rev 12351)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-07 11:40:15 UTC (rev 12352)
@@ -310,10 +310,8 @@
}
@Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- final RegionBodyRa4a bodyRegion = (RegionBodyRa4a) ancestorArea()
- .getOverflowArea(this);
+ public MainRa4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ final RegionBodyRa4a bodyRegion = getParent().getOverflowArea(this);
return bodyRegion.getMainRefArea();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-06 14:58:34 UTC (rev 12351)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-07 11:40:15 UTC (rev 12352)
@@ -149,7 +149,7 @@
final Fo fo = this.traitGeneratedBy();
final org.axsl.area.NormalBlockArea nbArea;
if (fo instanceof Block) {
- nbArea = bcFactory.makeNormalBlockArea((Block) fo);
+ nbArea = bcFactory.makeNormalBlockArea((Block) fo);
} else {
nbArea = bcFactory.makeNormalBlockArea((BlockDiscrete) fo);
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java 2022-01-06 14:58:34 UTC (rev 12351)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java 2022-01-07 11:40:15 UTC (rev 12352)
@@ -92,22 +92,30 @@
}
@Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- // If my children are overflowed, I must be also.
- final Area4a overflowArea = ancestorArea().getOverflowArea(this);
- // If parent SpanArea can create another column
- if (overflowArea instanceof NormalFlowRa4a) {
- final NormalFlowRa4a nf = (NormalFlowRa4a) overflowArea;
- /* TODO: This cast is suspicious. */
- final Block block = (Block) childRequesting.traitGeneratedBy();
- return nf.makeNormalBlockArea(block);
+ public NormalFlowRa4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ final AreaNode4a nextSibling = this.getNextSibling();
+ if (nextSibling != null) {
+ /* My parent is always a SpanRa4a, whose children are always NormalFlowRa4a. */
+ return (NormalFlowRa4a) nextSibling;
}
- // If a new page was created
- if (overflowArea instanceof MainRa4a) {
- return overflowArea;
- }
- throw new AreaTreeException("ColumnRA overflow failed.");
+
+ final SpanRa4a newSpan = getParent().getOverflowArea(this);
+ return newSpan.areaNodeAt(0);
+
+// // If my children are overflowed, I must be also.
+// final Area4a overflowArea = ancestorArea().getOverflowArea(this);
+// // If parent SpanArea can create another column
+// if (overflowArea instanceof NormalFlowRa4a) {
+// final NormalFlowRa4a nf = (NormalFlowRa4a) overflowArea;
+// /* TODO: This cast is suspicious. */
+// final Block block = (Block) childRequesting.traitGeneratedBy();
+// return nf.makeNormalBlockArea(block);
+// }
+// // If a new page was created
+// if (overflowArea instanceof MainRa4a) {
+// return overflowArea;
+// }
+// throw new AreaTreeException("ColumnRA overflow failed.");
}
/**
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 14:58:34 UTC (rev 12351)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-07 11:40:15 UTC (rev 12352)
@@ -236,7 +236,7 @@
}
@Override
- public Area4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ public RegionBodyRa4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
/* The region-body cannot make another instance of itself without creating a new page. */
final PageRa4a page = getParent().getOverflowArea(this);
return page.getRegionBodyAt(0);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java 2022-01-06 14:58:34 UTC (rev 12351)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java 2022-01-07 11:40:15 UTC (rev 12352)
@@ -203,17 +203,11 @@
}
@Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- final AreaNode4a nextColumn = (AreaNode4a) childRequesting.getNextSibling();
- if (nextColumn != null & nextColumn instanceof Area4a) {
- return (Area4a) nextColumn;
- }
- /*
- * Just return the main-reference-area. The span can't be created
- * until we return back down to the first block-level area.
- */
- return ancestorArea().getOverflowArea(this);
+ public SpanRa4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ /* Spans stack in the block-progression-direction, and the last span on the page extends to the end (after-edge)
+ * of the parent main-reference-area. Therefore, if the child has overflowed, we need a new page. */
+ final MainRa4a newMainRa = getParent().getOverflowArea(this);
+ return newMainRa.areaNodeAt(0);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-06 14:58:36
|
Revision: 12351
http://sourceforge.net/p/foray/code/12351
Author: victormote
Date: 2022-01-06 14:58:34 +0000 (Thu, 06 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Change API for iteration of region-body reference areas.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java 2022-01-06 13:51:56 UTC (rev 12350)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java 2022-01-06 14:58:34 UTC (rev 12351)
@@ -193,8 +193,7 @@
}
@Override
- public PageRa makePage(final Force forceValue)
- throws AreaTreeException {
+ public PageRa4a makePage(final Force forceValue) throws AreaTreeException {
boolean isBlank = false;
if (Force.ODD.equals(forceValue)) {
if (getCurrentPageNumber() % 2 == 0) {
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-06 13:51:56 UTC (rev 12350)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-06 14:58:34 UTC (rev 12351)
@@ -55,10 +55,7 @@
import org.axsl.galley.GalleyVisitorException;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
* Area containing a page.
@@ -75,8 +72,7 @@
private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
/** The child region-body(s). */
- private Map<String, RegionBodyRa4a> bodies =
- new HashMap<String, RegionBodyRa4a>();
+ private List<RegionBodyRa4a> bodies = new ArrayList<RegionBodyRa4a>();
/** The child region-before. */
private RegionOuterRa4a before;
@@ -185,10 +181,10 @@
return this.end;
}
- @Override
- public Collection<RegionBodyRa4a> getRegionBodies() {
- return this.bodies.values();
- }
+// @Override
+// public Collection<RegionBodyRa4a> getRegionBodies() {
+// return this.bodies.values();
+// }
@Override
public int getHeight() {
@@ -239,11 +235,9 @@
private void createRegionBody() {
final SimplePageMaster simplePageMaster = getPageMaster();
for (RegionBody regionBody : simplePageMaster.getRegionBodies()) {
- final RegionBodyRa4a area = RegionBodyRa4a.makeRegionBodyArea(
- regionBody, this);
+ final RegionBodyRa4a area = RegionBodyRa4a.makeRegionBodyArea(regionBody, this);
this.children.add(area);
- final String name = regionBody.traitRegionName();
- this.bodies.put(name, area);
+ this.bodies.add(area);
}
}
@@ -442,15 +436,9 @@
}
}
- /**
- * {@inheritDoc}
- * Overrides method in Area, because at this point, a new page needs to
- * be created.
- */
@Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return (PageRa4a) getParent().makePage(Force.NONE);
+ public PageRa4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ return getParent().makePage(Force.NONE);
}
/**
@@ -727,8 +715,9 @@
* @return True if and only if this page is blank.
*/
public boolean isBlank() {
- for (RegionBodyRa4a body : this.bodies.values()) {
- if (body.areaNodeCount() > 0) {
+ for (int index = 0; index < this.bodies.size(); index ++) {
+ final RegionBodyRa4a regionBodyRa = this.bodies.get(index);
+ if (regionBodyRa.areaNodeCount() > 0) {
return false;
}
}
@@ -741,7 +730,15 @@
* @return The named region.
*/
public RegionBodyRa4a getRegionBody(final String regionName) {
- return this.bodies.get(regionName);
+ /* We could put these in a Map, but it seems unlikely that there will usually be more than one element. */
+ for (int index = 0; index < this.bodies.size(); index ++) {
+ final RegionBodyRa4a regionBodyRa = this.bodies.get(index);
+ final RegionBody regionBody = regionBodyRa.traitGeneratedBy();
+ if (regionBody.traitRegionName().equals(regionName)) {
+ return regionBodyRa;
+ }
+ }
+ return null;
}
@Override
@@ -820,4 +817,14 @@
return traitGeneratedBy().traitPageHeight();
}
+ @Override
+ public int getRegionBodyCount() {
+ return this.bodies.size();
+ }
+
+ @Override
+ public RegionBodyRa4a getRegionBodyAt(final int index) {
+ return this.bodies.get(index);
+ }
+
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 13:51:56 UTC (rev 12350)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 14:58:34 UTC (rev 12351)
@@ -57,7 +57,7 @@
private Link<RegionBody> foLink;
/** The parent of this node. */
- private AreaNode4a parent;
+ private PageRa4a parent;
/** The children of this node. */
private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
@@ -236,11 +236,10 @@
}
@Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- final PageRa4a page = (PageRa4a) ancestorArea().getOverflowArea(this);
- final String name = this.traitGeneratedBy().traitRegionName();
- return page.getRegionBody(name);
+ public Area4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
+ /* The region-body cannot make another instance of itself without creating a new page. */
+ final PageRa4a page = getParent().getOverflowArea(this);
+ return page.getRegionBodyAt(0);
}
/**
@@ -318,13 +317,13 @@
}
@Override
- public AreaNode4a getParent() {
+ public PageRa4a getParent() {
return this.parent;
}
@Override
public void setParent(final AreaNode4a node) throws AreaTreeException {
- this.parent = node;
+ throw new IllegalStateException();
}
@Override
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-01-06 13:51:56 UTC (rev 12350)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-01-06 14:58:34 UTC (rev 12351)
@@ -327,7 +327,8 @@
* @throws GalleyVisitorException For errors during rendering.
*/
protected void renderRegions(final PageG5 page) throws GalleyVisitorException {
- for (RegionAreaG5 regionBody : page.getRegionBodies()) {
+ for (int index = 0; index < page.getRegionBodyCount(); index ++) {
+ final RegionAreaG5 regionBody = page.getRegionBodyAt(index);
visit(regionBody);
}
if (page.getRegionBefore() != null) {
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2022-01-06 13:51:56 UTC (rev 12350)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2022-01-06 14:58:34 UTC (rev 12351)
@@ -125,9 +125,12 @@
if (end != null) {
visit(end);
}
- for (RegionAreaG5 regionBody : page.getRegionBodies()) {
+
+ for (int index = 0; index < page.getRegionBodyCount(); index ++) {
+ final RegionAreaG5 regionBody = page.getRegionBodyAt(index);
visit(regionBody);
}
+
this.writeEndTag(page);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-06 13:51:59
|
Revision: 12350
http://sourceforge.net/p/foray/code/12350
Author: victormote
Date: 2022-01-06 13:51:56 +0000 (Thu, 06 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Make parent and child types more specific.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaFixed.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaFixed.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaFixed.java 2022-01-06 13:09:02 UTC (rev 12349)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaFixed.java 2022-01-06 13:51:56 UTC (rev 12350)
@@ -48,7 +48,7 @@
@Override
public int pdAvailable() {
int dimension = brBpd();
- final List<AreaNode4a> children = getChildren();
+ final List<? extends AreaNode4a> children = getChildren();
for (int i = 0; i < children.size(); i++) {
if (children.get(i) instanceof AreaFlexible) {
final AreaFlexible child = (AreaFlexible) children.get(i);
@@ -88,7 +88,7 @@
}
@Override
- public abstract List<AreaNode4a> getChildren();
+ public abstract List<? extends AreaNode4a> getChildren();
@Override
public boolean isAbsolutelyPositioned() {
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-06 13:09:02 UTC (rev 12349)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-06 13:51:56 UTC (rev 12350)
@@ -59,10 +59,10 @@
private Link<RegionBody> foLink;
/** The parent of this node. */
- private AreaNode4a parent;
+ private RegionBodyRa4a parent;
/** The children of this node. */
- private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
+ private List<SpanRa4a> children = new ArrayList<SpanRa4a>();
/** Indicates whether this is a new span area. */
private boolean isNewSpanArea;
@@ -89,6 +89,30 @@
}
@Override
+ public RegionBodyRa4a getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(final AreaNode4a node) throws AreaTreeException {
+ if (node instanceof RegionBodyRa4a) {
+ this.parent = (RegionBodyRa4a) node;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ @Override
+ public List<SpanRa4a> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ public SpanRa4a areaNodeAt(final int childIndex) {
+ return this.children.get(childIndex);
+ }
+
+ @Override
public NormalFlowRa4a getNormalFlow(final Fo fo) throws AreaTreeException {
/* The next cut of this method should also inspect the FO to see
* whether the area to be returned ought not to be the footnote
@@ -109,8 +133,8 @@
return addSpanArea(traitColumnCount());
}
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size() - 1);
+ final List<SpanRa4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = spanAreas.get(spanAreas.size() - 1);
if ((span == Span.ALL)
&& (spanArea.traitColumnCount() == 1)) {
@@ -170,9 +194,8 @@
return false;
}
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size()
- - 1);
+ final List<SpanRa4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = spanAreas.get(spanAreas.size() - 1);
if (spanArea.isBalanced()) {
return false;
@@ -211,8 +234,8 @@
*/
@Override
public void resetSpanArea() {
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size() - 1);
+ final List<SpanRa4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = spanAreas.get(spanAreas.size() - 1);
if (!spanArea.isBalanced()) {
// span area maintains a record of the total height of
@@ -238,8 +261,8 @@
*/
@Override
public boolean isLastColumn() {
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size() - 1);
+ final List<SpanRa4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = spanAreas.get(spanAreas.size() - 1);
return spanArea.isLastColumn();
}
@@ -259,8 +282,8 @@
* @return The current column area.
*/
public NormalFlowRa4a getCurrentColumnArea() {
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size() - 1);
+ final List<SpanRa4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = spanAreas.get(spanAreas.size() - 1);
return spanArea.getCurrentColumnArea();
}
@@ -330,21 +353,6 @@
}
@Override
- public AreaNode4a getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- this.parent = node;
- }
-
- @Override
- public List<AreaNode4a> getChildren() {
- return this.children;
- }
-
- @Override
protected boolean optimize() {
this.optimizeChildren();
return false;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java 2022-01-06 13:09:02 UTC (rev 12349)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java 2022-01-06 13:51:56 UTC (rev 12350)
@@ -54,7 +54,7 @@
private Link<RegionBody> foLink;
/** The parent of this node. */
- private AreaNode4a parent;
+ private MainRa4a parent;
/** The children of this node. */
private List<NormalFlowRa4a> children = new ArrayList<NormalFlowRa4a>();
@@ -103,6 +103,30 @@
return newSpanArea;
}
+ @Override
+ public MainRa4a getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(final AreaNode4a node) throws AreaTreeException {
+ if (node instanceof MainRa4a) {
+ this.parent = (MainRa4a) node;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ @Override
+ public List<NormalFlowRa4a> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ public NormalFlowRa4a areaNodeAt(final int childIndex) {
+ return this.children.get(childIndex);
+ }
+
/**
* Returns the width of the columns in this span.
* @return The width of each column in this span.
@@ -346,21 +370,6 @@
return RelativeAxis.BLOCK_PROGRESSION;
}
- @Override
- public AreaNode4a getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- this.parent = node;
- }
-
- @Override
- public List<NormalFlowRa4a> getChildren() {
- return this.children;
- }
-
/**
* Moves a child from one parent to the last child of another parent.
* @param child The child to be moved.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-06 13:09:05
|
Revision: 12349
http://sourceforge.net/p/foray/code/12349
Author: victormote
Date: 2022-01-06 13:09:02 +0000 (Thu, 06 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: 1. Remove unneeded method. 2. Add doc regarding differences between reference-areas related to regions.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 12:45:15 UTC (rev 12348)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 13:09:02 UTC (rev 12349)
@@ -46,10 +46,12 @@
import java.util.List;
/**
- * Area containing a region-body.
+ * <p>The reference-area for an fo:region-body.</p>
+ *
+ * <p>See {@link RegionBodyRa} for an explanation of why the areas related to fo:region-body are distinct from those
+ * related to the outer regions (fo:region-before, etc.).</p>
*/
public final class RegionBodyRa4a extends AreaFixed implements RegionBodyRa {
- /* TODO: Why doesn't this class extend RegionRa? */
/** The link to the FO tree. */
private Link<RegionBody> foLink;
@@ -421,10 +423,4 @@
return traitGeneratedBy().traitStartIndent(this);
}
- @Override
- public int traitExtent() {
- /* TODO: Eliminate the need for this in the parent interface. */
- return 0;
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-06 12:45:18
|
Revision: 12348
http://sourceforge.net/p/foray/code/12348
Author: victormote
Date: 2022-01-06 12:45:15 +0000 (Thu, 06 Jan 2022)
Log Message:
-----------
Remove some unnecessary direct dependencies on axsl-galley.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
trunk/foray/foray-areatree/src/test/java/org/foray/area/TestPageCollection.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -32,7 +32,7 @@
import org.foray.area.AreaTree4a;
import org.foray.area.MainRa4a;
import org.foray.area.NormalFlowRa4a;
-import org.foray.area.PageCollection;
+import org.foray.area.PageCollection4a;
import org.foray.area.PageRa4a;
import org.foray.area.RegionBodyRa4a;
import org.foray.area.SpanRa4a;
@@ -95,7 +95,7 @@
* @return The first normal-flow reference area in {@code areaTree}.
*/
protected NormalFlowRa4a getFirstNormalFlowArea(final AreaTree4a areaTree) {
- final PageCollection pageCollection = getPageCollection(areaTree, 1);
+ final PageCollection4a pageCollection = getPageCollection(areaTree, 1);
final PageRa4a firstPage = getPage(pageCollection, 1);
final RegionBodyRa4a regionBody = firstPage.getRegionBody(
"xsl-region-body");
@@ -117,11 +117,11 @@
* etc.
* @return The requested page collection, or null if it does not exist.
*/
- protected PageCollection getPageCollection(final AreaTree4a areaTree,
+ protected PageCollection4a getPageCollection(final AreaTree4a areaTree,
final int collectionNum) {
final AreaNode4a node = areaTree.areaNodeAt(0);
- Assert.assertTrue(node instanceof PageCollection);
- final PageCollection pageCollection = (PageCollection) node;
+ Assert.assertTrue(node instanceof PageCollection4a);
+ final PageCollection4a pageCollection = (PageCollection4a) node;
return pageCollection;
}
@@ -133,7 +133,7 @@
* is, "1" for the first page in the collection, "2" for the second, etc.
* @return The requested page, or null if it does not exist.
*/
- protected PageRa4a getPage(final PageCollection pageCollection,
+ protected PageRa4a getPage(final PageCollection4a pageCollection,
final int pageNum) {
Assert.assertNotNull(pageCollection);
/* Convert the ordinal page number to an index into the children. */
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AreaTreeCreator.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -32,7 +32,7 @@
import org.foray.app.fo.FoDocumentReader;
import org.foray.area.AreaTree4a;
import org.foray.area.AreaTreeFactory4a;
-import org.foray.area.PageCollection;
+import org.foray.area.PageCollection4a;
import org.foray.core.ForayException;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeServer4a;
@@ -115,7 +115,7 @@
while (iterator.hasNext()) {
final PageSequence4a pageSequence = iterator.next();
try {
- final PageCollection collection = areaTree.makePageCollection(
+ final PageCollection4a collection = areaTree.makePageCollection(
pageSequence);
layout.formatPageSequence(collection);
} catch (final AreaTreeException e) {
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -34,7 +34,7 @@
import org.foray.area.LineArea4a;
import org.foray.area.NormalBlockArea4a;
import org.foray.area.NormalFlowRa4a;
-import org.foray.area.PageCollection;
+import org.foray.area.PageCollection4a;
import org.foray.area.TextArea;
import org.foray.common.FontContext4a;
import org.foray.core.ForayException;
@@ -171,7 +171,7 @@
public void testBlock002() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-002.fo", getTextServer(), getLineBreakerFactory());
- final PageCollection pageCollection = this.getPageCollection(areaTree,
+ final PageCollection4a pageCollection = this.getPageCollection(areaTree,
1);
final int numPages = pageCollection.areaNodeCount();
Assert.assertEquals(2, numPages);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -484,7 +484,7 @@
* Returns the ancestor page collection for this area.
* @return The ancestor page collection.
*/
- public PageCollection ancestorPageCollection() {
+ public PageCollection4a ancestorPageCollection() {
final AreaNode4a parent = getParent();
if (parent == null) {
return null;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -69,7 +69,7 @@
private FoTree foTree;
/** The children of this node. */
- private List<PageCollection> children = new ArrayList<PageCollection>();
+ private List<PageCollection4a> children = new ArrayList<PageCollection4a>();
/** The bookmark tree for this document. */
private BookmarkTreeArea bookmarkTreeArea;
@@ -103,7 +103,7 @@
* Since there is a one-to-one relationship between PageCollection and PageSequence, it can also be used to get an
* ordered list of PageSequence objects.
*/
- private List<PageCollection> pageCollectionsProcessed = new ArrayList<PageCollection>();
+ private List<PageCollection4a> pageCollectionsProcessed = new ArrayList<PageCollection4a>();
/**
* Collection of objects that have registered to be notified about {@link AreaTreeEvent} firings.
@@ -159,18 +159,18 @@
}
@Override
- public PageCollection makePageCollection(
+ public PageCollection4a makePageCollection(
final PageSequence pageSequence) throws AreaTreeException {
final int lastPageNumber;
final int collectionsProcessed = this.pageCollectionsProcessed.size();
if (collectionsProcessed > 0) {
- final PageCollection lastPageCollection =
+ final PageCollection4a lastPageCollection =
this.pageCollectionsProcessed.get(collectionsProcessed - 1);
lastPageNumber = lastPageCollection.getLastPageNumber();
} else {
lastPageNumber = 0;
}
- final PageCollection pageCollection = PageCollection.makePageCollection(
+ final PageCollection4a pageCollection = PageCollection4a.makePageCollection(
pageSequence, this, lastPageNumber);
this.children.add(pageCollection);
this.pageCollectionsProcessed.add(pageCollection);
@@ -367,7 +367,7 @@
* Returns the collection of page collections that have been processed.
* @return Returns the pageCollectionsProcessed.
*/
- public List<PageCollection> getPageCollectionsProcessed() {
+ public List<PageCollection4a> getPageCollectionsProcessed() {
return this.pageCollectionsProcessed;
}
@@ -382,7 +382,7 @@
}
@Override
- public List<PageCollection> getChildren() {
+ public List<PageCollection4a> getChildren() {
return this.children;
}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -1,453 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-import org.foray.common.WellKnownConstants;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.area.PageRa;
-import org.axsl.common.PositiveIntegerFormatter;
-import org.axsl.common.value.ForcePageCount;
-import org.axsl.fotree.FoTreeException;
-import org.axsl.fotree.fo.FolioPrefix;
-import org.axsl.fotree.fo.FolioSuffix;
-import org.axsl.fotree.fo.Marker;
-import org.axsl.fotree.fo.PageMasterResolver;
-import org.axsl.fotree.fo.PageSequence;
-import org.axsl.fotree.fo.SimplePageMaster;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.PageCollectionG5;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * PageCollection is not really an Area. It is a convenience class that is
- * intended to be analogous to the PageSequence in the FOTree, which should
- * be considered its cousin. Its parent should always be an AreaTree instance,
- * and its children should always be PageRa instances.
- */
-public final class PageCollection extends NonArea implements PageCollectionG5, org.axsl.area.PageCollection {
-
- /** The link to the FO tree. */
- private Link<PageSequence> foLink;
-
- /** The parent of this node. */
- private AreaTree4a parent;
-
- /** The children of this node. */
- private List<PageRa4a> children = new ArrayList<PageRa4a>();
-
- /** The number of pages (so far) in this PageCollection. */
- private int pageCount = 0;
-
- /** Except during the time a new page is actually being created,
- * currentPageNumber shows the next <em>expected</em> page number to be
- * created. The last page number assigned is one less. */
- private int currentPageNumber;
-
- /** The markers found in this current page sequence. */
- private List<Marker> currentPageSequenceMarkers = new ArrayList<Marker>();
-
- /** The page-master resolver used to resolve page creation for this page
- * collection. */
- private PageMasterResolver pageMasterResolver;
-
- /**
- * Private Constructor.
- * @param parentArea The parent area tree.
- */
- private PageCollection(final AreaTree4a parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The "cousin" PageSequence object for which this PageCollection is created.
- * @param parentArea The parent area tree.
- * @param lastPageNumber The last page number that was used by the previous page collection.
- * @return The new instance.
- * @throws AreaTreeException If the FO Tree does not have sufficient information to create the needed pages for
- * padding.
- */
- static PageCollection makePageCollection(final PageSequence generatedBy, final AreaTree4a parentArea,
- final int lastPageNumber) throws AreaTreeException {
- final PageCollection newCollection = new PageCollection(parentArea);
- newCollection.foLink = newCollection.getLink(generatedBy);
- newCollection.registerLink(generatedBy);
- newCollection.pageMasterResolver = generatedBy.makePageMasterResolver(
- lastPageNumber);
- return newCollection;
- }
-
- /**
- * {@inheritDoc}
- * Overrides Area method, because anybody trying to run that method
- * on an AreaTree instance will get an NPE, since it uses getParent().
- */
- @Override
- public PageRa4a getPage() {
- return null;
- }
-
- @Override
- public PageSequence getPageSequence() {
- return this.traitGeneratedBy();
- }
-
- @Override
- public int getPageCount() {
- return this.pageCount;
- }
-
- /**
- * Increases the page count by 1.
- */
- public void incrementPageCount() {
- this.pageCount++;
- }
-
- /**
- * Returns the sequence number of this PageCollection, starting at 0.
- * The first PageCollection in the AreaTree will return 0, the second will
- * return 1, etc.
- * @return The sequence number of this PageCollection, starting at 0, or a
- * -1 if this PageCollection is not found.
- */
- public int sequence() {
- return getAreaTree().getPageCollectionsProcessed().indexOf(this);
- }
-
- /**
- * Returns the PageCollection previous to this one from the sequence of
- * PageCollection instances.
- * @return The previous PageCollection, or null if this is the first one.
- */
- public PageCollection previousPageCollection() {
- final int sequence = sequence();
- if (sequence > 0) {
- return getAreaTree().getPageCollectionsProcessed()
- .get(sequence - 1);
- }
- return null;
- }
-
- /**
- * Returns the current page number.
- * @return The current page number.
- */
- public int getCurrentPageNumber() {
- return this.currentPageNumber;
- }
-
- /**
- * Returns the last page number used.
- * @return The last page number used.
- */
- public int getLastPageNumber() {
- return this.currentPageNumber - 1;
- }
-
- /**
- * Returns the markers in this page sequence.
- * @return The markers in this page sequence.
- */
- public List<Marker> getCurrentPageSequenceMarkers() {
- return this.currentPageSequenceMarkers;
- }
-
- /**
- * Returns the markers in this document.
- * @return The markers in this document.
- */
- public List<Marker> getDocumentMarkers() {
- return getAreaTree().getDocumentMarkers();
- }
-
- @Override
- public PageRa makePage(final Force forceValue)
- throws AreaTreeException {
- boolean isBlank = false;
- if (Force.ODD.equals(forceValue)) {
- if (getCurrentPageNumber() % 2 == 0) {
- isBlank = true;
- }
- } else if (Force.EVEN.equals(forceValue)) {
- if (getCurrentPageNumber() % 2 == 1) {
- isBlank = true;
- }
- }
- final PageSequence pageSeq = getPageSequence();
- SimplePageMaster spm = null;
- try {
- spm = this.pageMasterResolver.getNextPageMaster(isBlank);
- } catch (final FoTreeException e) {
- throw new AreaTreeException(e);
- }
- final PageRa4a newPage = PageRa4a.makePageArea(spm, this);
- this.children.add(newPage);
- final int newPageNumber = getCurrentPageNumber();
- newPage.setNumber(newPageNumber);
- final CharSequence formattedPageNumber = pageSeq.formatPageNumber(
- newPageNumber);
- newPage.setFormattedNumber(formattedPageNumber);
- if (!isBlank) {
- getLogger().info("[" + formattedPageNumber + "]");
- } else {
- getLogger().info("[" + formattedPageNumber + "] (blank)");
- }
- this.currentPageNumber++;
- incrementPageCount();
- return newPage;
- }
-
- /**
- * This method creates any blank pages that are needed at the beginning of
- * an PageCollection to meet the related PageSequence's constraints.
- * @throws AreaTreeException If the FO Tree cannot provide the
- * information needed to add the pages needed for padding.
- */
- public void padPagesAtBeginning() throws AreaTreeException {
- final PageSequence pageSeq = getPageSequence();
- final PageCollection previousPageCollection = previousPageCollection();
- if (previousPageCollection == null) {
- this.currentPageNumber = pageSeq.traitInitialPageNumber(0);
- return;
- }
- final int lastPageNumber =
- previousPageCollection.getCurrentPageNumber() - 1;
- final int computedPageNumber = pageSeq.traitInitialPageNumber(
- lastPageNumber);
- if (pageSeq.initialPageNumberSetExplicitly()) {
- /*
- * If the user set the page number explicitly, there is nothing
- * else to do but set it and go.
- */
- this.currentPageNumber = computedPageNumber;
- return;
- }
- final int pagesToAdd = computedPageNumber - lastPageNumber - 1;
- if (pagesToAdd > 0) {
- /*
- * For now, the most number of blank pages we will create here is 1.
- *
- * We could conceivably create as many blank pages as would be required
- * to get to a user-set initial-page-number="<number>", but for now we
- * won't.
- *
- * It is tempting to ensure that an odd initial-page-number will start
- * on an odd page, and vice versa, but we won't do that because the
- * user has the ability to tell us to do that explicitly.
- *
- * For other initial-page-number settings, there could be as many as
- * 3 blank pages generated between page-sequences. We're not sure, but
- * we think that this is not the intent of the standard. Here are some
- * examples:
- *
- * Example 1: The previous page-sequence has
- * force-page-count="end-on-even", the last page with content in that
- * page-sequence is an odd page, and the current page-sequence has
- * initial-page-number="auto-odd". There must be two blank pages to
- * satisfy these constraints, one created at the end of the previous
- * page-sequence, one at the beginning of this one.
- *
- * Example 2: The same as Example 1, except that the current
- * page-sequence has initial-page-number="auto-even". Unless a page
- * can be part of two different page sequences, this requires a total
- * of three blank pages, one created at the end of the previous
- * page-sequence, and two at the beginning of this one.
- *
- * The standard does not seem to be clear on this issue. For now, we
- * will assume that the intent of the standard is that there could be
- * 0, 1, or 2 blank pages, but not any more than that. For there to be
- * more than one, one would have to be generated in the padPagesAtEnd
- * method, so the most we should allow here is 1.
- */
- final PageSequence previousPageSequence
- = previousPageCollection.getPageSequence();
- if (previousPageSequence.traitForcePageCount(this)
- == ForcePageCount.AUTO) {
- /*
- * In this case we'll try to put the added page in the previous
- * page-sequence, to comply with the standard.
- */
- previousPageCollection.makeBlankPage();
- } else {
- makeBlankPage();
- }
- }
- /*
- * In all cases, we need to set the currentPageNumber for this
- * PageCollection.
- */
- this.currentPageNumber = computedPageNumber;
- }
-
- @Override
- public void layoutComplete() throws AreaTreeException {
- final PageSequence pageSeq = getPageSequence();
- switch (pageSeq.traitForcePageCount(this)) {
- case AUTO: {
- /*
- * The standard would seem to imply that force-page-count="auto"
- * needs to consider the initial-page-number value for the
- * following page-sequence. However, since padPagesAtBeginning will
- * create any blank pages needed to satisfy that constraint, we
- * can safely ignore "auto" here.
- */
- return;
- }
- case EVEN: {
- if (getPageCount() % 2 != 0) {
- makeBlankPage();
- }
- return;
- }
- case ODD: {
- if (getPageCount() % 2 == 0) {
- makeBlankPage();
- }
- return;
- }
- case END_ON_EVEN: {
- if (getCurrentPageNumber() % 2 != 0) {
- makeBlankPage();
- }
- return;
- }
- case END_ON_ODD: {
- if (getCurrentPageNumber() % 2 == 0) {
- makeBlankPage();
- }
- return;
- }
- default: {
- return;
- }
- }
- }
-
- /**
- * Create a blank page.
- * @throws AreaTreeException If the FO Tree cannot provide the
- * information needed to create the page.
- */
- private void makeBlankPage() throws AreaTreeException {
- final PageRa pageArea = makePage(Force.NONE);
- pageArea.layoutComplete();
- }
-
- @Override
- public AreaTree4a getAreaTree() {
- return getParent();
- }
-
- /**
- * {@inheritDoc}
- * Overrides the AreaNode method, because this is the PageCollection
- * instance being sought.
- */
- @Override
- public PageCollection ancestorPageCollection() {
- return this;
- }
-
- @Override
- public String getAreaName() {
- return "page-collection";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public AreaTree4a getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- if (node instanceof AreaTree4a) {
- this.parent = (AreaTree4a) node;
- } else {
- throw new AreaTreeException("Parent of PageCollection must be "
- + "an AreaTree instance.");
- }
-
- }
-
- @Override
- public List<PageRa4a> getChildren() {
- return this.children;
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<PageSequence> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public PageSequence traitGeneratedBy() {
- return (PageSequence) this.getFoLink().getGenerator();
- }
-
- @Override
- public PositiveIntegerFormatter getPageNumberFormatter() {
- return this.traitGeneratedBy().getPageNumberFormatter();
- }
-
- @Override
- public CharSequence getPageNumberPrefix() {
- final FolioPrefix prefix = this.traitGeneratedBy().getFolioPrefix();
- if (prefix == null) {
- return WellKnownConstants.EMPTY_STRING;
- }
- return prefix.getContentAsText();
- }
-
- @Override
- public CharSequence getPageNumberSuffix() {
- final FolioSuffix suffix = this.traitGeneratedBy().getFolioSuffix();
- if (suffix == null) {
- return WellKnownConstants.EMPTY_STRING;
- }
- return suffix.getContentAsText();
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java (from rev 12345, trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection4a.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -0,0 +1,453 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+import org.foray.common.WellKnownConstants;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.PageCollection;
+import org.axsl.area.PageRa;
+import org.axsl.common.PositiveIntegerFormatter;
+import org.axsl.common.value.ForcePageCount;
+import org.axsl.fotree.FoTreeException;
+import org.axsl.fotree.fo.FolioPrefix;
+import org.axsl.fotree.fo.FolioSuffix;
+import org.axsl.fotree.fo.Marker;
+import org.axsl.fotree.fo.PageMasterResolver;
+import org.axsl.fotree.fo.PageSequence;
+import org.axsl.fotree.fo.SimplePageMaster;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * PageCollection is not really an Area. It is a convenience class that is
+ * intended to be analogous to the PageSequence in the FOTree, which should
+ * be considered its cousin. Its parent should always be an AreaTree instance,
+ * and its children should always be PageRa instances.
+ */
+public final class PageCollection4a extends NonArea implements PageCollection {
+
+ /** The link to the FO tree. */
+ private Link<PageSequence> foLink;
+
+ /** The parent of this node. */
+ private AreaTree4a parent;
+
+ /** The children of this node. */
+ private List<PageRa4a> children = new ArrayList<PageRa4a>();
+
+ /** The number of pages (so far) in this PageCollection. */
+ private int pageCount = 0;
+
+ /** Except during the time a new page is actually being created,
+ * currentPageNumber shows the next <em>expected</em> page number to be
+ * created. The last page number assigned is one less. */
+ private int currentPageNumber;
+
+ /** The markers found in this current page sequence. */
+ private List<Marker> currentPageSequenceMarkers = new ArrayList<Marker>();
+
+ /** The page-master resolver used to resolve page creation for this page
+ * collection. */
+ private PageMasterResolver pageMasterResolver;
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area tree.
+ */
+ private PageCollection4a(final AreaTree4a parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The "cousin" PageSequence object for which this PageCollection is created.
+ * @param parentArea The parent area tree.
+ * @param lastPageNumber The last page number that was used by the previous page collection.
+ * @return The new instance.
+ * @throws AreaTreeException If the FO Tree does not have sufficient information to create the needed pages for
+ * padding.
+ */
+ static PageCollection4a makePageCollection(final PageSequence generatedBy, final AreaTree4a parentArea,
+ final int lastPageNumber) throws AreaTreeException {
+ final PageCollection4a newCollection = new PageCollection4a(parentArea);
+ newCollection.foLink = newCollection.getLink(generatedBy);
+ newCollection.registerLink(generatedBy);
+ newCollection.pageMasterResolver = generatedBy.makePageMasterResolver(
+ lastPageNumber);
+ return newCollection;
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides Area method, because anybody trying to run that method
+ * on an AreaTree instance will get an NPE, since it uses getParent().
+ */
+ @Override
+ public PageRa4a getPage() {
+ return null;
+ }
+
+ @Override
+ public PageSequence getPageSequence() {
+ return this.traitGeneratedBy();
+ }
+
+ @Override
+ public int getPageCount() {
+ return this.pageCount;
+ }
+
+ /**
+ * Increases the page count by 1.
+ */
+ public void incrementPageCount() {
+ this.pageCount++;
+ }
+
+ /**
+ * Returns the sequence number of this PageCollection, starting at 0.
+ * The first PageCollection in the AreaTree will return 0, the second will
+ * return 1, etc.
+ * @return The sequence number of this PageCollection, starting at 0, or a
+ * -1 if this PageCollection is not found.
+ */
+ public int sequence() {
+ return getAreaTree().getPageCollectionsProcessed().indexOf(this);
+ }
+
+ /**
+ * Returns the PageCollection previous to this one from the sequence of
+ * PageCollection instances.
+ * @return The previous PageCollection, or null if this is the first one.
+ */
+ public PageCollection4a previousPageCollection() {
+ final int sequence = sequence();
+ if (sequence > 0) {
+ return getAreaTree().getPageCollectionsProcessed()
+ .get(sequence - 1);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the current page number.
+ * @return The current page number.
+ */
+ public int getCurrentPageNumber() {
+ return this.currentPageNumber;
+ }
+
+ /**
+ * Returns the last page number used.
+ * @return The last page number used.
+ */
+ public int getLastPageNumber() {
+ return this.currentPageNumber - 1;
+ }
+
+ /**
+ * Returns the markers in this page sequence.
+ * @return The markers in this page sequence.
+ */
+ public List<Marker> getCurrentPageSequenceMarkers() {
+ return this.currentPageSequenceMarkers;
+ }
+
+ /**
+ * Returns the markers in this document.
+ * @return The markers in this document.
+ */
+ public List<Marker> getDocumentMarkers() {
+ return getAreaTree().getDocumentMarkers();
+ }
+
+ @Override
+ public PageRa makePage(final Force forceValue)
+ throws AreaTreeException {
+ boolean isBlank = false;
+ if (Force.ODD.equals(forceValue)) {
+ if (getCurrentPageNumber() % 2 == 0) {
+ isBlank = true;
+ }
+ } else if (Force.EVEN.equals(forceValue)) {
+ if (getCurrentPageNumber() % 2 == 1) {
+ isBlank = true;
+ }
+ }
+ final PageSequence pageSeq = getPageSequence();
+ SimplePageMaster spm = null;
+ try {
+ spm = this.pageMasterResolver.getNextPageMaster(isBlank);
+ } catch (final FoTreeException e) {
+ throw new AreaTreeException(e);
+ }
+ final PageRa4a newPage = PageRa4a.makePageArea(spm, this);
+ this.children.add(newPage);
+ final int newPageNumber = getCurrentPageNumber();
+ newPage.setNumber(newPageNumber);
+ final CharSequence formattedPageNumber = pageSeq.formatPageNumber(
+ newPageNumber);
+ newPage.setFormattedNumber(formattedPageNumber);
+ if (!isBlank) {
+ getLogger().info("[" + formattedPageNumber + "]");
+ } else {
+ getLogger().info("[" + formattedPageNumber + "] (blank)");
+ }
+ this.currentPageNumber++;
+ incrementPageCount();
+ return newPage;
+ }
+
+ /**
+ * This method creates any blank pages that are needed at the beginning of
+ * an PageCollection to meet the related PageSequence's constraints.
+ * @throws AreaTreeException If the FO Tree cannot provide the
+ * information needed to add the pages needed for padding.
+ */
+ public void padPagesAtBeginning() throws AreaTreeException {
+ final PageSequence pageSeq = getPageSequence();
+ final PageCollection4a previousPageCollection = previousPageCollection();
+ if (previousPageCollection == null) {
+ this.currentPageNumber = pageSeq.traitInitialPageNumber(0);
+ return;
+ }
+ final int lastPageNumber =
+ previousPageCollection.getCurrentPageNumber() - 1;
+ final int computedPageNumber = pageSeq.traitInitialPageNumber(
+ lastPageNumber);
+ if (pageSeq.initialPageNumberSetExplicitly()) {
+ /*
+ * If the user set the page number explicitly, there is nothing
+ * else to do but set it and go.
+ */
+ this.currentPageNumber = computedPageNumber;
+ return;
+ }
+ final int pagesToAdd = computedPageNumber - lastPageNumber - 1;
+ if (pagesToAdd > 0) {
+ /*
+ * For now, the most number of blank pages we will create here is 1.
+ *
+ * We could conceivably create as many blank pages as would be required
+ * to get to a user-set initial-page-number="<number>", but for now we
+ * won't.
+ *
+ * It is tempting to ensure that an odd initial-page-number will start
+ * on an odd page, and vice versa, but we won't do that because the
+ * user has the ability to tell us to do that explicitly.
+ *
+ * For other initial-page-number settings, there could be as many as
+ * 3 blank pages generated between page-sequences. We're not sure, but
+ * we think that this is not the intent of the standard. Here are some
+ * examples:
+ *
+ * Example 1: The previous page-sequence has
+ * force-page-count="end-on-even", the last page with content in that
+ * page-sequence is an odd page, and the current page-sequence has
+ * initial-page-number="auto-odd". There must be two blank pages to
+ * satisfy these constraints, one created at the end of the previous
+ * page-sequence, one at the beginning of this one.
+ *
+ * Example 2: The same as Example 1, except that the current
+ * page-sequence has initial-page-number="auto-even". Unless a page
+ * can be part of two different page sequences, this requires a total
+ * of three blank pages, one created at the end of the previous
+ * page-sequence, and two at the beginning of this one.
+ *
+ * The standard does not seem to be clear on this issue. For now, we
+ * will assume that the intent of the standard is that there could be
+ * 0, 1, or 2 blank pages, but not any more than that. For there to be
+ * more than one, one would have to be generated in the padPagesAtEnd
+ * method, so the most we should allow here is 1.
+ */
+ final PageSequence previousPageSequence
+ = previousPageCollection.getPageSequence();
+ if (previousPageSequence.traitForcePageCount(this)
+ == ForcePageCount.AUTO) {
+ /*
+ * In this case we'll try to put the added page in the previous
+ * page-sequence, to comply with the standard.
+ */
+ previousPageCollection.makeBlankPage();
+ } else {
+ makeBlankPage();
+ }
+ }
+ /*
+ * In all cases, we need to set the currentPageNumber for this
+ * PageCollection.
+ */
+ this.currentPageNumber = computedPageNumber;
+ }
+
+ @Override
+ public void layoutComplete() throws AreaTreeException {
+ final PageSequence pageSeq = getPageSequence();
+ switch (pageSeq.traitForcePageCount(this)) {
+ case AUTO: {
+ /*
+ * The standard would seem to imply that force-page-count="auto"
+ * needs to consider the initial-page-number value for the
+ * following page-sequence. However, since padPagesAtBeginning will
+ * create any blank pages needed to satisfy that constraint, we
+ * can safely ignore "auto" here.
+ */
+ return;
+ }
+ case EVEN: {
+ if (getPageCount() % 2 != 0) {
+ makeBlankPage();
+ }
+ return;
+ }
+ case ODD: {
+ if (getPageCount() % 2 == 0) {
+ makeBlankPage();
+ }
+ return;
+ }
+ case END_ON_EVEN: {
+ if (getCurrentPageNumber() % 2 != 0) {
+ makeBlankPage();
+ }
+ return;
+ }
+ case END_ON_ODD: {
+ if (getCurrentPageNumber() % 2 == 0) {
+ makeBlankPage();
+ }
+ return;
+ }
+ default: {
+ return;
+ }
+ }
+ }
+
+ /**
+ * Create a blank page.
+ * @throws AreaTreeException If the FO Tree cannot provide the
+ * information needed to create the page.
+ */
+ private void makeBlankPage() throws AreaTreeException {
+ final PageRa pageArea = makePage(Force.NONE);
+ pageArea.layoutComplete();
+ }
+
+ @Override
+ public AreaTree4a getAreaTree() {
+ return getParent();
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides the AreaNode method, because this is the PageCollection
+ * instance being sought.
+ */
+ @Override
+ public PageCollection4a ancestorPageCollection() {
+ return this;
+ }
+
+ @Override
+ public String getAreaName() {
+ return "page-collection";
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public AreaTree4a getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(final AreaNode4a node) throws AreaTreeException {
+ if (node instanceof AreaTree4a) {
+ this.parent = (AreaTree4a) node;
+ } else {
+ throw new AreaTreeException("Parent of PageCollection must be "
+ + "an AreaTree instance.");
+ }
+
+ }
+
+ @Override
+ public List<PageRa4a> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ @Override
+ public Link<PageSequence> getFoLink() {
+ return this.foLink;
+ }
+
+ @Override
+ public PageSequence traitGeneratedBy() {
+ return (PageSequence) this.getFoLink().getGenerator();
+ }
+
+ @Override
+ public PositiveIntegerFormatter getPageNumberFormatter() {
+ return this.traitGeneratedBy().getPageNumberFormatter();
+ }
+
+ @Override
+ public CharSequence getPageNumberPrefix() {
+ final FolioPrefix prefix = this.traitGeneratedBy().getFolioPrefix();
+ if (prefix == null) {
+ return WellKnownConstants.EMPTY_STRING;
+ }
+ return prefix.getContentAsText();
+ }
+
+ @Override
+ public CharSequence getPageNumberSuffix() {
+ final FolioSuffix suffix = this.traitGeneratedBy().getFolioSuffix();
+ if (suffix == null) {
+ return WellKnownConstants.EMPTY_STRING;
+ }
+ return suffix.getContentAsText();
+ }
+
+}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -51,10 +51,8 @@
import org.axsl.fotree.fo.RegionStart;
import org.axsl.fotree.fo.RetrieveMarker;
import org.axsl.fotree.fo.SimplePageMaster;
-import org.axsl.galley.AreaNodeG5;
import org.axsl.galley.GalleyVisitor;
import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.PageG5;
import java.util.ArrayList;
import java.util.Collection;
@@ -65,13 +63,13 @@
/**
* Area containing a page.
*/
-public final class PageRa4a extends AreaFixed implements PageG5, PageRa {
+public final class PageRa4a extends AreaFixed implements PageRa {
/** The link to the FO tree. */
private Link<SimplePageMaster> foLink;
/** The parent of this node. */
- private PageCollection parent;
+ private PageCollection4a parent;
/** The children of this node. */
private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
@@ -105,7 +103,7 @@
* Private Constructor.
* @param parentArea The parent page collection.
*/
- private PageRa4a(final PageCollection parentArea) {
+ private PageRa4a(final PageCollection4a parentArea) {
this.parent = parentArea;
}
@@ -115,7 +113,7 @@
* @param parentArea The parent page collection.
* @return The new instance.
*/
- static PageRa4a makePageArea(final SimplePageMaster generatedBy, final PageCollection parentArea) {
+ static PageRa4a makePageArea(final SimplePageMaster generatedBy, final PageCollection4a parentArea) {
final PageRa4a newPage = new PageRa4a(parentArea);
newPage.foLink = newPage.getLink(generatedBy);
newPage.registerLink(generatedBy);
@@ -337,7 +335,7 @@
}
@Override
- public AreaNodeG5 firstUnresolvedRefId() {
+ public AreaNode4a firstUnresolvedRefId() {
return firstUnresolvedRefId(this);
}
@@ -482,7 +480,7 @@
/* If marker not yet found, and 'retrieve-boundary' permits,
* search backward. */
List<Marker> additionalMarkers = null;
- final PageCollection pageCollection = getParent();
+ final PageCollection4a pageCollection = getParent();
if (retrieve.traitRetrieveBoundary()
== RetrieveBoundary.PAGE_SEQUENCE) {
final PageSequence pageSequence = pageCollection.getPageSequence();
@@ -643,14 +641,14 @@
}
@Override
- public PageCollection getParent() {
+ public PageCollection4a getParent() {
return this.parent;
}
@Override
public void setParent(final AreaNode4a node) throws AreaTreeException {
- if (node instanceof PageCollection) {
- this.parent = (PageCollection) node;
+ if (node instanceof PageCollection4a) {
+ this.parent = (PageCollection4a) node;
} else {
throw new AreaTreeException("Parent of PageRa must be a "
+ "PageCollection");
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -31,6 +31,7 @@
import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
+import org.axsl.area.RegionBodyRa;
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.RelativeAxis;
@@ -38,7 +39,6 @@
import org.axsl.fotree.fo.SimplePageMaster;
import org.axsl.galley.GalleyVisitor;
import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.RegionAreaG5;
import org.axsl.graphic.Graphic;
import java.awt.Color;
@@ -48,7 +48,7 @@
/**
* Area containing a region-body.
*/
-public final class RegionBodyRa4a extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionBodyRa {
+public final class RegionBodyRa4a extends AreaFixed implements RegionBodyRa {
/* TODO: Why doesn't this class extend RegionRa? */
/** The link to the FO tree. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -48,7 +48,6 @@
import org.axsl.fotree.fo.Table;
import org.axsl.galley.GalleyVisitor;
import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.RegionAreaG5;
import org.axsl.graphic.Graphic;
import java.awt.Color;
@@ -58,7 +57,7 @@
/**
* This class is used to manage a region-reference-area.
*/
-public final class RegionOuterRa4a extends AreaFixed implements RegionAreaG5, RegionOuterRa {
+public final class RegionOuterRa4a extends AreaFixed implements RegionOuterRa {
/** The link to the FO tree. */
private Link<Region> foLink;
Modified: trunk/foray/foray-areatree/src/test/java/org/foray/area/TestPageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/test/java/org/foray/area/TestPageCollection.java 2022-01-06 12:22:28 UTC (rev 12347)
+++ trunk/foray/foray-areatree/src/test/java/org/foray/area/TestPageCollection.java 2022-01-06 12:45:15 UTC (rev 12348)
@@ -31,12 +31,12 @@
import org.junit.Test;
/**
- * Tests for the class {@link PageCollection}.
+ * Tests for the class {@link PageCollection4a}.
*/
public class TestPageCollection {
/**
- * Test of {@link PageCollection#padPagesAtBeginning()}.
+ * Test of {@link PageCollection4a#padPagesAtBeginning()}.
*/
@Test
public void testPadPagesAtBeginning() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-06 12:22:31
|
Revision: 12347
http://sourceforge.net/p/foray/code/12347
Author: victormote
Date: 2022-01-06 12:22:28 +0000 (Thu, 06 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Fix areatree/galley inheritance in some table-related interfaces.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractTablePartContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer4a.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractTablePartContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractTablePartContainer.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractTablePartContainer.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -47,8 +47,8 @@
private TableRa parent;
/** The children of this node. */
- private List<TableRowContainer> children
- = new ArrayList<TableRowContainer>();
+ private List<TableRowContainer4a> children
+ = new ArrayList<TableRowContainer4a>();
/** See {@link #getProgressionDimension()} for a description of
* "progression dimension". */
@@ -63,8 +63,8 @@
}
@Override
- public TableRowContainer makeTableRowContainer(final TableRow node) {
- final TableRowContainer newRow = TableRowContainer.makeTableRowContainer(node, this);
+ public TableRowContainer4a makeTableRowContainer(final TableRow node) {
+ final TableRowContainer4a newRow = TableRowContainer4a.makeTableRowContainer(node, this);
this.children.add(newRow);
return newRow;
}
@@ -95,7 +95,7 @@
}
@Override
- public List<TableRowContainer> getChildren() {
+ public List<TableRowContainer4a> getChildren() {
return this.children;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -846,7 +846,7 @@
/* LineArea children grow in the IPD, LineArea grows in the BPD. */
return false;
}
- if (parent instanceof TableRowContainer) {
+ if (parent instanceof TableRowContainer4a) {
/* TableRowContainer children grow in the IPD, LineArea grows in the
* BPD. */
return false;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ListItemArea.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -228,7 +228,7 @@
/**
* Resets the progression dimension for this row by polling the "cells" to
* see whether their content BPD has changed.
- * @see TableRowContainer#resetProgressionDimension()
+ * @see TableRowContainer4a#resetProgressionDimension()
*/
public void resetProgressionDimension() {
int maxCellBPD = 0;
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -1,176 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.BackgroundRepeat;
-import org.axsl.fotree.fo.GraftingPoint;
-import org.axsl.fotree.fo.TableBody;
-import org.axsl.galley.BackgroundAreaG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.graphic.Graphic;
-
-import java.awt.Color;
-
-/**
- * Area containing all or part of a table-body.
- */
-public final class TableBodyContainer extends AbstractTablePartContainer implements BackgroundAreaG5,
- org.axsl.area.TableBodyContainer {
-
- /** The link to the FO tree. */
- private Link<TableBody> foLink;
-
- /**
- * Private Constructor.
- * Use {@link TableRa#makeTableBodyContainer(org.axsl.fotree.fo.TableBody,
- * GraftingPoint)} to create an instance.
- * @param parentArea The parent area.
- */
- private TableBodyContainer(final TableRa parentArea) {
- super(parentArea);
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The newly-created instance.
- */
- static TableBodyContainer makeTableBodyContainer(final TableBody generatedBy, final TableRa parentArea) {
- final TableBodyContainer bodyContainer = new TableBodyContainer(parentArea);
- bodyContainer.foLink = bodyContainer.getLink(generatedBy);
- bodyContainer.registerLink(generatedBy);
- final int initialPD = bodyContainer.computeInitialPD();
- bodyContainer.setProgressionDimension(initialPD);
- bodyContainer.initializeAnteriorSpace();
- return bodyContainer;
- }
-
- @Override
- public String getAreaName() {
- return "table-body";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public int crIpd() {
- return crIPDBlockArea();
- }
-
- @Override
- public int crBpd() {
- return getProgressionDimension();
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return ancestorArea().getOverflowArea(this);
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<TableBody> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public TableBody traitGeneratedBy() {
- return this.getFoLink().getGenerator();
- }
-
- @Override
- public Graphic traitBackgroundImage() {
- return this.traitGeneratedBy().traitBackgroundImage(this);
- }
-
- @Override
- public Color traitBackgroundColor() {
- return traitGeneratedBy().traitBackgroundColor(this);
- }
-
- @Override
- public BackgroundRepeat traitBackgroundRepeat() {
- return traitGeneratedBy().traitBackgroundRepeat(this);
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer4a.java (from rev 12325, trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableBodyContainer4a.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.TableBodyContainer;
+import org.axsl.common.value.BackgroundRepeat;
+import org.axsl.fotree.fo.GraftingPoint;
+import org.axsl.fotree.fo.TableBody;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+import org.axsl.graphic.Graphic;
+
+import java.awt.Color;
+
+/**
+ * Area containing all or part of a table-body.
+ */
+public final class TableBodyContainer4a extends AbstractTablePartContainer implements TableBodyContainer {
+
+ /** The link to the FO tree. */
+ private Link<TableBody> foLink;
+
+ /**
+ * Private Constructor.
+ * Use {@link TableRa#makeTableBodyContainer(org.axsl.fotree.fo.TableBody,
+ * GraftingPoint)} to create an instance.
+ * @param parentArea The parent area.
+ */
+ private TableBodyContainer4a(final TableRa parentArea) {
+ super(parentArea);
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The newly-created instance.
+ */
+ static TableBodyContainer4a makeTableBodyContainer(final TableBody generatedBy, final TableRa parentArea) {
+ final TableBodyContainer4a bodyContainer = new TableBodyContainer4a(parentArea);
+ bodyContainer.foLink = bodyContainer.getLink(generatedBy);
+ bodyContainer.registerLink(generatedBy);
+ final int initialPD = bodyContainer.computeInitialPD();
+ bodyContainer.setProgressionDimension(initialPD);
+ bodyContainer.initializeAnteriorSpace();
+ return bodyContainer;
+ }
+
+ @Override
+ public String getAreaName() {
+ return "table-body";
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public int crIpd() {
+ return crIPDBlockArea();
+ }
+
+ @Override
+ public int crBpd() {
+ return getProgressionDimension();
+ }
+
+ @Override
+ public Area4a getOverflowArea(final Area4a childRequesting)
+ throws AreaTreeException {
+ return ancestorArea().getOverflowArea(this);
+ }
+
+ @Override
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ @Override
+ public Link<TableBody> getFoLink() {
+ return this.foLink;
+ }
+
+ @Override
+ public TableBody traitGeneratedBy() {
+ return this.getFoLink().getGenerator();
+ }
+
+ @Override
+ public Graphic traitBackgroundImage() {
+ return this.traitGeneratedBy().traitBackgroundImage(this);
+ }
+
+ @Override
+ public Color traitBackgroundColor() {
+ return traitGeneratedBy().traitBackgroundColor(this);
+ }
+
+ @Override
+ public BackgroundRepeat traitBackgroundRepeat() {
+ return traitGeneratedBy().traitBackgroundRepeat(this);
+ }
+
+ @Override
+ public int traitBorderStartWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderEndWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderBeforeWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderAfterWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingStart() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingEnd() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingBefore() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingAfter() {
+ return 0;
+ }
+
+}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableCellRa.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -47,7 +47,6 @@
import org.axsl.fotree.fo.TableCell;
import org.axsl.galley.GalleyVisitor;
import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.TableCellAreaG5;
import org.axsl.graphic.Graphic;
import java.awt.Color;
@@ -57,13 +56,13 @@
/**
* Area containing all or part of a table-cell.
*/
-public final class TableCellRa extends ContainerRa implements TableCellAreaG5, org.axsl.area.TableCellArea {
+public final class TableCellRa extends ContainerRa implements org.axsl.area.TableCellArea {
/** The link to the FO tree. */
private Link<TableCell> foLink;
/** The parent of this node. */
- private TableRowContainer parent;
+ private TableRowContainer4a parent;
/** The children of this node. */
private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
@@ -91,11 +90,11 @@
/**
* Private Constructor.
- * Use {@link TableRowContainer#makeTableCellArea(TableCell,
+ * Use {@link TableRowContainer4a#makeTableCellArea(TableCell,
* GraftingPoint)} to create a new cell instance.
* @param parentArea The parent area.
*/
- private TableCellRa(final TableRowContainer parentArea) {
+ private TableCellRa(final TableRowContainer4a parentArea) {
this.parent = parentArea;
}
@@ -105,7 +104,7 @@
* @param parentArea The parent area.
* @return The new instance.
*/
- static TableCellRa makeTableCellRA(final TableCell generatedBy, final TableRowContainer parentArea) {
+ static TableCellRa makeTableCellRA(final TableCell generatedBy, final TableRowContainer4a parentArea) {
final TableCellRa newCell = new TableCellRa(parentArea);
newCell.foLink = newCell.getLink(generatedBy);
newCell.registerLink(generatedBy);
@@ -290,11 +289,11 @@
* for all (non-spanning) cells in the row. */
int bpd = 0;
/* TODO: This computation needs to consider borders and padding. */
- TableRowContainer rowArea = this.getParent();
+ TableRowContainer4a rowArea = this.getParent();
bpd += rowArea.getProgressionDimension();
int rowsRemaining = this.traitNumberRowsSpanned() - 1;
while (rowsRemaining > 0) {
- final TableRowContainer nextRow = (TableRowContainer)
+ final TableRowContainer4a nextRow = (TableRowContainer4a)
rowArea.getNextSibling();
if (nextRow == null) {
rowsRemaining = 0;
@@ -369,14 +368,14 @@
}
@Override
- public TableRowContainer getParent() {
+ public TableRowContainer4a getParent() {
return this.parent;
}
@Override
public void setParent(final AreaNode4a node) throws AreaTreeException {
- if (node instanceof TableRowContainer) {
- this.parent = (TableRowContainer) node;
+ if (node instanceof TableRowContainer4a) {
+ this.parent = (TableRowContainer4a) node;
} else {
throw new AreaTreeException("Parent of TableCellRa must be a "
+ "TableRowContainer");
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -1,190 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.area.RetrieveTableMarkerNode;
-import org.axsl.common.value.BackgroundRepeat;
-import org.axsl.fotree.fo.GraftingPoint;
-import org.axsl.fotree.fo.Marker;
-import org.axsl.fotree.fo.RetrieveTableMarker;
-import org.axsl.fotree.fo.TableFooter;
-import org.axsl.galley.BackgroundAreaG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.graphic.Graphic;
-
-import java.awt.Color;
-
-/**
- * Area containing all or part of a table-footer.
- */
-public final class TableFooterContainer extends AbstractTablePartContainer implements BackgroundAreaG5,
- org.axsl.area.TableFooterContainer {
-
- /** The link to the FO tree. */
- private Link<TableFooter> foLink;
-
- /**
- * Private Constructor.
- * Use {@link TableRa#makeTableFooterContainer(org.axsl.fotree.fo.TableFooter, GraftingPoint)} to create an
- * instance.
- * @param parentArea The parent area.
- */
- private TableFooterContainer(final TableRa parentArea) {
- super(parentArea);
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The newly-created instance.
- */
- static TableFooterContainer makeTableFooterContainer(final TableFooter generatedBy, final TableRa parentArea) {
- final TableFooterContainer footerContainer = new TableFooterContainer(parentArea);
- footerContainer.foLink = footerContainer.getLink(generatedBy);
- footerContainer.registerLink(generatedBy);
- final int initialPD = footerContainer.computeInitialPD();
- footerContainer.setProgressionDimension(initialPD);
- footerContainer.initializeAnteriorSpace();
- return footerContainer;
- }
-
- @Override
- public String getAreaName() {
- return "table-footer";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public int crIpd() {
- return crIPDBlockArea();
- }
-
- @Override
- public int crBpd() {
- return getProgressionDimension();
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return ancestorArea().getOverflowArea(this);
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<TableFooter> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public TableFooter traitGeneratedBy() {
- return this.getFoLink().getGenerator();
- }
-
- @Override
- public Graphic traitBackgroundImage() {
- return this.traitGeneratedBy().traitBackgroundImage(this);
- }
-
- @Override
- public Color traitBackgroundColor() {
- return traitGeneratedBy().traitBackgroundColor(this);
- }
-
- @Override
- public BackgroundRepeat traitBackgroundRepeat() {
- return traitGeneratedBy().traitBackgroundRepeat(this);
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public RetrieveTableMarkerNode makeRetrieveTableMarkerNode(final RetrieveTableMarker retrieveTableMarker,
- final Marker selectedMarker) {
-// final RetrieveTableMarkerNode4a newRtmNode =
-// RetrieveTableMarkerNode4a.makeRetrieveTableMarkerNode(retrieveTableMarker, this, selectedMarker);
-// this.children.add(newRtmNode);
-// return newRtmNode;
- return null;
- }
-
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer4a.java (from rev 12325, trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableFooterContainer4a.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.RetrieveTableMarkerNode;
+import org.axsl.area.TableFooterContainer;
+import org.axsl.common.value.BackgroundRepeat;
+import org.axsl.fotree.fo.GraftingPoint;
+import org.axsl.fotree.fo.Marker;
+import org.axsl.fotree.fo.RetrieveTableMarker;
+import org.axsl.fotree.fo.TableFooter;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+import org.axsl.graphic.Graphic;
+
+import java.awt.Color;
+
+/**
+ * Area containing all or part of a table-footer.
+ */
+public final class TableFooterContainer4a extends AbstractTablePartContainer implements TableFooterContainer {
+
+ /** The link to the FO tree. */
+ private Link<TableFooter> foLink;
+
+ /**
+ * Private Constructor.
+ * Use {@link TableRa#makeTableFooterContainer(org.axsl.fotree.fo.TableFooter, GraftingPoint)} to create an
+ * instance.
+ * @param parentArea The parent area.
+ */
+ private TableFooterContainer4a(final TableRa parentArea) {
+ super(parentArea);
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The newly-created instance.
+ */
+ static TableFooterContainer4a makeTableFooterContainer(final TableFooter generatedBy, final TableRa parentArea) {
+ final TableFooterContainer4a footerContainer = new TableFooterContainer4a(parentArea);
+ footerContainer.foLink = footerContainer.getLink(generatedBy);
+ footerContainer.registerLink(generatedBy);
+ final int initialPD = footerContainer.computeInitialPD();
+ footerContainer.setProgressionDimension(initialPD);
+ footerContainer.initializeAnteriorSpace();
+ return footerContainer;
+ }
+
+ @Override
+ public String getAreaName() {
+ return "table-footer";
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public int crIpd() {
+ return crIPDBlockArea();
+ }
+
+ @Override
+ public int crBpd() {
+ return getProgressionDimension();
+ }
+
+ @Override
+ public Area4a getOverflowArea(final Area4a childRequesting)
+ throws AreaTreeException {
+ return ancestorArea().getOverflowArea(this);
+ }
+
+ @Override
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ @Override
+ public Link<TableFooter> getFoLink() {
+ return this.foLink;
+ }
+
+ @Override
+ public TableFooter traitGeneratedBy() {
+ return this.getFoLink().getGenerator();
+ }
+
+ @Override
+ public Graphic traitBackgroundImage() {
+ return this.traitGeneratedBy().traitBackgroundImage(this);
+ }
+
+ @Override
+ public Color traitBackgroundColor() {
+ return traitGeneratedBy().traitBackgroundColor(this);
+ }
+
+ @Override
+ public BackgroundRepeat traitBackgroundRepeat() {
+ return traitGeneratedBy().traitBackgroundRepeat(this);
+ }
+
+ @Override
+ public int traitBorderStartWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderEndWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderBeforeWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderAfterWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingStart() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingEnd() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingBefore() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingAfter() {
+ return 0;
+ }
+
+ @Override
+ public RetrieveTableMarkerNode makeRetrieveTableMarkerNode(final RetrieveTableMarker retrieveTableMarker,
+ final Marker selectedMarker) {
+// final RetrieveTableMarkerNode4a newRtmNode =
+// RetrieveTableMarkerNode4a.makeRetrieveTableMarkerNode(retrieveTableMarker, this, selectedMarker);
+// this.children.add(newRtmNode);
+// return newRtmNode;
+ return null;
+ }
+
+
+}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -1,190 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.area.RetrieveTableMarkerNode;
-import org.axsl.common.value.BackgroundRepeat;
-import org.axsl.fotree.fo.GraftingPoint;
-import org.axsl.fotree.fo.Marker;
-import org.axsl.fotree.fo.RetrieveTableMarker;
-import org.axsl.fotree.fo.TableHeader;
-import org.axsl.galley.BackgroundAreaG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.graphic.Graphic;
-
-import java.awt.Color;
-
-/**
- * Area containing all or part of a table-header.
- */
-public final class TableHeaderContainer extends AbstractTablePartContainer implements BackgroundAreaG5,
- org.axsl.area.TableHeaderContainer {
-
- /** The link to the FO tree. */
- private Link<TableHeader> foLink;
-
- /**
- * Private Constructor.
- * Use {@link TableRa#makeTableHeaderContainer(org.axsl.fotree.fo.TableHeader,
- * GraftingPoint)} to create an instance.
- * @param parentArea The parent area.
- */
- private TableHeaderContainer(final TableRa parentArea) {
- super(parentArea);
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The newly-created instance.
- */
- static TableHeaderContainer makeTableHeaderContainer(final TableHeader generatedBy, final TableRa parentArea) {
- final TableHeaderContainer headerContainer = new TableHeaderContainer(parentArea);
- headerContainer.foLink = headerContainer.getLink(generatedBy);
- headerContainer.registerLink(generatedBy);
- final int initialPD = headerContainer.computeInitialPD();
- headerContainer.setProgressionDimension(initialPD);
- headerContainer.initializeAnteriorSpace();
- return headerContainer;
- }
-
- @Override
- public String getAreaName() {
- return "table-header";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public int crIpd() {
- return crIPDBlockArea();
- }
-
- @Override
- public int crBpd() {
- return getProgressionDimension();
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return ancestorArea().getOverflowArea(this);
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<TableHeader> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public TableHeader traitGeneratedBy() {
- return this.getFoLink().getGenerator();
- }
-
- @Override
- public Graphic traitBackgroundImage() {
- return this.traitGeneratedBy().traitBackgroundImage(this);
- }
-
- @Override
- public Color traitBackgroundColor() {
- return traitGeneratedBy().traitBackgroundColor(this);
- }
-
- @Override
- public BackgroundRepeat traitBackgroundRepeat() {
- return traitGeneratedBy().traitBackgroundRepeat(this);
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public RetrieveTableMarkerNode makeRetrieveTableMarkerNode(final RetrieveTableMarker retrieveTableMarker,
- final Marker selectedMarker) {
-// final RetrieveTableMarkerNode4a newRtmNode =
-// RetrieveTableMarkerNode4a.makeRetrieveTableMarkerNode(retrieveTableMarker, this, selectedMarker);
-// this.children.add(newRtmNode);
-// return newRtmNode;
- return null;
- }
-
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer4a.java (from rev 12325, trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableHeaderContainer4a.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.RetrieveTableMarkerNode;
+import org.axsl.area.TableHeaderContainer;
+import org.axsl.common.value.BackgroundRepeat;
+import org.axsl.fotree.fo.GraftingPoint;
+import org.axsl.fotree.fo.Marker;
+import org.axsl.fotree.fo.RetrieveTableMarker;
+import org.axsl.fotree.fo.TableHeader;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+import org.axsl.graphic.Graphic;
+
+import java.awt.Color;
+
+/**
+ * Area containing all or part of a table-header.
+ */
+public final class TableHeaderContainer4a extends AbstractTablePartContainer implements TableHeaderContainer {
+
+ /** The link to the FO tree. */
+ private Link<TableHeader> foLink;
+
+ /**
+ * Private Constructor.
+ * Use {@link TableRa#makeTableHeaderContainer(org.axsl.fotree.fo.TableHeader,
+ * GraftingPoint)} to create an instance.
+ * @param parentArea The parent area.
+ */
+ private TableHeaderContainer4a(final TableRa parentArea) {
+ super(parentArea);
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The newly-created instance.
+ */
+ static TableHeaderContainer4a makeTableHeaderContainer(final TableHeader generatedBy, final TableRa parentArea) {
+ final TableHeaderContainer4a headerContainer = new TableHeaderContainer4a(parentArea);
+ headerContainer.foLink = headerContainer.getLink(generatedBy);
+ headerContainer.registerLink(generatedBy);
+ final int initialPD = headerContainer.computeInitialPD();
+ headerContainer.setProgressionDimension(initialPD);
+ headerContainer.initializeAnteriorSpace();
+ return headerContainer;
+ }
+
+ @Override
+ public String getAreaName() {
+ return "table-header";
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public int crIpd() {
+ return crIPDBlockArea();
+ }
+
+ @Override
+ public int crBpd() {
+ return getProgressionDimension();
+ }
+
+ @Override
+ public Area4a getOverflowArea(final Area4a childRequesting)
+ throws AreaTreeException {
+ return ancestorArea().getOverflowArea(this);
+ }
+
+ @Override
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ @Override
+ public Link<TableHeader> getFoLink() {
+ return this.foLink;
+ }
+
+ @Override
+ public TableHeader traitGeneratedBy() {
+ return this.getFoLink().getGenerator();
+ }
+
+ @Override
+ public Graphic traitBackgroundImage() {
+ return this.traitGeneratedBy().traitBackgroundImage(this);
+ }
+
+ @Override
+ public Color traitBackgroundColor() {
+ return traitGeneratedBy().traitBackgroundColor(this);
+ }
+
+ @Override
+ public BackgroundRepeat traitBackgroundRepeat() {
+ return traitGeneratedBy().traitBackgroundRepeat(this);
+ }
+
+ @Override
+ public int traitBorderStartWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderEndWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderBeforeWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderAfterWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingStart() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingEnd() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingBefore() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingAfter() {
+ return 0;
+ }
+
+ @Override
+ public RetrieveTableMarkerNode makeRetrieveTableMarkerNode(final RetrieveTableMarker retrieveTableMarker,
+ final Marker selectedMarker) {
+// final RetrieveTableMarkerNode4a newRtmNode =
+// RetrieveTableMarkerNode4a.makeRetrieveTableMarkerNode(retrieveTableMarker, this, selectedMarker);
+// this.children.add(newRtmNode);
+// return newRtmNode;
+ return null;
+ }
+
+
+}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -32,6 +32,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.RetrieveTableMarkerNode;
+import org.axsl.area.TableArea;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.BorderModel;
import org.axsl.common.value.BorderStyle;
@@ -47,7 +48,6 @@
import org.axsl.galley.BackgroundAreaG5;
import org.axsl.galley.GalleyVisitor;
import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.TableAreaG5;
import org.axsl.graphic.Graphic;
import java.awt.Color;
@@ -57,7 +57,7 @@
/**
* Area containing part or all of a {@link Table}.
*/
-public final class TableRa extends ContainerRa implements TableAreaG5, org.axsl.area.TableArea {
+public final class TableRa extends ContainerRa implements TableArea {
/** Constant indicating the minimum column width (10 points), expressed in
* millipoints, that is, 10,000. */
@@ -182,9 +182,9 @@
}
@Override
- public TableBodyContainer makeTableBodyContainer(final TableBody tableBody) {
- final TableBodyContainer bodyContainer
- = TableBodyContainer.makeTableBodyContainer(tableBody, this);
+ public TableBodyContainer4a makeTableBodyContainer(final TableBody tableBody) {
+ final TableBodyContainer4a bodyContainer
+ = TableBodyContainer4a.makeTableBodyContainer(tableBody, this);
if (this.getTableFooterContainer() == null) {
/* If there is not yet a footer area, add it to the end. */
this.children.add(bodyContainer);
@@ -198,17 +198,17 @@
}
@Override
- public TableHeaderContainer makeTableHeaderContainer(final TableHeader tableHeader) {
- final TableHeaderContainer headerContainer
- = TableHeaderContainer.makeTableHeaderContainer(tableHeader, this);
+ public TableHeaderContainer4a makeTableHeaderContainer(final TableHeader tableHeader) {
+ final TableHeaderContainer4a headerContainer
+ = TableHeaderContainer4a.makeTableHeaderContainer(tableHeader, this);
this.children.add(headerContainer);
return headerContainer;
}
@Override
- public TableFooterContainer makeTableFooterContainer(final TableFooter tableFooter) {
- final TableFooterContainer footerContainer
- = TableFooterContainer.makeTableFooterContainer(tableFooter, this);
+ public TableFooterContainer4a makeTableFooterContainer(final TableFooter tableFooter) {
+ final TableFooterContainer4a footerContainer
+ = TableFooterContainer4a.makeTableFooterContainer(tableFooter, this);
this.children.add(footerContainer);
return footerContainer;
}
@@ -439,7 +439,7 @@
/* TODO: We don't know how to do this yet. */
/* 5. Rows. */
for (AbstractTablePartContainer tableSegment : this.children) {
- for (TableRowContainer row : tableSegment.getChildren()) {
+ for (TableRowContainer4a row : tableSegment.getChildren()) {
if (this.hasBackground(row)) {
backgroundAreas.add(row);
}
@@ -547,7 +547,7 @@
}
@Override
- public TableBodyContainer getTableBodyContainer() {
+ public TableBodyContainer4a getTableBodyContainer() {
if (this.children == null) {
return null;
}
@@ -555,8 +555,8 @@
return null;
}
for (AbstractTablePartContainer container : this.children) {
- if (container instanceof TableHeaderContainer) {
- return (TableBodyContainer) container;
+ if (container instanceof TableHeaderContainer4a) {
+ return (TableBodyContainer4a) container;
}
}
return null;
@@ -563,7 +563,7 @@
}
@Override
- public TableHeaderContainer getTableHeaderContainer() {
+ public TableHeaderContainer4a getTableHeaderContainer() {
if (this.children == null) {
return null;
}
@@ -571,14 +571,14 @@
return null;
}
/* If there is one, it must the first child. */
- if (this.children.get(0) instanceof TableHeaderContainer) {
- return (TableHeaderContainer) this.children.get(0);
+ if (this.children.get(0) instanceof TableHeaderContainer4a) {
+ return (TableHeaderContainer4a) this.children.get(0);
}
return null;
}
@Override
- public TableFooterContainer getTableFooterContainer() {
+ public TableFooterContainer4a getTableFooterContainer() {
if (this.children == null) {
return null;
}
@@ -587,8 +587,8 @@
}
/* If there is one, it must the last child. */
final int lastIndex = this.children.size() - 1;
- if (this.children.get(lastIndex) instanceof TableFooterContainer) {
- return (TableFooterContainer) this.children.get(lastIndex);
+ if (this.children.get(lastIndex) instanceof TableFooterContainer4a) {
+ return (TableFooterContainer4a) this.children.get(lastIndex);
}
return null;
}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java 2022-01-05 20:44:20 UTC (rev 12346)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -1,309 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.BackgroundRepeat;
-import org.axsl.common.value.FoPropertyConstants;
-import org.axsl.common.value.RelativeAxis;
-import org.axsl.fotree.fo.GraftingPoint;
-import org.axsl.fotree.fo.TableCell;
-import org.axsl.fotree.fo.TableRow;
-import org.axsl.galley.BackgroundAreaG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.graphic.Graphic;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * Class representing the areas <em>returned by</em> an fo:table-row object.
- * Note that fo:table-row does not really generate any areas.
- */
-public final class TableRowContainer extends ContainerRa
- implements org.axsl.area.TableRowContainer,
- BackgroundAreaG5 {
-
- /** The link to the FO tree. */
- private Link<TableRow> foLink;
-
- /** The parent of this node. */
- private AbstractTablePartContainer parent;
-
- /** The children of this node. */
- private List<TableCellRa> children = new ArrayList<TableCellRa>();
-
- /** See {@link #getProgressionDimension()} for a description of
- * "progression dimension". */
- private int progressionDimension = 0;
-
- /**
- * Private Constructor.
- * Use {@link AbstractTablePartContainer#makeTableRowContainer(TableRow,
- * GraftingPoint)} to create an instance.
- * @param parentArea The parent area.
- */
- private TableRowContainer(final AbstractTablePartContainer parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The new instance.
- */
- static TableRowContainer makeTableRowContainer(final TableRow generatedBy,
- final AbstractTablePartContainer parentArea) {
- final TableRowContainer newRow = new TableRowContainer(parentArea);
- newRow.foLink = newRow.getLink(generatedBy);
- newRow.registerLink(generatedBy);
-
- /* Non-standard initialization of progression dimension. */
- int startingPD = generatedBy.traitBpDimensionMin(newRow);
- if (startingPD == FoPropertyConstants.DIMENSION_AUTO) {
- startingPD = 0;
- }
- newRow.setProgressionDimension(startingPD);
-
- newRow.initializeAnteriorSpace();
- return newRow;
- }
-
- /**
- * {@inheritDoc}
- * Overrides superclass method because TableRowContainer contents stack in
- * the IPD.
- */
- @Override
- public RelativeAxis contentStackingAxis() {
- return RelativeAxis.INLINE_PROGRESSION;
- }
-
- @Override
- public TableCellRa makeTableCellArea(final TableCell node) {
- final TableCellRa newCell = TableCellRa.makeTableCellRA(node, this);
- this.children.add(newCell);
- return newCell;
- }
-
- @Override
- public String getAreaName() {
- return "table-row";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public int crIpd() {
- return crIPDBlockArea();
- }
-
- @Override
- public int crBpd() {
- return this.getProgressionDimension();
- }
-
- @Override
- public AbstractTablePartContainer getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- if (node instanceof AbstractTablePartContainer) {
- this.parent = (AbstractTablePartContainer) node;
- } else {
- throw new AreaTreeException("Parent of TableRowContainer must "
- + "be an AbstractTableContainer");
- }
- }
-
- @Override
- public List<TableCellRa> getChildren() {
- return this.children;
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return ancestorArea().getOverflowArea(this);
- }
-
- @Override
- public void setProgressionDimension(final int progressionDimension) {
- setParentPD(progressionDimension);
- this.progressionDimension = progressionDimension;
- }
-
- @Override
- public void incrementProgressionDimension(final int incrementAmount) {
- incrementParentPD(incrementAmount);
- this.progressionDimension += incrementAmount;
- }
-
- @Override
- public int getProgressionDimension() {
- return this.progressionDimension;
- }
-
- /**
- * Resets the progression dimension for this row by polling the cells to
- * see whether their content BPD has changed.
- * @see ListItemArea#resetProgressionDimension()
- */
- public void resetProgressionDimension() {
- int maxCellBPD = 0;
- for (TableCellRa cell : this.children) {
- final int cellHeight = cell.getContentBPD();
- if (cellHeight > maxCellBPD) {
- maxCellBPD = cellHeight;
- }
- }
- if (maxCellBPD != this.progressionDimension) {
- this.incrementProgressionDimension(maxCellBPD
- - this.progressionDimension);
- }
- }
-
- @Override
- public Graphic getGraphic() {
- return this.traitBackgroundImage();
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<TableRow> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public TableRow traitGeneratedBy() {
- return (TableRow) this.getFoLink().getGenerator();
- }
-
- @Override
- public boolean isAbsolutelyPositioned() {
- return false;
- }
-
- @Override
- public Graphic traitBackgroundImage() {
- return this.traitGeneratedBy().traitBackgroundImage(this);
- }
-
- @Override
- public Color traitBackgroundColor() {
- return traitGeneratedBy().traitBackgroundColor(this);
- }
-
- @Override
- public BackgroundRepeat traitBackgroundRepeat() {
- return traitGeneratedBy().traitBackgroundRepeat(this);
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public int traitSpaceBeforeOptimum() {
- return 0;
- }
-
- @Override
- public int traitSpaceAfterOptimum() {
- return 0;
- }
-
- @Override
- public int traitEndIndent() {
- return 0;
- }
-
- @Override
- public int traitStartIndent() {
- return 0;
- }
-
- @Override
- public int traitIPDimensionOpt() {
- return -1;
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer4a.java (from rev 12325, trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRowContainer4a.java 2022-01-06 12:22:28 UTC (rev 12347)
@@ -0,0 +1,307 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.TableRowContainer;
+import org.axsl.common.value.BackgroundRepeat;
+import org.axsl.common.value.FoPropertyConstants;
+import org.axsl.common.value.RelativeAxis;
+import org.axsl.fotree.fo.GraftingPoint;
+import org.axsl.fotree.fo.TableCell;
+import org.axsl.fotree.fo.TableRow;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+import org.axsl.graphic.Graphic;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Class representing the areas <em>returned by</em> an fo:table-row object.
+ * Note that fo:table-row does not really generate any areas.
+ */
+public final class TableRowContainer4a extends ContainerRa implements TableRowContainer {
+
+ /** The link to the FO tree. */
+ private Link<TableRow> foLink;
+
+ /** The parent of this node. */
+ private AbstractTablePartContainer parent;
+
+ /** The children of this node. */
+ private List<TableCellRa> children = new ArrayList<TableCellRa>();
+
+ /** See {@link #getProgressionDimension()} for a description of
+ * "progression dimension". */
+ private int progressionDimension = 0;
+
+ /**
+ * Private Constructor.
+ * Use {@link AbstractTablePartContainer#makeTableRowContainer(TableRow,
+ * GraftingPoint)} to create an instance.
+ * @param parentArea The parent area.
+ */
+ private TableRowContainer4a(final AbstractTablePartContainer parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The new instance.
+ */
+ static TableRowContainer4a makeTableRowContainer(final TableRow generatedBy,
+ final AbstractTablePartContainer parentArea) {
+ final TableRowContainer4a newRow = new TableRowContainer4a(parentArea);
+ newRow.foLink = newRow.getLink(generatedBy);
+ newRow.registerLink(generatedBy);
+
+ /* Non-standard initialization of progression dimension. */
+ int startingPD = generatedBy.traitBpDimensionMin(newRow);
+ if (startingPD == FoPropertyConstants.DIMENSION_AUTO) {
+ startingPD = 0;
+ }
+ newRow.setProgressionDimension(startingPD);
+
+ newRow.initializeAnteriorSpace();
+ return newRow;
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides superclass method because TableRowContainer contents stack in
+ * the IPD.
+ */
+ @Override
+ public RelativeAxis contentStackingAxis() {
+ return RelativeAxis.INLINE_PROGRESSION;
+ }
+
+ @Override
+ public TableCellRa makeTableCellArea(final TableCell node) {
+ final TableCellRa newCell = TableCellRa.makeTableCellRA(node, this);
+ this.children.add(newCell);
+ return newCell;
+ }
+
+ @Override
+ public String getAreaName() {
+ return "table-row";
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public int crIpd() {
+ return crIPDBlockArea();
+ }
+
+ @Override
+ public int crBpd() {
+ return this.getProgressionDimension();
+ }
+
+ @Override
+ public AbstractTablePartContainer getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(final AreaNode4a node) throws AreaTreeException {
+ if (node instanceof AbstractTablePartContainer) {
+ this.parent = (AbstractTablePartContainer) node;
+ } else {
+ throw new AreaTreeException("Parent of TableRowContainer must "
+ + "be an Abstract...
[truncated message content] |
|
From: <vic...@us...> - 2022-01-05 20:44:23
|
Revision: 12346
http://sourceforge.net/p/foray/code/12346
Author: victormote
Date: 2022-01-05 20:44:20 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Improvements to page/region inheritance between areatree/galley.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-05 20:21:00 UTC (rev 12345)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-05 20:44:20 UTC (rev 12346)
@@ -131,11 +131,6 @@
return this.getParent().getPageSequence();
}
- @Override
- public PageCollection getPageCollection() {
- return this.getParent();
- }
-
/**
* {@inheritDoc}
* Overrides the Area method, because this is the Page that is being
@@ -333,7 +328,7 @@
if (markers != null) {
for (int i = 0; i < markers.size(); i++) {
final Marker marker = markers.get(i);
- this.getPageCollection().getCurrentPageSequenceMarkers()
+ this.getParent().getCurrentPageSequenceMarkers()
.add(marker);
this.getAreaTree().getDocumentMarkers().add(marker);
}
@@ -457,7 +452,7 @@
@Override
public Area4a getOverflowArea(final Area4a childRequesting)
throws AreaTreeException {
- return (PageRa4a) getPageCollection().makePage(Force.NONE);
+ return (PageRa4a) getParent().makePage(Force.NONE);
}
/**
@@ -487,7 +482,7 @@
/* If marker not yet found, and 'retrieve-boundary' permits,
* search backward. */
List<Marker> additionalMarkers = null;
- final PageCollection pageCollection = getPageCollection();
+ final PageCollection pageCollection = getParent();
if (retrieve.traitRetrieveBoundary()
== RetrieveBoundary.PAGE_SEQUENCE) {
final PageSequence pageSequence = pageCollection.getPageSequence();
Modified: trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-01-05 20:21:00 UTC (rev 12345)
+++ trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-01-05 20:44:20 UTC (rev 12346)
@@ -219,7 +219,7 @@
*/
public void formatStaticContent(final PageRa pageArea)
throws AreaTreeException {
- final PageCollection areaTree = pageArea.getPageCollection();
+ final PageCollection areaTree = pageArea.getParent();
final PageSequence pageSeq = areaTree.getPageSequence();
final SimplePageMaster simpleMaster = pageArea.getPageMaster();
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java 2022-01-05 20:21:00 UTC (rev 12345)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java 2022-01-05 20:44:20 UTC (rev 12346)
@@ -111,8 +111,7 @@
if (footArea.areaNodeCount() != 0) {
return;
}
- final PageSequence pageSeq = bac.getPage()
- .getPageCollection().getPageSequence();
+ final PageSequence pageSeq = bac.getPage().getParent().getPageSequence();
final StaticContent separator = pageSeq.getFootnoteSeparator();
if (separator == null) {
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-05 20:21:03
|
Revision: 12345
http://sourceforge.net/p/foray/code/12345
Author: victormote
Date: 2022-01-05 20:21:00 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Rename interfaces for clarity and consistency.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnotePnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/RetrieveMarkerPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -32,7 +32,7 @@
import org.foray.common.WellKnownConstants;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.PageArea;
+import org.axsl.area.PageRa;
import org.axsl.common.PositiveIntegerFormatter;
import org.axsl.common.value.ForcePageCount;
import org.axsl.fotree.FoTreeException;
@@ -193,7 +193,7 @@
}
@Override
- public PageArea makePage(final Force forceValue)
+ public PageRa makePage(final Force forceValue)
throws AreaTreeException {
boolean isBlank = false;
if (Force.ODD.equals(forceValue)) {
@@ -361,7 +361,7 @@
* information needed to create the page.
*/
private void makeBlankPage() throws AreaTreeException {
- final PageArea pageArea = makePage(Force.NONE);
+ final PageRa pageArea = makePage(Force.NONE);
pageArea.layoutComplete();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -33,6 +33,7 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.PageCollection.Force;
+import org.axsl.area.PageRa;
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.Compass;
@@ -64,8 +65,7 @@
/**
* Area containing a page.
*/
-public final class PageRa4a extends AreaFixed implements PageG5,
- org.axsl.area.PageArea {
+public final class PageRa4a extends AreaFixed implements PageG5, PageRa {
/** The link to the FO tree. */
private Link<SimplePageMaster> foLink;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -31,6 +31,7 @@
import org.foray.area.link.Link;
import org.axsl.area.AreaTreeException;
+import org.axsl.area.RegionOuterRa;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.RelativeAxis;
import org.axsl.fotree.fo.Block;
@@ -57,7 +58,7 @@
/**
* This class is used to manage a region-reference-area.
*/
-public final class RegionOuterRa4a extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionRa {
+public final class RegionOuterRa4a extends AreaFixed implements RegionAreaG5, RegionOuterRa {
/** The link to the FO tree. */
private Link<Region> foLink;
Modified: trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -31,9 +31,9 @@
import org.axsl.area.AreaTree;
import org.axsl.area.AreaTreeException;
import org.axsl.area.LineArea;
-import org.axsl.area.PageArea;
import org.axsl.area.PageCollection;
-import org.axsl.area.RegionRa;
+import org.axsl.area.PageRa;
+import org.axsl.area.RegionOuterRa;
import org.axsl.area.factory.LineContentFactory;
import org.axsl.fotree.FoLineNonText;
import org.axsl.fotree.FoLineText;
@@ -118,7 +118,7 @@
* @param area The region area into which the static content should be placed.
* @throws AreaTreeException For errors during layout.
*/
- public abstract void layoutStaticContent(PageSequence pageSequence, Region region, RegionRa area)
+ public abstract void layoutStaticContent(PageSequence pageSequence, Region region, RegionOuterRa area)
throws AreaTreeException;
@Override
@@ -217,7 +217,7 @@
* @param pageArea The page area whose static content should be laid out.
* @throws AreaTreeException For errors during layout.
*/
- public void formatStaticContent(final PageArea pageArea)
+ public void formatStaticContent(final PageRa pageArea)
throws AreaTreeException {
final PageCollection areaTree = pageArea.getPageCollection();
final PageSequence pageSeq = areaTree.getPageSequence();
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -31,7 +31,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
import org.axsl.area.FootnoteRa;
-import org.axsl.area.PageArea;
+import org.axsl.area.PageRa;
import org.axsl.area.RegionBodyRa;
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.FootnoteBody;
@@ -81,7 +81,7 @@
* @param p The page area onto which the footnote should be laid out.
* @return True if and only if the footnote was successfully and completely laid out on the page.
*/
- public boolean layoutFootnote(final PageArea p) {
+ public boolean layoutFootnote(final PageRa p) {
/* TODO: This needs to handle multiple body-regions properly. */
final RegionBodyRa bac = p.getRegionBody("xsl-region-body");
final FootnoteRa footArea = bac.getFootnoteRefArea();
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnotePnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnotePnr.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnotePnr.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -30,7 +30,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.PageArea;
+import org.axsl.area.PageRa;
import org.axsl.fotree.fo.Footnote;
import org.axsl.fotree.fo.FootnoteBody;
import org.axsl.fotree.fo.Inline;
@@ -70,7 +70,7 @@
/* Layout the FootnoteBody. */
final FootnoteBody fbody = this.node.getFootnoteBody();
final FootnoteBodyPnr fbPL = (FootnoteBodyPnr) getLayoutProxy(fbody);
- final PageArea page = areaNode.getPage();
+ final PageRa page = areaNode.getPage();
/* If the footnote cannot be entirely laid out on the current page,
* it will be added to the list of pending footnotes. */
fbPL.layoutFootnote(page);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -34,10 +34,10 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.NormalBlockArea;
import org.axsl.area.NormalFlowRa;
-import org.axsl.area.PageArea;
import org.axsl.area.PageCollection;
+import org.axsl.area.PageRa;
import org.axsl.area.RegionBodyRa;
-import org.axsl.area.RegionRa;
+import org.axsl.area.RegionOuterRa;
import org.axsl.fotree.Fo;
import org.axsl.fotree.FoVisitor;
import org.axsl.fotree.fo.BasicLink;
@@ -205,7 +205,7 @@
// make pages and layout content
Status status = Status.UNKNOWN;
- PageArea currentPage = null;
+ PageRa currentPage = null;
while (status.isIncomplete()) {
PageCollection.Force force = PageCollection.Force.NONE;
if (status == Status.FORCE_PAGE_BREAK_EVEN) {
@@ -213,7 +213,7 @@
} else if (status == Status.FORCE_PAGE_BREAK_ODD) {
force = PageCollection.Force.ODD;
}
- final PageArea newPage = pageCollection.makePage(force);
+ final PageRa newPage = pageCollection.makePage(force);
setPendingFootnotes(newPage);
currentPage = newPage;
/*
@@ -237,7 +237,7 @@
* @param pageArea The page onto which the pending footnotes should be
* added.
*/
- private void setPendingFootnotes(final PageArea pageArea) {
+ private void setPendingFootnotes(final PageRa pageArea) {
for (int i = 0; i < this.pendingFootnotes.size(); i++) {
final FootnoteBody fb = this.pendingFootnotes.get(i);
final FootnoteBodyPnr fbPL = (FootnoteBodyPnr) this.getLayoutProxy(
@@ -251,7 +251,7 @@
@Override
public void layoutStaticContent(final PageSequence pageSequence,
- final Region region, final RegionRa area)
+ final Region region, final RegionOuterRa area)
throws AreaTreeException {
if (region == null) {
return;
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/RetrieveMarkerPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/RetrieveMarkerPnr.java 2022-01-05 20:05:41 UTC (rev 12344)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/RetrieveMarkerPnr.java 2022-01-05 20:21:00 UTC (rev 12345)
@@ -30,7 +30,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.PageArea;
+import org.axsl.area.PageRa;
import org.axsl.area.RetrieveMarkerNode;
import org.axsl.area.factory.RetrieveMarkerNodeFactory;
import org.axsl.fotree.Fo;
@@ -65,7 +65,7 @@
"child of " + areaNode.getClass().getName();
throw new AreaTreeException(message);
}
- final PageArea containingPage = areaNode.getPage();
+ final PageRa containingPage = areaNode.getPage();
final Marker bestMarker = containingPage.bestMarker(this.node);
if (bestMarker == null) {
return Status.OK;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-05 20:05:44
|
Revision: 12344
http://sourceforge.net/p/foray/code/12344
Author: victormote
Date: 2022-01-05 20:05:41 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Rename page- and region- related classes in preparation for type cleanup.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionBodyRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionOuterRa4a.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -33,8 +33,8 @@
import org.foray.area.MainRa4a;
import org.foray.area.NormalFlowRa4a;
import org.foray.area.PageCollection;
-import org.foray.area.PageRa;
-import org.foray.area.RegionRaBody;
+import org.foray.area.PageRa4a;
+import org.foray.area.RegionBodyRa4a;
import org.foray.area.SpanRa4a;
import org.foray.area.TextAreaCharacters;
import org.foray.common.data.OrderedTreeNode;
@@ -96,8 +96,8 @@
*/
protected NormalFlowRa4a getFirstNormalFlowArea(final AreaTree4a areaTree) {
final PageCollection pageCollection = getPageCollection(areaTree, 1);
- final PageRa firstPage = getPage(pageCollection, 1);
- final RegionRaBody regionBody = firstPage.getRegionBody(
+ final PageRa4a firstPage = getPage(pageCollection, 1);
+ final RegionBodyRa4a regionBody = firstPage.getRegionBody(
"xsl-region-body");
final MainRa4a main = regionBody.getMainRefArea();
AreaNode4a node = main.areaNodeAt(0);
@@ -133,7 +133,7 @@
* is, "1" for the first page in the collection, "2" for the second, etc.
* @return The requested page, or null if it does not exist.
*/
- protected PageRa getPage(final PageCollection pageCollection,
+ protected PageRa4a getPage(final PageCollection pageCollection,
final int pageNum) {
Assert.assertNotNull(pageCollection);
/* Convert the ordinal page number to an index into the children. */
@@ -141,8 +141,8 @@
Assert.assertTrue(index >= 0);
Assert.assertTrue(index < pageCollection.areaNodeCount());
final AreaNode4a node = pageCollection.areaNodeAt(index);
- Assert.assertTrue(node instanceof PageRa);
- final PageRa page = (PageRa) node;
+ Assert.assertTrue(node instanceof PageRa4a);
+ final PageRa4a page = (PageRa4a) node;
return page;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -325,7 +325,7 @@
}
@Override
- public PageRa getPage() {
+ public PageRa4a getPage() {
return getParent().getPage();
}
@@ -528,7 +528,7 @@
* Also classes like LineArea can use this to adjust word-spacing and other
* variables.
* NOTE: This method is called recursively by each node.
- * The process starts at {@link PageRa#layoutComplete()}.
+ * The process starts at {@link PageRa4a#layoutComplete()}.
* @return True if and only if the Area node thinks it should be removed.
*/
protected abstract boolean optimize();
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaTree4a.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -114,7 +114,7 @@
* The list of pages waiting to be renderered.
* In general, pages waiting to be rendered are doing so because they have unresolved "ref-id" items on them.
*/
- private List<PageRa> renderQueue = new ArrayList<PageRa>();
+ private List<PageRa4a> renderQueue = new ArrayList<PageRa4a>();
/** Factory that knows how to create new linkage instances. */
private LinkFactory linkageFactory = new LinkFactory();
@@ -306,7 +306,7 @@
* Notify all listeners that a "Page Complete" event has been fired.
* @param page The PageArea instance that was just completed.
*/
- protected void notifyPageComplete(final PageRa page) {
+ protected void notifyPageComplete(final PageRa4a page) {
/* Add the newly laid-out page to the queue. It may or may not be ready
* to process because of unresolved references or other factors that
* require looking ahead at future pages. */
@@ -324,7 +324,7 @@
*/
private synchronized void processQueue(final boolean force) {
while (this.renderQueue.size() > 0) {
- final PageRa queuedPage = this.renderQueue.get(0);
+ final PageRa4a queuedPage = this.renderQueue.get(0);
if (force
|| queuedPage.isReleasable()) {
releasePage(queuedPage);
@@ -339,7 +339,7 @@
* Releases a given page by firing a "Page Complete" event.
* @param page The page to be released.
*/
- private void releasePage(final PageRa page) {
+ private void releasePage(final PageRa4a page) {
page.optimize();
/* If nobody wants these events, don't waste resources creating
* them. */
@@ -467,7 +467,7 @@
* @param page The page being tested.
* @return True if and only if the given page is in the queue of completed pages.
*/
- public boolean isPageQueued(final PageRa page) {
+ public boolean isPageQueued(final PageRa4a page) {
return this.renderQueue.contains(page);
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -60,7 +60,7 @@
* Private Constructor.
* @param parentArea The parent area.
*/
- private BeforeFloatRa4a(final RegionRaBody parentArea) {
+ private BeforeFloatRa4a(final RegionBodyRa4a parentArea) {
this.parent = parentArea;
}
@@ -70,7 +70,7 @@
* @param parentArea The parent area.
* @return The new instance.
*/
- static BeforeFloatRa4a makeBeforeFloatArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
+ static BeforeFloatRa4a makeBeforeFloatArea(final RegionBody generatedBy, final RegionBodyRa4a parentArea) {
final BeforeFloatRa4a newFloatRA = new BeforeFloatRa4a(parentArea);
newFloatRA.foLink = newFloatRA.getLink(generatedBy);
newFloatRA.registerLink(generatedBy);
@@ -79,7 +79,7 @@
@Override
public int crBpd() {
- return ((RegionRaBody) ancestorArea()).getDimensionBeforeFloatRA();
+ return ((RegionBodyRa4a) ancestorArea()).getDimensionBeforeFloatRA();
}
@Override
@@ -115,9 +115,9 @@
* Returns the parent body area.
* @return The parent body area.
*/
- public RegionRaBody getRegionBodyArea() {
+ public RegionBodyRa4a getRegionBodyArea() {
/* Cast verified at construction. */
- return (RegionRaBody) ancestorArea();
+ return (RegionBodyRa4a) ancestorArea();
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -59,7 +59,7 @@
* Private Constructor.
* @param parentArea The parent area.
*/
- private FootnoteRa4a(final RegionRaBody parentArea) {
+ private FootnoteRa4a(final RegionBodyRa4a parentArea) {
this.parent = parentArea;
}
@@ -69,7 +69,7 @@
* @param parentArea The parent area.
* @return The new instance.
*/
- static FootnoteRa4a makeFootnoteReferenceArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
+ static FootnoteRa4a makeFootnoteReferenceArea(final RegionBody generatedBy, final RegionBodyRa4a parentArea) {
final FootnoteRa4a footnoteRA = new FootnoteRa4a(parentArea);
footnoteRA.foLink = footnoteRA.getLink(generatedBy);
footnoteRA.registerLink(generatedBy);
@@ -78,7 +78,7 @@
@Override
public int crBpd() {
- return ((RegionRaBody) ancestorArea()).getDimensionFootnoteRA();
+ return ((RegionBodyRa4a) ancestorArea()).getDimensionFootnoteRA();
}
@Override
@@ -125,9 +125,9 @@
* Returns the parent region body area.
* @return The parent region body area.
*/
- public RegionRaBody getRegionBodyArea() {
+ public RegionBodyRa4a getRegionBodyArea() {
/* Cast verified at construction. */
- return (RegionRaBody) ancestorArea();
+ return (RegionBodyRa4a) ancestorArea();
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -71,7 +71,7 @@
* Private Constructor.
* @param parentArea The parent area.
*/
- private MainRa4a(final RegionRaBody parentArea) {
+ private MainRa4a(final RegionBodyRa4a parentArea) {
this.parent = parentArea;
}
@@ -81,7 +81,7 @@
* @param parentArea The parent area.
* @return The new instance.
*/
- static MainRa4a makeMainReferenceArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
+ static MainRa4a makeMainReferenceArea(final RegionBody generatedBy, final RegionBodyRa4a parentArea) {
final MainRa4a newMainRA = new MainRa4a(parentArea);
newMainRA.foLink = newMainRA.getLink(generatedBy);
newMainRA.registerLink(generatedBy);
@@ -266,7 +266,7 @@
@Override
public int crBpd() {
- return ((RegionRaBody) ancestorArea()).getDimensionMainRA();
+ return ((RegionBodyRa4a) ancestorArea()).getDimensionMainRA();
}
@Override
@@ -283,13 +283,13 @@
@Override
public int crOriginBPDOffset() {
- return ((RegionRaBody) ancestorArea()).getDimensionBeforeFloatRA();
+ return ((RegionBodyRa4a) ancestorArea()).getDimensionBeforeFloatRA();
}
@Override
public Area4a getOverflowArea(final Area4a childRequesting)
throws AreaTreeException {
- final RegionRaBody bodyRegion = (RegionRaBody) ancestorArea()
+ final RegionBodyRa4a bodyRegion = (RegionBodyRa4a) ancestorArea()
.getOverflowArea(this);
return bodyRegion.getMainRefArea();
}
@@ -300,7 +300,7 @@
*/
public int traitColumnCount() {
// Cast verified at construction.
- final RegionRaBody parent = (RegionRaBody) this.getParent();
+ final RegionBodyRa4a parent = (RegionBodyRa4a) this.getParent();
return parent.traitColumnCount();
}
@@ -310,7 +310,7 @@
*/
public int traitColumnGap() {
// Cast verified at construction.
- final RegionRaBody parent = (RegionRaBody) this.getParent();
+ final RegionBodyRa4a parent = (RegionBodyRa4a) this.getParent();
return parent.traitColumnGap();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageCollection.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -64,7 +64,7 @@
private AreaTree4a parent;
/** The children of this node. */
- private List<PageRa> children = new ArrayList<PageRa>();
+ private List<PageRa4a> children = new ArrayList<PageRa4a>();
/** The number of pages (so far) in this PageCollection. */
private int pageCount = 0;
@@ -114,7 +114,7 @@
* on an AreaTree instance will get an NPE, since it uses getParent().
*/
@Override
- public PageRa getPage() {
+ public PageRa4a getPage() {
return null;
}
@@ -212,7 +212,7 @@
} catch (final FoTreeException e) {
throw new AreaTreeException(e);
}
- final PageRa newPage = PageRa.makePageArea(spm, this);
+ final PageRa4a newPage = PageRa4a.makePageArea(spm, this);
this.children.add(newPage);
final int newPageNumber = getCurrentPageNumber();
newPage.setNumber(newPageNumber);
@@ -407,7 +407,7 @@
}
@Override
- public List<PageRa> getChildren() {
+ public List<PageRa4a> getChildren() {
return this.children;
}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java 2022-01-05 18:17:37 UTC (rev 12343)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -1,830 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-import org.foray.area.link.NormalLink;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.area.PageCollection.Force;
-import org.axsl.common.value.AbsoluteAxis;
-import org.axsl.common.value.AbsoluteDirection;
-import org.axsl.common.value.Compass;
-import org.axsl.common.value.RelativeAxis;
-import org.axsl.common.value.RetrieveBoundary;
-import org.axsl.common.value.RetrievePosition;
-import org.axsl.fotree.Fo;
-import org.axsl.fotree.fo.Marker;
-import org.axsl.fotree.fo.PageSequence;
-import org.axsl.fotree.fo.Region;
-import org.axsl.fotree.fo.RegionAfter;
-import org.axsl.fotree.fo.RegionBefore;
-import org.axsl.fotree.fo.RegionBody;
-import org.axsl.fotree.fo.RegionEnd;
-import org.axsl.fotree.fo.RegionStart;
-import org.axsl.fotree.fo.RetrieveMarker;
-import org.axsl.fotree.fo.SimplePageMaster;
-import org.axsl.galley.AreaNodeG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.PageG5;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Area containing a page.
- */
-public final class PageRa extends AreaFixed implements PageG5,
- org.axsl.area.PageArea {
-
- /** The link to the FO tree. */
- private Link<SimplePageMaster> foLink;
-
- /** The parent of this node. */
- private PageCollection parent;
-
- /** The children of this node. */
- private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
-
- /** The child region-body(s). */
- private Map<String, RegionRaBody> bodies =
- new HashMap<String, RegionRaBody>();
-
- /** The child region-before. */
- private RegionRa before;
-
- /** The child region-after. */
- private RegionRa after;
-
- /** The child region-start. */
- private RegionRa start;
-
- /** The child region-end. */
- private RegionRa end;
-
- /** The numeric page number for this page. */
- private int pageNumber = 0;
-
- /** The formatted page number for this page. */
- private CharSequence formattedPageNumber;
-
- /** The list of markers found on this page. */
- private List<Marker> markers = new ArrayList<Marker>();
-
- /**
- * Private Constructor.
- * @param parentArea The parent page collection.
- */
- private PageRa(final PageCollection parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Constructor.
- * @param generatedBy The page master that generates this page.
- * @param parentArea The parent page collection.
- * @return The new instance.
- */
- static PageRa makePageArea(final SimplePageMaster generatedBy, final PageCollection parentArea) {
- final PageRa newPage = new PageRa(parentArea);
- newPage.foLink = newPage.getLink(generatedBy);
- newPage.registerLink(generatedBy);
- newPage.createRegions();
- return newPage;
- }
-
- /**
- * Returns the page-sequence that generated this page.
- * @return The page-sequence that generated this page.
- */
- public PageSequence getPageSequence() {
- return this.getParent().getPageSequence();
- }
-
- @Override
- public PageCollection getPageCollection() {
- return this.getParent();
- }
-
- /**
- * {@inheritDoc}
- * Overrides the Area method, because this is the Page that is being
- * sought.
- */
- @Override
- public PageRa getPage() {
- return this;
- }
-
- /**
- * Sets the page number for this page.
- * @param number The new page number.
- */
- public void setNumber(final int number) {
- this.pageNumber = number;
- }
-
- @Override
- public int getNumber() {
- return this.pageNumber;
- }
-
- /**
- * Sets the formatted page number for this page.
- * @param number The new formatted page number.
- */
- public void setFormattedNumber(final CharSequence number) {
- this.formattedPageNumber = number;
- }
-
- @Override
- public CharSequence getFormattedNumber() {
- return this.formattedPageNumber;
- }
-
- @Override
- public RegionRa getRegionAfter() {
- return this.after;
- }
-
- @Override
- public RegionRa getRegionBefore() {
- return this.before;
- }
-
- @Override
- public RegionRa getRegionStart() {
- return this.start;
- }
-
- @Override
- public RegionRa getRegionEnd() {
- return this.end;
- }
-
- @Override
- public Collection<RegionRaBody> getRegionBodies() {
- return this.bodies.values();
- }
-
- @Override
- public int getHeight() {
- return traitGeneratedBy().traitPageHeight();
- }
-
- @Override
- public int getWidth() {
- return traitGeneratedBy().traitPageWidth();
- }
-
- @Override
- public void registerMarker(final Marker marker) {
- this.markers.add(marker);
- }
-
- /**
- * Unregister a marker for this page.
- * @param marker The marker to be unregistered.
- */
- public void unregisterMarker(final Marker marker) {
- this.markers.remove(marker);
- }
-
- /**
- * Returns the markers found on this page.
- * @return The markers found on this page.
- */
- public List<Marker> getMarkers() {
- return this.markers;
- }
-
- /**
- * Creates the child regions for this page.
- */
- private void createRegions() {
- // generatedBy is defined as a SimplePageMaster in the Page constructor.
- createRegionBody();
- createRegionBefore();
- createRegionAfter();
- createRegionStart();
- createRegionEnd();
- }
-
- /**
- * Creates the region-body for this page.
- */
- private void createRegionBody() {
- final SimplePageMaster simplePageMaster = getPageMaster();
- for (RegionBody regionBody : simplePageMaster.getRegionBodies()) {
- final RegionRaBody area = RegionRaBody.makeRegionBodyArea(
- regionBody, this);
- this.children.add(area);
- final String name = regionBody.traitRegionName();
- this.bodies.put(name, area);
- }
- }
-
- /**
- * Creates the region-before for this page.
- */
- private void createRegionBefore() {
- final SimplePageMaster simplePageMaster = getPageMaster();
- if (simplePageMaster.getRegionBefore() == null) {
- return;
- }
- final RegionBefore region = simplePageMaster.getRegionBefore();
- this.before = makeRegionRA(region);
- }
-
- /**
- * Creates the region-after for this page.
- */
- private void createRegionAfter() {
- final SimplePageMaster simplePageMaster = getPageMaster();
- if (simplePageMaster.getRegionAfter() == null) {
- return;
- }
- final RegionAfter region = simplePageMaster.getRegionAfter();
- this.after = makeRegionRA(region);
- }
-
- /**
- * Creates the region-start for this page.
- */
- private void createRegionStart() {
- final SimplePageMaster simplePageMaster = getPageMaster();
- if (simplePageMaster.getRegionStart() == null) {
- return;
- }
- final RegionStart region = simplePageMaster.getRegionStart();
- this.start = makeRegionRA(region);
- }
-
- /**
- * Creates the region-end for this page.
- */
- private void createRegionEnd() {
- final SimplePageMaster simplePageMaster = getPageMaster();
- if (simplePageMaster.getRegionEnd() == null) {
- return;
- }
- final RegionEnd region = simplePageMaster.getRegionEnd();
- this.end = makeRegionRA(region);
- }
-
- /**
- * Creates a region area.
- * @param region The FObj region that is generating the region area.
- * @return The new region area.
- */
- private RegionRa makeRegionRA(final Region region) {
- final RegionRa area = RegionRa.makeRegionArea(region, this);
- this.children.add(area);
- return area;
- }
-
- /**
- * {@inheritDoc}
- * Overrides the Area method, because there will be nothing above here
- * that was generated by a block-level FO.
- * @return Always returns null (override of method in Area).
- */
- @Override
- public Area4a nearestGeneratedByBlockLevelFo() {
- return null;
- }
-
- @Override
- public void layoutComplete() throws AreaTreeException {
- /* Optimization of this page is done by the AreaTree itself right before
- * the page is released for rendering.
- * See {@link AreaTree#releasePage(PageRa)}. */
- final List<Marker> markers = getMarkers();
- if (markers != null) {
- for (int i = 0; i < markers.size(); i++) {
- final Marker marker = markers.get(i);
- this.getPageCollection().getCurrentPageSequenceMarkers()
- .add(marker);
- this.getAreaTree().getDocumentMarkers().add(marker);
- }
- }
- this.getAreaTree().notifyPageComplete(this);
- }
-
- @Override
- public AreaNodeG5 firstUnresolvedRefId() {
- return firstUnresolvedRefId(this);
- }
-
- /**
- * Recursively examines nodes in a fragment of the AreaTree, and returns
- * the first one that has an unresolved "ref-id".
- * @param node The AreaNode instance that is the root of the tree fragment
- * currently being examined.
- * @return The first node with an unresolved "ref-id", or null if all
- * ref-ids are resolved.
- */
- private AreaNode4a firstUnresolvedRefId(final AreaNode4a node) {
- // First, check the Area itself.
- if (node.hasUnresolvedRefId()) {
- return node;
- }
- // Then, check each child.
- final List<? extends AreaNode4a> children = node.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final AreaNode4a child = children.get(i);
- final AreaNode4a firstUnresolved = firstUnresolvedRefId(child);
- if (firstUnresolved != null) {
- return firstUnresolved;
- }
- }
- return null;
- }
-
- @Override
- public int crIpd() {
- int viewportIpd = 0;
- if (getWritingMode().getIpAxis() == AbsoluteAxis.HORIZONTAL) {
- viewportIpd = traitPageWidth();
- } else {
- viewportIpd = traitPageHeight();
- }
-// return viewportIpd - traitSpaceStartOptimum() - traitSpaceEndOptimum();
- return viewportIpd;
- }
-
- @Override
- public int crBpd() {
- int viewportBpd = 0;
- if (getWritingMode().getBpAxis() == AbsoluteAxis.VERTICAL) {
- viewportBpd = traitPageHeight();
- } else {
- viewportBpd = traitPageWidth();
- }
- return viewportBpd - traitSpaceBeforeOptimum()
- - traitSpaceAfterOptimum();
- }
-
- @Override
- public int crOriginIPDOffset() {
- // The relative point of origin is 0,0.
- return 0;
- }
-
- @Override
- public int crOriginBPDOffset() {
- // The relative point of origin is 0,0.
- return 0;
- }
-
- @Override
- public int crOriginX() {
- final AbsoluteDirection bpDirection = getWritingMode().getBpDirection();
- final AbsoluteDirection ipDirection =
- getWritingMode().getIpDirectionOdd();
- if (bpDirection.isVertical()) {
- if (ipDirection == AbsoluteDirection.LEFT_TO_RIGHT) {
- return traitStartIndent();
- } else {
- return this.traitPageWidth() - traitStartIndent();
- }
- } else {
- /* Block-progression direction is horizontal. */
- if (bpDirection == AbsoluteDirection.LEFT_TO_RIGHT) {
- return traitSpaceBeforeOptimum();
- } else {
- return this.traitPageWidth() - traitSpaceBeforeOptimum();
- }
- }
- }
-
- @Override
- public int crOriginY() {
- final AbsoluteDirection bpDirection = getWritingMode().getBpDirection();
- final AbsoluteDirection ipDirection =
- getWritingMode().getIpDirectionOdd();
- if (bpDirection.isHorizontal()) {
- if (ipDirection == AbsoluteDirection.TOP_TO_BOTTOM) {
- return traitPageHeight() - traitStartIndent();
- } else {
- return traitStartIndent();
- }
- } else {
- /* Block-progression direction is vertical. */
- if (bpDirection == AbsoluteDirection.TOP_TO_BOTTOM) {
- return traitPageHeight() - traitSpaceBeforeOptimum();
- } else {
- return traitSpaceBeforeOptimum();
- }
- }
- }
-
- /**
- * {@inheritDoc}
- * Overrides method in Area, because at this point, a new page needs to
- * be created.
- */
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return (PageRa) getPageCollection().makePage(Force.NONE);
- }
-
- /**
- * Returns the relative direction that matches the binding edge for this
- * page.
- * @return One of the following TraitEnumeration constants:
- * DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, or DIRECTION_AFTER.
- * Note that the standard does not appear to offer any guidance on this
- * computation. It is possible, for example, that landscape pages should
- * be bound at the top/bottom instead of left/right.
- */
- public Compass getBindingEdge() {
- // If it is an even-numbered page, binding is on the right.
- if (this.getNumber() % 2 == 0) {
- return getWritingMode().getRight();
- }
- // Otherwise, binding is on the left.
- return getWritingMode().getLeft();
- }
-
- @Override
- public Marker bestMarker(final RetrieveMarker retrieve) {
- final Marker marker = this.bestMarkerThisPage(retrieve);
- if (marker != null) {
- return marker;
- }
- /* If marker not yet found, and 'retrieve-boundary' permits,
- * search backward. */
- List<Marker> additionalMarkers = null;
- final PageCollection pageCollection = getPageCollection();
- if (retrieve.traitRetrieveBoundary()
- == RetrieveBoundary.PAGE_SEQUENCE) {
- final PageSequence pageSequence = pageCollection.getPageSequence();
- if (pageSequence == getPageSequence()) {
- additionalMarkers = pageCollection
- .getCurrentPageSequenceMarkers();
- }
- } else if (retrieve.traitRetrieveBoundary()
- == RetrieveBoundary.DOCUMENT) {
- additionalMarkers = pageCollection.getDocumentMarkers();
- }
- if (additionalMarkers == null) {
- return null;
- }
- for (int i = additionalMarkers.size() - 1; i >= 0; i--) {
- final Marker currentMarker = additionalMarkers.get(i);
- if (currentMarker.traitMarkerClassName().equals(
- retrieve.traitRetrieveClassName())) {
- return currentMarker;
- }
- }
- return null;
- }
-
- /**
- * Finds, the best marker, if any, on the current page.
- * @param retrieve The retrieve-marker for which the marker is sought.
- * @return The best marker, or null if none on this page meet the criteria.
- */
- private Marker bestMarkerThisPage(final RetrieveMarker retrieve) {
- final List<Marker> pageMarkers = getMarkers();
- if (getMarkers().isEmpty()) {
- return null;
- }
-
- final RetrievePosition retrievePosition =
- retrieve.traitRetrievePosition();
- // search forward if 'first-starting-within-page' or
- // 'first-including-carryover'
- if (retrievePosition == RetrievePosition.FIRST_INCLUDING_CARRYOVER) {
- for (int i = 0; i < pageMarkers.size(); i++) {
- final Marker currentMarker = pageMarkers.get(i);
- if (currentMarker.traitMarkerClassName().equals(
- retrieve.traitRetrieveClassName())) {
- return currentMarker;
- }
- }
- } else if (retrievePosition
- == RetrievePosition.FIRST_STARTING_WITHIN_PAGE) {
- for (int i = 0; i < pageMarkers.size(); i++) {
- final Marker currentMarker = pageMarkers.get(i);
- if (currentMarker.traitMarkerClassName().equals(
- retrieve.traitRetrieveClassName())) {
- if (startsHere(currentMarker)) {
- return currentMarker;
- }
- }
- }
- } else if (retrievePosition
- == RetrievePosition.LAST_STARTING_WITHIN_PAGE) {
- for (int i = pageMarkers.size() - 1; i >= 0; i--) {
- final Marker currentMarker = pageMarkers.get(i);
- if (currentMarker.traitMarkerClassName().equals(
- retrieve.traitRetrieveClassName())) {
- if (startsHere(currentMarker)) {
- return currentMarker;
- }
- }
- }
- } else if (retrievePosition
- == RetrievePosition.LAST_ENDING_WITHIN_PAGE) {
- for (int i = pageMarkers.size() - 1; i >= 0; i--) {
- final Marker currentMarker = pageMarkers.get(i);
- if (currentMarker.traitMarkerClassName().equals(
- retrieve.traitRetrieveClassName())) {
- if (endsHere(currentMarker)) {
- return currentMarker;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Indicates whether the first area returned by a marker is on this page.
- * @param marker The Marker instance that should be tested.
- * @return True if the first area returned by marker is on this page.
- */
- private boolean startsHere(final Marker marker) {
- final NormalLink<? extends Fo> normalLinkage = this.markerParentLinkage(marker);
- if (normalLinkage == null) {
- return false;
- }
- final Area4a firstArea = normalLinkage.firstNormalAreaReturned();
- if (firstArea == null) {
- return false;
- }
- if (firstArea.getPage() == this) {
- return true;
- }
- return false;
- }
-
- /**
- * Indicates whether the last area returned by a marker is on this page.
- * @param marker The Marker instance that should be tested.
- * @return True if the last area returned by marker is on this page.
- */
- private boolean endsHere(final Marker marker) {
- final NormalLink<? extends Fo> normalLinkage = this.markerParentLinkage(marker);
- if (normalLinkage == null) {
- return false;
- }
- final Area4a lastArea = normalLinkage.lastNormalAreaReturned();
- if (lastArea == null) {
- return false;
- }
- if (lastArea.getPage() == this) {
- return true;
- }
- return false;
- }
-
- /**
- * Returns the linkage for a given marker.
- * @param marker The marker for which the linkage is needed.
- * @return The linkage.
- */
- private NormalLink<? extends Fo> markerParentLinkage(final Marker marker) {
- final Fo parent = marker.getParent();
- final Link<Fo> proxy = getLink(parent);
- if (proxy instanceof NormalLink) {
- return (NormalLink<Fo>) proxy;
- }
- /* This would mean nested markers. Should never happen. */
- return null;
- }
-
- @Override
- public SimplePageMaster getPageMaster() {
- return this.traitGeneratedBy();
- }
-
- @Override
- public String getAreaName() {
- return "page";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public RelativeAxis contentStackingAxis() {
- return RelativeAxis.BLOCK_PROGRESSION;
- }
-
- @Override
- public PageCollection getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- if (node instanceof PageCollection) {
- this.parent = (PageCollection) node;
- } else {
- throw new AreaTreeException("Parent of PageRa must be a "
- + "PageCollection");
- }
- }
-
- @Override
- public List<AreaNode4a> getChildren() {
- return this.children;
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<SimplePageMaster> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public SimplePageMaster traitGeneratedBy() {
- return (SimplePageMaster) this.getFoLink().getGenerator();
- }
-
- /**
- * Indicates whether this page is ready to be released for rendering.
- * To qualify as ready to release, the following factors must be true:
- * <ul>
- * <li>All references must be resolved.</li>
- * <li>A sufficient number of following pages must also be laid out in
- * order to safely ensure that areas on this page know whether or not they
- * are the "last" areas generated by their parent formatting objects.
- * This "sufficient number" of pages is currently thought to be one
- * non-blank page.</li>
- * </ul>
- * @return True if and only if this page is ready to be released for rendering.
- */
- public boolean isReleasable() {
- if (this.firstUnresolvedRefId() != null) {
- return false;
- }
- final PageRa nextNonBlankPage = this.nextNonBlankPageInCollection();
- if (nextNonBlankPage != null) {
- /* If the next page exists but is not in the queue, we don't yet
- * know enought to release this one. */
- if (! this.getAreaTree().isPageQueued(nextNonBlankPage)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the next non-blank page in this page's collection.
- * @return The next non-blank page in this page's collection, or null if
- * this is the last non-blank page in the collection.
- */
- private PageRa nextNonBlankPageInCollection() {
- PageRa nextPage = (PageRa) this.getNextSibling();
- while (true) {
- if (nextPage == null) {
- return null;
- }
- if (! nextPage.isBlank()) {
- return nextPage;
- }
- nextPage = (PageRa) nextPage.getNextSibling();
- }
- }
-
- /**
- * Indicates whether this page is a blank page or not.
- * @return True if and only if this page is blank.
- */
- public boolean isBlank() {
- for (RegionRaBody body : this.bodies.values()) {
- if (body.areaNodeCount() > 0) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the region-body area for a named region.
- * @param regionName The name of the region to be returned.
- * @return The named region.
- */
- public RegionRaBody getRegionBody(final String regionName) {
- return this.bodies.get(regionName);
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public int traitSpaceBeforeOptimum() {
- return traitGeneratedBy().traitSpaceBeforeOptimum(this);
- }
-
- @Override
- public int traitSpaceAfterOptimum() {
- return traitGeneratedBy().traitSpaceAfterOptimum(this);
- }
-
- @Override
- public int traitEndIndent() {
- return traitGeneratedBy().traitEndIndent(this);
- }
-
- @Override
- public int traitStartIndent() {
- return traitGeneratedBy().traitStartIndent(this);
- }
-
- /**
- * Returns the page-width trait of this area.
- * @return The page-width trait of this area.
- */
- public int traitPageWidth() {
- return traitGeneratedBy().traitPageWidth();
- }
-
- /**
- * Returns the page-height trait of this area.
- * @return The page-height trait of this area.
- */
- public int traitPageHeight() {
- return traitGeneratedBy().traitPageHeight();
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java (from rev 12325, trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageRa4a.java 2022-01-05 20:05:41 UTC (rev 12344)
@@ -0,0 +1,830 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+import org.foray.area.link.NormalLink;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.PageCollection.Force;
+import org.axsl.common.value.AbsoluteAxis;
+import org.axsl.common.value.AbsoluteDirection;
+import org.axsl.common.value.Compass;
+import org.axsl.common.value.RelativeAxis;
+import org.axsl.common.value.RetrieveBoundary;
+import org.axsl.common.value.RetrievePosition;
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.Marker;
+import org.axsl.fotree.fo.PageSequence;
+import org.axsl.fotree.fo.Region;
+import org.axsl.fotree.fo.RegionAfter;
+import org.axsl.fotree.fo.RegionBefore;
+import org.axsl.fotree.fo.RegionBody;
+import org.axsl.fotree.fo.RegionEnd;
+import org.axsl.fotree.fo.RegionStart;
+import org.axsl.fotree.fo.RetrieveMarker;
+import org.axsl.fotree.fo.SimplePageMaster;
+import org.axsl.galley.AreaNodeG5;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+import org.axsl.galley.PageG5;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Area containing a page.
+ */
+public final class PageRa4a extends AreaFixed implements PageG5,
+ org.axsl.area.PageArea {
+
+ /** The link to the FO tree. */
+ private Link<SimplePageMaster> foLink;
+
+ /** The parent of this node. */
+ private PageCollection parent;
+
+ /** The children of this node. */
+ private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
+
+ /** The child region-body(s). */
+ private Map<String, RegionBodyRa4a> bodies =
+ new HashMap<String, RegionBodyRa4a>();
+
+ /** The child region-before. */
+ private RegionOuterRa4a before;
+
+ /** The child region-after. */
+ private RegionOuterRa4a after;
+
+ /** The child region-start. */
+ private RegionOuterRa4a start;
+
+ /** The child region-end. */
+ private RegionOuterRa4a end;
+
+ /** The numeric page number for this page. */
+ private int pageNumber = 0;
+
+ /** The formatted page number for this page. */
+ private CharSequence formattedPageNumber;
+
+ /** The list of markers found on this page. */
+ private List<Marker> markers = new ArrayList<Marker>();
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent page collection.
+ */
+ private PageRa4a(final PageCollection parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * Constructor.
+ * @param generatedBy The page master that generates this page.
+ * @param parentArea The parent page collection.
+ * @return The new instance.
+ */
+ static PageRa4a makePageArea(final SimplePageMaster generatedBy, final PageCollection parentArea) {
+ final PageRa4a newPage = new PageRa4a(parentArea);
+ newPage.foLink = newPage.getLink(generatedBy);
+ newPage.registerLink(generatedBy);
+ newPage.createRegions();
+ return newPage;
+ }
+
+ /**
+ * Returns the page-sequence that generated this page.
+ * @return The page-sequence that generated this page.
+ */
+ public PageSequence getPageSequence() {
+ return this.getParent().getPageSequence();
+ }
+
+ @Override
+ public PageCollection getPageCollection() {
+ return this.getParent();
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides the Area method, because this is the Page that is being
+ * sought.
+ */
+ @Override
+ public PageRa4a getPage() {
+ return this;
+ }
+
+ /**
+ * Sets the page number for this page.
+ * @param number The new page number.
+ */
+ public void setNumber(final int number) {
+ this.pageNumber = number;
+ }
+
+ @Override
+ public int getNumber() {
+ return this.pageNumber;
+ }
+
+ /**
+ * Sets the formatted page number for this page.
+ * @param number The new formatted page number.
+ */
+ public void setFormattedNumber(final CharSequence number) {
+ this.formattedPageNumber = number;
+ }
+
+ @Override
+ public CharSequence getFormattedNumber() {
+ return this.formattedPageNumber;
+ }
+
+ @Override
+ public RegionOuterRa4a getRegionAfter() {
+ return this.after;
+ }
+
+ @Override
+ public RegionOuterRa4a getRegionBefore() {
+ return this.before;
+ }
+
+ @Override
+ public RegionOuterRa4a getRegionStart() {
+ return this.start;
+ }
+
+ @Override
+ public RegionOuterRa4a getRegionEnd() {
+ return this.end;
+ }
+
+ @Override
+ public Collection<RegionBodyRa4a> getRegionBodies() {
+ return this.bodies.values();
+ }
+
+ @Override
+ public int getHeight() {
+ return traitGeneratedBy().traitPageHeight();
+ }
+
+ @Override
+ public int getWidth() {
+ return traitGeneratedBy().traitPageWidth();
+ }
+
+ @Override
+ public void registerMarker(final Marker marker) {
+ this.markers.add(marker);
+ }
+
+ /**
+ * Unregister a marker for this page.
+ * @param marker The marker to be unregistered.
+ */
+ public void unregisterMarker(final Marker marker) {
+ this.markers.remove(marker);
+ }
+
+ /**
+ * Returns the markers found on this page.
+ * @return The markers found on this page.
+ */
+ public List<Marker> getMarkers() {
+ return this.markers;
+ }
+
+ /**
+ * Creates the child regions for this page.
+ */
+ private void createRegions() {
+ // generatedBy is defined as a SimplePageMaster in the Page constructor.
+ createRegionBody();
+ createRegionBefore();
+ createRegionAfter();
+ createRegionStart();
+ createRegionEnd();
+ }
+
+ /**
+ * Creates the region-body for this page.
+ */
+ private void createRegionBody() {
+ final SimplePageMaster simplePageMaster = getPageMaster();
+ for (RegionBody regionBody : simplePageMaster.getRegionBodies()) {
+ final RegionBodyRa4a area = RegionBodyRa4a.makeRegionBodyArea(
+ regionBody, this);
+ this.children.add(area);
+ final String name = regionBody.traitRegionName();
+ this.bodies.put(name, area);
+ }
+ }
+
+ /**
+ * Creates the region-before for this page.
+ */
+ private void createRegionBefore() {
+ final SimplePageMaster simplePageMaster = getPageMaster();
+ if (simplePageMaster.getRegionBefore() == null) {
+ return;
+ }
+ final RegionBefore region = simplePageMaster.getRegionBefore();
+ this.before = makeRegionRA(region);
+ }
+
+ /**
+ * Creates the region-after for this page.
+ */
+ private void createRegionAfter() {
+ final SimplePageMaster simplePageMaster = getPageMaster();
+ if (simplePageMaster.getRegionAfter() == null) {
+ return;
+ }
+ final RegionAfter region = simplePageMaster.getRegionAfter();
+ this.after = makeRegionRA(region);
+ }
+
+ /**
+ * Creates the region-start for this page.
+ */
+ private void createRegionStart() {
+ final SimplePageMaster simplePageMaster = getPageMaster();
+ if (simplePageMaster.getRegionStart() == null) {
+ return;
+ }
+ final RegionStart region = simplePageMaster.getRegionStart();
+ this.start = makeRegionRA(region);
+ }
+
+ /**
+ * Creates the region-end for this page.
+ */
+ private void createRegionEnd() {
+ final SimplePageMaster simplePageMaster = getPageMaster();
+ if (simplePageMaster.getRegionEnd() == null) {
+ return;
+ }
+ final RegionEnd region = simplePageMaster.getRegionEnd();
+ this.end = makeRegionRA(region);
+ }
+
+ /**
+ * Creates a region area.
+ * @param region The FObj region that is generating the region area.
+ * @return The new region area.
+ */
+ private RegionOuterRa4a makeRegionRA(final Region region) {
+ final RegionOuterRa4a area = RegionOuterRa4a.makeRegionArea(region, this);
+ this.children.add(area);
+ return area;
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides the Area method, because there will be nothing above here
+ * that was generated by a block-level FO.
+ * @return Always returns null (override of method in Area).
+ */
+ @Override
+ public Area4a nearestGeneratedByBlockLevelFo() {
+ return null;
+ }
+
+ @Override
+ public void layoutComplete() throws AreaTreeException {
+ /* Optimization of this page is done by the AreaTree itself right before
+ * the page is released for rendering.
+ * See {@link AreaTree#releasePage(PageRa)}. */
+ final List<Marker> markers = getMarkers();
+ if (markers != null) {
+ for (int i = 0; i < markers.size(); i++) {
+ final Marker marker = markers.get(i);
+ this.getPageCollection().getCurrentPageSequenceMarkers()
+ .add(marker);
+ this.getAreaTree().getDocumentMarkers().add(marker);
+ }
+ }
+ this.getAreaTree().notifyPageComplete(this);
+ }
+
+ @Override
+ public AreaNodeG5 firstUnresolvedRefId() {
+ return firstUnresolvedRefId(this);
+ }
+
+ /**
+ * Recursively examines nodes in a fragment of the AreaTree, and returns
+ * the first one that has an unresolved "ref-id".
+ * @param node The AreaNode instance that is the root of the tree fragment
+ * currently being examined.
+ * @return The first node with an unresolved "ref-id", or null if all
+ * ref-ids are resolved.
+ */
+ private AreaNode4a firstUnresolvedRefId(final AreaNode4a node) {
+ // First, check the Area itself.
+ if (node.hasUnresolvedRefId()) {
+ return node;
+ }
+ // Then, check each child.
+ final List<? extends AreaNode4a> children = node.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ final AreaNode4a child = children.get(i);
+ final AreaNode4a firstUnresolved = firstUnresolvedRefId(child);
+ if (firstUnresolved != null) {
+ return firstUnresolved;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public int crIpd() {
+ int viewportIpd = 0;
+ if (getWritingMode().getIpAxis() == AbsoluteAxis.HORIZONTAL) {
+ viewportIpd = traitPageWidth();
+ } else {
+ viewportIpd = traitPageHeight();
+ }
+// return viewportIpd - traitSpaceStartOptimum() - traitSpaceEndOptimum();
+ return viewportIpd;
+ }
+
+ @Override
+ public int crBpd() {
+ int viewportBpd = 0;
+ if (getWritingMode().getBpAxis() == AbsoluteAxis.VERTICAL) {
+ viewportBpd = traitPageHeight();
+ } else {
+ viewportBpd = traitPageWidth();
+ }
+ return viewportBpd - traitSpaceBeforeOptimum()
+ - traitSpaceAfterOptimum();
+ }
+
+ @Override
+ public int crOriginIPDOffset() {
+ // The relative point of origin is 0,0.
+ return 0;
+ }
+
+ @Override
+ public int crOriginBPDOffset() {
+ // The relative point of origin is 0,0.
+ return 0;
+ }
+
+ @Override
+ public int crOriginX() {
+ final AbsoluteDirection bpDirection = getWritingMode().getBpDirection();
+ final AbsoluteDirection ipDirection =
+ getWritingMode().getIpDirectionOdd();
+ if (bpDirection.isVertical()) {
+ if (ipDirection == AbsoluteDirection.LEFT_TO_RIGHT) {
+ return traitStartIndent();
+ } else {
+ return this.traitPageWidth() - traitStartIndent();
+ }
+ } else {
+ /* Block-progression direction is horizontal. */
+ if (bpDirection == AbsoluteDirection.LEFT_TO_RIGHT) {
+ return traitSpaceBeforeOptimum();
+ } else {
+ return this.traitPageWidth() - traitSpaceBeforeOptimum();
+ }
+ }
+ }
+
+ @Override
+ public int crOriginY() {
+ final AbsoluteDirection bpDirection = getWritingMode().getBpDirection();
+ final AbsoluteDirection ipDirection =
+ getWritingMode().getIpDirectionOdd();
+ if (bpDirection.isHorizontal()) {
+ if (ipDirection == AbsoluteDirection.TOP_TO_BOTTOM) {
+ return traitPageHeight() - traitStartIndent();
+ } else {
+ return traitStartIndent();
+ }
+ } else {
+ /* Block-progression direction is vertical. */
+ if (bpDirection == AbsoluteDirection.TOP_TO_BOTTOM) {
+ return traitPageHeight() - traitSpaceBeforeOptimum();
+ } else {
+ return traitSpaceBeforeOptimum();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides method in Area, because at this point, a new page needs to
+ * be created.
+ */
+ @Override
+ public Area4a getOverflowArea(final Area4a childRequesting)
+ throws AreaTreeException {
+ return (PageRa4a) getPageCollection().makePage(Force.NONE);
+ }
+
+ /**
+ * Returns the relative direction that matches the binding edge for this
+ * page.
+ * @return One of the following TraitEnumeration constants:
+ * DIRECTION_START, DIRECTION_END, DIRECTION_BEFORE, or DIRECTION_AFTER.
+ * Note that the standard does not appear to offer any guidance on this
+ * computation. It is possible, for example, that landscape pages should
+ * be bound at the top/bottom instead of left/right.
+ */
+ public Compass getBindingEdge() {
+ // If it is an even-numbered page, binding is on the right.
+ if (this.getNumber() % 2 == 0) {
+ return getWritingMode().getRight();
+ }
+ // Otherwise, binding is on the left.
+ return getWritingMode().getLeft();
+ }
+
+ @Override
+ public Marker bestMarker(final RetrieveMarker retrieve) {
+ final Marker marker = this.bestMarkerThisPage(retrieve);
+ if (marker != null) {
+ return marker;
+ }
+ /* If marker not yet found, and 'retrieve-boundary' permits,
+ * search backward. */
+ List<Marker> additionalMarkers = null;
+ final PageCollection pageCollection = getPageCollection();
+ if (retrieve.traitRetrieveBoundary()
+ == RetrieveBoundary.PAGE_SEQUENCE) {
+ final PageSequence pageSequence = pageCollection.getPageSequence();
+ if (pageSequence == getPageSequence()) {
+ additionalMarkers = pageCollection
+ .getCurrentPageSequenceMarkers();
+ }
+ } else if (retrieve.traitRetrieveBoundary()
+ == RetrieveBoundary.DOCUMENT) {
+ additionalMarkers = pageCollection.getDocumentMarkers();
+ }
+ if (additionalMarkers == null) {
+ return null;
+ }
+ for (int i = additionalMarkers.size() - 1; i >= 0; i--) {
+ final Marker currentMarker = additionalMarkers.get(i);
+ if (currentMarker.traitMarkerClassName().equals(
+ retrieve.traitRetrieveClassName())) {
+ return currentMarker;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds, the best marker, if any, on the current page.
+ * @param retrieve The retrieve-marker for which the marker is sought.
+ * @return The best marker, or null if none on this page meet the criteria.
+ */
+ private Marker bestMarkerThisPage(final RetrieveMarker retrieve) {
+ final List<Marker> pageMarkers = getMarkers();
+ if (getMarkers().isEmpty()) {
+ return null;
+ }
+
+ final RetrievePosition retrievePosition =
+ retrieve.traitRetrievePosition();
+ // search forward if 'first-starting-within-page' or
+ // 'first-including-carryover'
+ if (retrievePosition == RetrievePosition.FIRST_INCLUDING_CARRYOVER) {
+ for (int i = 0; i < pageMarkers.size(); i++) {
+ final Marker currentMarker = pageMarkers.get(i);
+ if (currentMarker.traitMarkerClassName().equals(
+ retrieve.traitRetrieveClassName())) {
+ return currentMarker;
+ }
+ }
+ } else if (retrievePosition
+ == RetrievePosition.FIRST_STARTING_WITHIN_PAGE) {
+ for (int i = 0; i < pageMarkers.size(); i++) {
+ final Marker currentMarker = pageMarkers.get(i);
+ if (currentMarker.traitMarkerClassName().equals(
+ retrieve.traitRetrieveClassName())) {
+ if (startsHere(currentMarker)) {
+ return currentMarker;
+ }
+ }
+ }
+ } else if (retrievePosition
+ == RetrievePosition.LAST_STARTING_WITHIN_PAGE) {
+ for (int i = pageMarkers.size() - 1; i >= 0; i--) {
+ final Marker currentMarker = pageMarkers.get(i);
+ if (currentMarker.traitMarkerClassName().equals(
+ retrieve.traitRetrieveClassName())) {
+ if (startsHere(currentMarker)) {
+ return currentMarker;
+ }
+ }
+ }
+ } else if (retrievePosition
+ == RetrievePosition.LAST_ENDING_WITHIN_PAGE) {
+ for (int i = pageMarkers.size...
[truncated message content] |
|
From: <vic...@us...> - 2022-01-05 18:17:39
|
Revision: 12343
http://sourceforge.net/p/foray/code/12343
Author: victormote
Date: 2022-01-05 18:17:37 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Remove unneeded galley interfaces.
Modified Paths:
--------------
trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-01-05 17:19:08 UTC (rev 12342)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-01-05 18:17:37 UTC (rev 12343)
@@ -41,12 +41,10 @@
import org.axsl.galley.AreaG5;
import org.axsl.galley.AreaNodeG5;
import org.axsl.galley.BackgroundAreaG5;
-import org.axsl.galley.BeforeFloatAreaG5;
import org.axsl.galley.BlockContainerAreaG5;
import org.axsl.galley.BookmarkTreeG5;
import org.axsl.galley.BorderPaddingAreaG5;
import org.axsl.galley.ExternalGraphicAreaG5;
-import org.axsl.galley.FootnoteAreaG5;
import org.axsl.galley.ForeignContentG5;
import org.axsl.galley.ForeignContentMathG5;
import org.axsl.galley.ForeignContentSvgG5;
@@ -486,18 +484,6 @@
public abstract void render(BookmarkTreeG5 bookmarkTree);
@Override
- public Void visit(final FootnoteAreaG5 area) throws GalleyVisitorException {
- renderChildren(area);
- return null;
- }
-
- @Override
- public Void visit(final BeforeFloatAreaG5 area) throws GalleyVisitorException {
- renderChildren(area);
- return null;
- }
-
- @Override
public Void visit(final InlineAreaG5 area) throws GalleyVisitorException {
markBorder(area);
markBackground(area);
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2022-01-05 17:19:08 UTC (rev 12342)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2022-01-05 18:17:37 UTC (rev 12343)
@@ -42,12 +42,10 @@
import org.axsl.galley.AreaG5;
import org.axsl.galley.AreaNodeG5;
import org.axsl.galley.BackgroundAreaG5;
-import org.axsl.galley.BeforeFloatAreaG5;
import org.axsl.galley.BlockContainerAreaG5;
import org.axsl.galley.BookmarkTreeG5;
import org.axsl.galley.BorderPaddingAreaG5;
import org.axsl.galley.ExternalGraphicAreaG5;
-import org.axsl.galley.FootnoteAreaG5;
import org.axsl.galley.ForeignContentMathG5;
import org.axsl.galley.ForeignContentSvgG5;
import org.axsl.galley.ForeignObjectAreaG5;
@@ -244,36 +242,6 @@
}
@Override
- public Void visit(final FootnoteAreaG5 area) throws GalleyVisitorException {
- if (area == null
- || area.areaNodeCount() < 1) {
- return null;
- }
- final StringBuilder buffer = new StringBuilder();
- outputCommonAttributes(area, buffer);
- writeStartTag(area, buffer);
- outputAllRectangles(area);
- renderChildren(area);
- writeEndTag(area);
- return null;
- }
-
- @Override
- public Void visit(final BeforeFloatAreaG5 area) throws GalleyVisitorException {
- if (area == null
- || area.areaNodeCount() < 1) {
- return null;
- }
- final StringBuilder buffer = new StringBuilder();
- outputCommonAttributes(area, buffer);
- writeStartTag(area, buffer);
- outputAllRectangles(area);
- renderChildren(area);
- writeEndTag(area);
- return null;
- }
-
- @Override
public Void visit(final NormalBlockAreaG5 area) throws GalleyVisitorException {
final StringBuilder buffer = new StringBuilder();
outputCommonAttributes(area, buffer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-05 17:19:12
|
Revision: 12342
http://sourceforge.net/p/foray/code/12342
Author: victormote
Date: 2022-01-05 17:19:08 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
1. Conform to aXSL changes: Fixes to area-tree / galley inheritance. 2. Rename some Area Tree classes for consistency.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa4a.java
Removed Paths:
-------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -30,12 +30,12 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
-import org.foray.area.MainRa;
-import org.foray.area.NormalFlowRa;
+import org.foray.area.MainRa4a;
+import org.foray.area.NormalFlowRa4a;
import org.foray.area.PageCollection;
import org.foray.area.PageRa;
import org.foray.area.RegionRaBody;
-import org.foray.area.SpanRa;
+import org.foray.area.SpanRa4a;
import org.foray.area.TextAreaCharacters;
import org.foray.common.data.OrderedTreeNode;
import org.foray.font.ConsumerFont4a;
@@ -94,18 +94,18 @@
* @param areaTree The area tree being tested.
* @return The first normal-flow reference area in {@code areaTree}.
*/
- protected NormalFlowRa getFirstNormalFlowArea(final AreaTree4a areaTree) {
+ protected NormalFlowRa4a getFirstNormalFlowArea(final AreaTree4a areaTree) {
final PageCollection pageCollection = getPageCollection(areaTree, 1);
final PageRa firstPage = getPage(pageCollection, 1);
final RegionRaBody regionBody = firstPage.getRegionBody(
"xsl-region-body");
- final MainRa main = regionBody.getMainRefArea();
+ final MainRa4a main = regionBody.getMainRefArea();
AreaNode4a node = main.areaNodeAt(0);
- Assert.assertTrue(node instanceof SpanRa);
- final SpanRa span = (SpanRa) node;
+ Assert.assertTrue(node instanceof SpanRa4a);
+ final SpanRa4a span = (SpanRa4a) node;
node = span.areaNodeAt(0);
- Assert.assertTrue(node instanceof NormalFlowRa);
- final NormalFlowRa nfa = (NormalFlowRa) node;
+ Assert.assertTrue(node instanceof NormalFlowRa4a);
+ final NormalFlowRa4a nfa = (NormalFlowRa4a) node;
return nfa;
}
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -33,7 +33,7 @@
import org.foray.area.AreaTree4a;
import org.foray.area.LineArea4a;
import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa;
+import org.foray.area.NormalFlowRa4a;
import org.foray.area.PageCollection;
import org.foray.area.TextArea;
import org.foray.common.FontContext4a;
@@ -73,7 +73,7 @@
public void testBlock001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-001.fo", getTextServer(), getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
/* The outer block area. */
@@ -252,7 +252,7 @@
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-003.fo", getTextServer(), getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
/* Test location and dimensions of the block area. */
@@ -315,7 +315,7 @@
public void testBlock004() throws ForayException, FontException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/block-004.fo", getTextServer(), getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
/* Test location and dimensions of the block area. */
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBorder.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -31,7 +31,7 @@
import org.foray.area.AreaNode4a;
import org.foray.area.AreaTree4a;
import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa;
+import org.foray.area.NormalFlowRa4a;
import org.foray.core.ForayException;
import org.junit.Assert;
@@ -53,7 +53,7 @@
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/border-style-001.fo", getTextServer(),
getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
final AreaNode4a node = firstNormalFlowArea.areaNodeAt(0);
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestGraphicArea.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -33,7 +33,7 @@
import org.foray.area.ExternalGraphicArea;
import org.foray.area.LineArea4a;
import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa;
+import org.foray.area.NormalFlowRa4a;
import org.foray.core.ForayException;
import org.junit.Assert;
@@ -57,7 +57,7 @@
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/graphic-002.fo", getTextServer(),
getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
/* There are two block areas. */
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestInline.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -33,7 +33,7 @@
import org.foray.area.InlineArea;
import org.foray.area.LineArea4a;
import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa;
+import org.foray.area.NormalFlowRa4a;
import org.foray.area.TextArea;
import org.foray.core.ForayException;
@@ -57,7 +57,7 @@
public void testInline001() throws ForayException {
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/inline-001.fo", getTextServer(), getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
Assert.assertEquals(1, firstNormalFlowArea.areaNodeCount());
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestVertical.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -33,7 +33,7 @@
import org.foray.area.InlineArea;
import org.foray.area.LineArea4a;
import org.foray.area.NormalBlockArea4a;
-import org.foray.area.NormalFlowRa;
+import org.foray.area.NormalFlowRa4a;
import org.foray.area.TextArea;
import org.foray.core.ForayException;
@@ -58,7 +58,7 @@
final AreaTreeCreator creator = AreaTreeCreator.getInstance();
final AreaTree4a areaTree = creator.buildAreaTree("fo/vertical-001.fo", getTextServer(),
getLineBreakerFactory());
- final NormalFlowRa firstNormalFlowArea = this.getFirstNormalFlowArea(
+ final NormalFlowRa4a firstNormalFlowArea = this.getFirstNormalFlowArea(
areaTree);
/* The block area. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -857,11 +857,11 @@
@Override
public AreaClass traitAreaClass() {
/* TODO: This method is incomplete. */
- final FootnoteRa footnoteArea = this.nearestFootnoteArea();
+ final FootnoteRa4a footnoteArea = this.nearestFootnoteArea();
if (footnoteArea != null) {
return AreaClass.XSL_FOOTNOTE;
}
- final BeforeFloatRa beforeFloatArea = this.nearestBeforeFloatArea();
+ final BeforeFloatRa4a beforeFloatArea = this.nearestBeforeFloatArea();
if (beforeFloatArea != null) {
return AreaClass.XSL_BEFORE_FLOAT;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -427,7 +427,7 @@
* Returns the ancestor Span area.
* @return The ancestor SpanRa, or null if there is none.
*/
- public SpanRa ancestorSpanRA() {
+ public SpanRa4a ancestorSpanRA() {
final AreaNode4a parent = getParent();
if (parent == null) {
return null;
@@ -573,7 +573,7 @@
* a footnote area, or null if this area is not part of a footnote.
* @return The ancestor-or-self footnote-area.
*/
- public FootnoteRa nearestFootnoteArea() {
+ public FootnoteRa4a nearestFootnoteArea() {
final AreaNode4a parent = this.getParent();
if (parent == null) {
return null;
@@ -586,7 +586,7 @@
* a footnote area, or null if this area is not part of a footnote.
* @return The ancestor-or-self footnote-area.
*/
- public BeforeFloatRa nearestBeforeFloatArea() {
+ public BeforeFloatRa4a nearestBeforeFloatArea() {
final AreaNode4a parent = this.getParent();
if (parent == null) {
return null;
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -1,244 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.RelativeAxis;
-import org.axsl.fotree.Fo;
-import org.axsl.fotree.fo.RegionBody;
-import org.axsl.galley.BeforeFloatAreaG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Manages the before-float-reference-area. Its parent should always be an
- * instance of RegionRaBody.
- */
-public final class BeforeFloatRa extends AreaFixed implements BeforeFloatAreaG5, org.axsl.area.BeforeFloatRa {
-
- /** The link to the FO tree. */
- private Link<RegionBody> foLink;
-
- /** The parent of this node. */
- private AreaNode4a parent;
-
- /** The children of this node. */
- private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
-
- /**
- * Private Constructor.
- * @param parentArea The parent area.
- */
- private BeforeFloatRa(final RegionRaBody parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The new instance.
- */
- static BeforeFloatRa makeBeforeFloatArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
- final BeforeFloatRa newFloatRA = new BeforeFloatRa(parentArea);
- newFloatRA.foLink = newFloatRA.getLink(generatedBy);
- newFloatRA.registerLink(generatedBy);
- return newFloatRA;
- }
-
- @Override
- public int crBpd() {
- return ((RegionRaBody) ancestorArea()).getDimensionBeforeFloatRA();
- }
-
- @Override
- public int crIpd() {
- // Same as its parent's.
- return ancestorArea().crIpd();
- }
-
- @Override
- public int crOriginIPDOffset() {
- // Same as the parent's offset.
- return 0;
- }
-
- @Override
- public int crOriginBPDOffset() {
- // Same as the parent's offset.
- return 0;
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return ancestorArea().getOverflowArea(this);
- }
-
- @Override
- public String getAreaName() {
- return "before-float";
- }
-
- /**
- * Returns the parent body area.
- * @return The parent body area.
- */
- public RegionRaBody getRegionBodyArea() {
- /* Cast verified at construction. */
- return (RegionRaBody) ancestorArea();
- }
-
- @Override
- public void setProgressionDimension(final int progressionDimension) {
- this.getRegionBodyArea().setBeforeFloatDimension(progressionDimension);
- }
-
- @Override
- public void incrementProgressionDimension(final int incrementAmount) {
- this.getRegionBodyArea().incrementBeforeFloatDimension(incrementAmount);
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public RelativeAxis contentStackingAxis() {
- return RelativeAxis.BLOCK_PROGRESSION;
- }
-
- @Override
- public AreaNode4a getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- this.parent = node;
- }
-
- @Override
- public List<AreaNode4a> getChildren() {
- return this.children;
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<RegionBody> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public Fo traitGeneratedBy() {
- return this.getFoLink().getGenerator();
- }
-
- /**
- * {@inheritDoc}
- * Overrides the standard logic because this is the before-float-area being
- * sought.
- */
- @Override
- public BeforeFloatRa nearestBeforeFloatArea() {
- return this;
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public int traitSpaceBeforeOptimum() {
- return 0;
- }
-
- @Override
- public int traitSpaceAfterOptimum() {
- return 0;
- }
-
- @Override
- public int traitEndIndent() {
- return 0;
- }
-
- @Override
- public int traitStartIndent() {
- return 0;
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java (from rev 12341, trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa4a.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.BeforeFloatRa;
+import org.axsl.common.value.RelativeAxis;
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.RegionBody;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Manages the before-float-reference-area. Its parent should always be an
+ * instance of RegionRaBody.
+ */
+public final class BeforeFloatRa4a extends AreaFixed implements BeforeFloatRa {
+
+ /** The link to the FO tree. */
+ private Link<RegionBody> foLink;
+
+ /** The parent of this node. */
+ private AreaNode4a parent;
+
+ /** The children of this node. */
+ private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area.
+ */
+ private BeforeFloatRa4a(final RegionRaBody parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The new instance.
+ */
+ static BeforeFloatRa4a makeBeforeFloatArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
+ final BeforeFloatRa4a newFloatRA = new BeforeFloatRa4a(parentArea);
+ newFloatRA.foLink = newFloatRA.getLink(generatedBy);
+ newFloatRA.registerLink(generatedBy);
+ return newFloatRA;
+ }
+
+ @Override
+ public int crBpd() {
+ return ((RegionRaBody) ancestorArea()).getDimensionBeforeFloatRA();
+ }
+
+ @Override
+ public int crIpd() {
+ // Same as its parent's.
+ return ancestorArea().crIpd();
+ }
+
+ @Override
+ public int crOriginIPDOffset() {
+ // Same as the parent's offset.
+ return 0;
+ }
+
+ @Override
+ public int crOriginBPDOffset() {
+ // Same as the parent's offset.
+ return 0;
+ }
+
+ @Override
+ public Area4a getOverflowArea(final Area4a childRequesting)
+ throws AreaTreeException {
+ return ancestorArea().getOverflowArea(this);
+ }
+
+ @Override
+ public String getAreaName() {
+ return "before-float";
+ }
+
+ /**
+ * Returns the parent body area.
+ * @return The parent body area.
+ */
+ public RegionRaBody getRegionBodyArea() {
+ /* Cast verified at construction. */
+ return (RegionRaBody) ancestorArea();
+ }
+
+ @Override
+ public void setProgressionDimension(final int progressionDimension) {
+ this.getRegionBodyArea().setBeforeFloatDimension(progressionDimension);
+ }
+
+ @Override
+ public void incrementProgressionDimension(final int incrementAmount) {
+ this.getRegionBodyArea().incrementBeforeFloatDimension(incrementAmount);
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public RelativeAxis contentStackingAxis() {
+ return RelativeAxis.BLOCK_PROGRESSION;
+ }
+
+ @Override
+ public AreaNode4a getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(final AreaNode4a node) throws AreaTreeException {
+ this.parent = node;
+ }
+
+ @Override
+ public List<AreaNode4a> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ @Override
+ public Link<RegionBody> getFoLink() {
+ return this.foLink;
+ }
+
+ @Override
+ public Fo traitGeneratedBy() {
+ return this.getFoLink().getGenerator();
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides the standard logic because this is the before-float-area being
+ * sought.
+ */
+ @Override
+ public BeforeFloatRa4a nearestBeforeFloatArea() {
+ return this;
+ }
+
+ @Override
+ public int traitBorderStartWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderEndWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderBeforeWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderAfterWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingStart() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingEnd() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingBefore() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingAfter() {
+ return 0;
+ }
+
+ @Override
+ public int traitSpaceBeforeOptimum() {
+ return 0;
+ }
+
+ @Override
+ public int traitSpaceAfterOptimum() {
+ return 0;
+ }
+
+ @Override
+ public int traitEndIndent() {
+ return 0;
+ }
+
+ @Override
+ public int traitStartIndent() {
+ return 0;
+ }
+
+}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -1,254 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.RelativeAxis;
-import org.axsl.fotree.Fo;
-import org.axsl.fotree.fo.RegionBody;
-import org.axsl.galley.FootnoteAreaG5;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Manages the footnote reference area for a page.
- */
-public final class FootnoteRa extends AreaFixed implements FootnoteAreaG5, org.axsl.area.FootnoteRa {
-
- /** The link to the FO tree. */
- private Link<RegionBody> foLink;
-
- /** The parent of this node. */
- private AreaNode4a parent;
-
- /** The children of this node. */
- private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
-
- /**
- * Private Constructor.
- * @param parentArea The parent area.
- */
- private FootnoteRa(final RegionRaBody parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The new instance.
- */
- static FootnoteRa makeFootnoteReferenceArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
- final FootnoteRa footnoteRA = new FootnoteRa(parentArea);
- footnoteRA.foLink = footnoteRA.getLink(generatedBy);
- footnoteRA.registerLink(generatedBy);
- return footnoteRA;
- }
-
- @Override
- public int crBpd() {
- return ((RegionRaBody) ancestorArea()).getDimensionFootnoteRA();
- }
-
- @Override
- public int crIpd() {
- // Same as its parent's.
- return ancestorArea().crIpd();
- }
-
- @Override
- public int crOriginIPDOffset() {
- // Same as the parent's offset.
- return 0;
- }
-
- @Override
- public int crOriginBPDOffset() {
- // The bpd of the main-reference-area ...
- int offset = ancestorArea().crBpd();
- // ... less the size of the footnote-reference-area
- offset -= getRegionBodyArea().getDimensionFootnoteRA();
- return offset;
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- return ancestorArea().getOverflowArea(this);
- }
-
- @Override
- public int pdAvailable() {
- /* The amount of space available to the footnote area is what is
- * available in the body region. */
- final Area4a parentArea = this.ancestorArea();
- return parentArea.pdAvailable();
- }
-
- @Override
- public String getAreaName() {
- return "footnote";
- }
-
- /**
- * Returns the parent region body area.
- * @return The parent region body area.
- */
- public RegionRaBody getRegionBodyArea() {
- /* Cast verified at construction. */
- return (RegionRaBody) ancestorArea();
- }
-
- @Override
- public void setProgressionDimension(final int progressionDimension) {
- this.getRegionBodyArea().setFootnoteDimension(progressionDimension);
- }
-
- @Override
- public void incrementProgressionDimension(final int incrementAmount) {
- this.getRegionBodyArea().incrementFootnoteDimension(incrementAmount);
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public RelativeAxis contentStackingAxis() {
- return RelativeAxis.BLOCK_PROGRESSION;
- }
-
- @Override
- public AreaNode4a getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- this.parent = node;
- }
-
- @Override
- public List<AreaNode4a> getChildren() {
- return this.children;
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<RegionBody> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public Fo traitGeneratedBy() {
- return this.getFoLink().getGenerator();
- }
-
- /**
- * {@inheritDoc}
- * Overrides the standard logic because this is the footnote-area being
- * sought.
- */
- @Override
- public FootnoteRa nearestFootnoteArea() {
- return this;
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public int traitSpaceBeforeOptimum() {
- return 0;
- }
-
- @Override
- public int traitSpaceAfterOptimum() {
- return 0;
- }
-
- @Override
- public int traitEndIndent() {
- return 0;
- }
-
- @Override
- public int traitStartIndent() {
- return 0;
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java (from rev 12341, trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa4a.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -0,0 +1,254 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.FootnoteRa;
+import org.axsl.common.value.RelativeAxis;
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.RegionBody;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Manages the footnote reference area for a page.
+ */
+public final class FootnoteRa4a extends AreaFixed implements FootnoteRa {
+
+ /** The link to the FO tree. */
+ private Link<RegionBody> foLink;
+
+ /** The parent of this node. */
+ private AreaNode4a parent;
+
+ /** The children of this node. */
+ private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area.
+ */
+ private FootnoteRa4a(final RegionRaBody parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The new instance.
+ */
+ static FootnoteRa4a makeFootnoteReferenceArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
+ final FootnoteRa4a footnoteRA = new FootnoteRa4a(parentArea);
+ footnoteRA.foLink = footnoteRA.getLink(generatedBy);
+ footnoteRA.registerLink(generatedBy);
+ return footnoteRA;
+ }
+
+ @Override
+ public int crBpd() {
+ return ((RegionRaBody) ancestorArea()).getDimensionFootnoteRA();
+ }
+
+ @Override
+ public int crIpd() {
+ // Same as its parent's.
+ return ancestorArea().crIpd();
+ }
+
+ @Override
+ public int crOriginIPDOffset() {
+ // Same as the parent's offset.
+ return 0;
+ }
+
+ @Override
+ public int crOriginBPDOffset() {
+ // The bpd of the main-reference-area ...
+ int offset = ancestorArea().crBpd();
+ // ... less the size of the footnote-reference-area
+ offset -= getRegionBodyArea().getDimensionFootnoteRA();
+ return offset;
+ }
+
+ @Override
+ public Area4a getOverflowArea(final Area4a childRequesting)
+ throws AreaTreeException {
+ return ancestorArea().getOverflowArea(this);
+ }
+
+ @Override
+ public int pdAvailable() {
+ /* The amount of space available to the footnote area is what is
+ * available in the body region. */
+ final Area4a parentArea = this.ancestorArea();
+ return parentArea.pdAvailable();
+ }
+
+ @Override
+ public String getAreaName() {
+ return "footnote";
+ }
+
+ /**
+ * Returns the parent region body area.
+ * @return The parent region body area.
+ */
+ public RegionRaBody getRegionBodyArea() {
+ /* Cast verified at construction. */
+ return (RegionRaBody) ancestorArea();
+ }
+
+ @Override
+ public void setProgressionDimension(final int progressionDimension) {
+ this.getRegionBodyArea().setFootnoteDimension(progressionDimension);
+ }
+
+ @Override
+ public void incrementProgressionDimension(final int incrementAmount) {
+ this.getRegionBodyArea().incrementFootnoteDimension(incrementAmount);
+ }
+
+ @Override
+ public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public RelativeAxis contentStackingAxis() {
+ return RelativeAxis.BLOCK_PROGRESSION;
+ }
+
+ @Override
+ public AreaNode4a getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(final AreaNode4a node) throws AreaTreeException {
+ this.parent = node;
+ }
+
+ @Override
+ public List<AreaNode4a> getChildren() {
+ return this.children;
+ }
+
+ @Override
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ @Override
+ public Link<RegionBody> getFoLink() {
+ return this.foLink;
+ }
+
+ @Override
+ public Fo traitGeneratedBy() {
+ return this.getFoLink().getGenerator();
+ }
+
+ /**
+ * {@inheritDoc}
+ * Overrides the standard logic because this is the footnote-area being
+ * sought.
+ */
+ @Override
+ public FootnoteRa4a nearestFootnoteArea() {
+ return this;
+ }
+
+ @Override
+ public int traitBorderStartWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderEndWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderBeforeWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitBorderAfterWidth() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingStart() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingEnd() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingBefore() {
+ return 0;
+ }
+
+ @Override
+ public int traitPaddingAfter() {
+ return 0;
+ }
+
+ @Override
+ public int traitSpaceBeforeOptimum() {
+ return 0;
+ }
+
+ @Override
+ public int traitSpaceAfterOptimum() {
+ return 0;
+ }
+
+ @Override
+ public int traitEndIndent() {
+ return 0;
+ }
+
+ @Override
+ public int traitStartIndent() {
+ return 0;
+ }
+
+}
Deleted: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2022-01-05 16:16:17 UTC (rev 12341)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -1,422 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.area;
-
-import org.foray.area.link.Link;
-
-import org.axsl.area.AreaTreeException;
-import org.axsl.common.value.RelativeAxis;
-import org.axsl.common.value.Span;
-import org.axsl.fotree.Fo;
-import org.axsl.fotree.fo.Block;
-import org.axsl.fotree.fo.BlockContainer;
-import org.axsl.fotree.fo.RegionBody;
-import org.axsl.galley.GalleyVisitor;
-import org.axsl.galley.GalleyVisitorException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Manages the main-reference-area. Its parent should always be an instance of
- * RegionRaBody, and its children should always be instances of SpanRa.
- */
-public final class MainRa extends AreaFixed implements org.axsl.area.MainRa {
-
- /** A definitely-not-sacred legacy span safety factor. It appears to be
- * allowing for 2 12-point lines with leading of 30%. */
-// private static final int SPAN_SAFETY_FACTOR = (int) Math.round(
-// 2 * 12000 * 1.3);
-
- /** The link to the FO tree. */
- private Link<RegionBody> foLink;
-
- /** The parent of this node. */
- private AreaNode4a parent;
-
- /** The children of this node. */
- private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
-
- /** Indicates whether this is a new span area. */
- private boolean isNewSpanArea;
-
- /**
- * Private Constructor.
- * @param parentArea The parent area.
- */
- private MainRa(final RegionRaBody parentArea) {
- this.parent = parentArea;
- }
-
- /**
- * Package-visible factory method.
- * @param generatedBy The FO node generating this area.
- * @param parentArea The parent area.
- * @return The new instance.
- */
- static MainRa makeMainReferenceArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
- final MainRa newMainRA = new MainRa(parentArea);
- newMainRA.foLink = newMainRA.getLink(generatedBy);
- newMainRA.registerLink(generatedBy);
- return newMainRA;
- }
-
- @Override
- public NormalFlowRa getNormalFlow(final Fo fo) throws AreaTreeException {
- /* The next cut of this method should also inspect the FO to see
- * whether the area to be returned ought not to be the footnote
- * or before-float reference area.*/
- this.isNewSpanArea = false;
-
- Span span = Span.NONE;
- if (fo instanceof Block) {
- span = ((Block) fo).traitSpan(this);
- } else if (fo instanceof BlockContainer) {
- span = ((BlockContainer) fo).traitSpan(this);
- }
-
- if (this.getChildren().isEmpty()) {
- if (span == Span.ALL) {
- return addSpanArea(1);
- }
- return addSpanArea(traitColumnCount());
- }
-
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa spanArea = (SpanRa) spanAreas.get(spanAreas.size() - 1);
-
- if ((span == Span.ALL)
- && (spanArea.traitColumnCount() == 1)) {
- // return the single column area in the same span area
- return spanArea.getCurrentColumnArea();
- } else if ((span == Span.NONE)
- && (spanArea.traitColumnCount()
- == this.traitColumnCount())) {
- // return the current column area in the same span area
- return spanArea.getCurrentColumnArea();
- } else if (span == Span.ALL) {
- // create new span area with one column; return column area
- return addSpanArea(1);
- } else if (span == Span.NONE) {
- /* create new span area with multiple columns; return first column
- * area */
- return addSpanArea(this.traitColumnCount());
- } else {
- throw new AreaTreeException("BodyAreaContainer::getNextArea(): "
- + "Span attribute messed up");
- }
- }
-
- /**
- * Add a new span area with specified number of column areas.
- * @param numColumns The number of columns in the new span area.
- * @return The next normal flow area.
- */
- public NormalFlowRa addSpanArea(final int numColumns) {
- final SpanRa spanArea = this.makeSpanArea(numColumns);
- return spanArea.getCurrentColumnArea();
- }
-
- /**
- * Creates a new span area in this main reference area.
- * @param numColumns The number of columns in the new span area.
- * @return The new span area.
- */
- public SpanRa makeSpanArea(final int numColumns) {
- final SpanRa spanArea = SpanRa.makeSpanArea(this.traitGeneratedBy(),
- this, numColumns);
- this.children.add(spanArea);
- this.isNewSpanArea = true;
- return spanArea;
- }
-
- /**
- * {@inheritDoc}
- * This almost does what getNewArea() does, without actually
- * returning an area. These 2 methods can be reworked.
- * @param fo The next formatting object
- * @return boolean True if we need to balance.
- */
- @Override
- public boolean isBalancingRequired(final Fo fo) {
- if (this.getChildren().isEmpty()) {
- return false;
- }
-
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa spanArea = (SpanRa) spanAreas.get(spanAreas.size()
- - 1);
-
- if (spanArea.isBalanced()) {
- return false;
- }
-
- Span span = Span.NONE;
- if (fo instanceof Block) {
- span = ((Block) fo).traitSpan(this);
- } else if (fo instanceof BlockContainer) {
- span = ((BlockContainer) fo).traitSpan(this);
- }
-
- if ((span == Span.ALL)
- && (spanArea.traitColumnCount() == 1)) {
- return false;
- } else if ((span == Span.NONE)
- && (spanArea.traitColumnCount() == traitColumnCount())) {
- return false;
- } else if (span == Span.ALL) {
- return true;
- } else if (span == Span.NONE) {
- return false;
- } else {
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- * This is where the balancing algorithm lives, or gets called.
- * Right now it's primitive: get the total content height in all
- * columns, divide by the column count, and add a heuristic
- * safety factor.
- * Then the previous (unbalanced) span area is removed, and a new
- * one added with the computed max height.
- */
- @Override
- public void resetSpanArea() {
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa spanArea = (SpanRa) spanAreas.get(spanAreas.size() - 1);
-
- if (!spanArea.isBalanced()) {
- // span area maintains a record of the total height of
- // laid-out content in the previous (first) attempt
-// int newHeight = spanArea.getTotalContentHeight()
-// / spanArea.traitColumnCount();
-// newHeight += MainRa.SPAN_SAFETY_FACTOR;
-
- final int columnCount = spanArea.traitColumnCount();
- this.removeChild(spanArea);
- final SpanRa newSpanArea = this.makeSpanArea(columnCount);
- newSpanArea.setIsBalanced();
- this.isNewSpanArea = true;
- } else {
- throw new IllegalStateException("Trying to balance balanced area");
- }
- }
-
- /**
- * {@inheritDoc}
- * Used in Flow when layout returns incomplete.
- * @return boolean Is this the last column in this span?
- */
- @Override
- public boolean isLastColumn() {
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa spanArea = (SpanRa) spanAreas.get(spanAreas.size() - 1);
- return spanArea.isLastColumn();
- }
-
- /**
- * {@inheritDoc}
- * This variable is unset by getNextArea(), is set by addSpanArea(),
- * and <i>may</i> be set by resetSpanArea().
- * @return boolean Is the span area new or not?
- */
- @Override
- public boolean isNewSpanArea() {
- return this.isNewSpanArea;
- }
-
- /**
- * Returns the current column area.
- * @return The current column area.
- */
- public NormalFlowRa getCurrentColumnArea() {
- final List<AreaNode4a> spanAreas = this.getChildren();
- final SpanRa spanArea = (SpanRa) spanAreas.get(spanAreas.size() - 1);
- return spanArea.getCurrentColumnArea();
- }
-
- @Override
- public int crBpd() {
- return ((RegionRaBody) ancestorArea()).getDimensionMainRA();
- }
-
- @Override
- public int crIpd() {
- // Same as its parent's.
- return ancestorArea().brIpd();
- }
-
- @Override
- public int crOriginIPDOffset() {
- // Same as the parent's offset.
- return 0;
- }
-
- @Override
- public int crOriginBPDOffset() {
- return ((RegionRaBody) ancestorArea()).getDimensionBeforeFloatRA();
- }
-
- @Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
- final RegionRaBody bodyRegion = (RegionRaBody) ancestorArea()
- .getOverflowArea(this);
- return bodyRegion.getMainRefArea();
- }
-
- /**
- * Returns the number of columns in this area.
- * @return The number of columns in this area.
- */
- public int traitColumnCount() {
- // Cast verified at construction.
- final RegionRaBody parent = (RegionRaBody) this.getParent();
- return parent.traitColumnCount();
- }
-
- /**
- * Returns the column gap, in millipoints, for this area.
- * @return The column gap, in millipoints, for this area.
- */
- public int traitColumnGap() {
- // Cast verified at construction.
- final RegionRaBody parent = (RegionRaBody) this.getParent();
- return parent.traitColumnGap();
- }
-
- @Override
- public String getAreaName() {
- return "main";
- }
-
- @Override
- public <T> T acceptVisitor(final GalleyVisitor<T> visitor) throws GalleyVisitorException {
- return visitor.visit(this);
- }
-
- @Override
- public RelativeAxis contentStackingAxis() {
- return RelativeAxis.BLOCK_PROGRESSION;
- }
-
- @Override
- public AreaNode4a getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(final AreaNode4a node) throws AreaTreeException {
- this.parent = node;
- }
-
- @Override
- public List<AreaNode4a> getChildren() {
- return this.children;
- }
-
- @Override
- protected boolean optimize() {
- this.optimizeChildren();
- return false;
- }
-
- @Override
- public Link<RegionBody> getFoLink() {
- return this.foLink;
- }
-
- @Override
- public RegionBody traitGeneratedBy() {
- return (RegionBody) this.getFoLink().getGenerator();
- }
-
- @Override
- public int traitBorderStartWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderEndWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderBeforeWidth() {
- return 0;
- }
-
- @Override
- public int traitBorderAfterWidth() {
- return 0;
- }
-
- @Override
- public int traitPaddingStart() {
- return 0;
- }
-
- @Override
- public int traitPaddingEnd() {
- return 0;
- }
-
- @Override
- public int traitPaddingBefore() {
- return 0;
- }
-
- @Override
- public int traitPaddingAfter() {
- return 0;
- }
-
- @Override
- public int traitSpaceBeforeOptimum() {
- return 0;
- }
-
- @Override
- public int traitSpaceAfterOptimum() {
- return 0;
- }
-
- @Override
- public int traitEndIndent() {
- return 0;
- }
-
- @Override
- public int traitStartIndent() {
- return 0;
- }
-
-}
Copied: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java (from rev 12341, trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java)
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java (rev 0)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa4a.java 2022-01-05 17:19:08 UTC (rev 12342)
@@ -0,0 +1,423 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.foray.area.link.Link;
+
+import org.axsl.area.AreaTreeException;
+import org.axsl.area.MainRa;
+import org.axsl.common.value.RelativeAxis;
+import org.axsl.common.value.Span;
+import org.axsl.fotree.Fo;
+import org.axsl.fotree.fo.Block;
+import org.axsl.fotree.fo.BlockContainer;
+import org.axsl.fotree.fo.RegionBody;
+import org.axsl.galley.GalleyVisitor;
+import org.axsl.galley.GalleyVisitorException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Manages the main-reference-area. Its parent should always be an instance of
+ * RegionRaBody, and its children should always be instances of SpanRa.
+ */
+public final class MainRa4a extends AreaFixed implements MainRa {
+
+ /** A definitely-not-sacred legacy span safety factor. It appears to be
+ * allowing for 2 12-point lines with leading of 30%. */
+// private static final int SPAN_SAFETY_FACTOR = (int) Math.round(
+// 2 * 12000 * 1.3);
+
+ /** The link to the FO tree. */
+ private Link<RegionBody> foLink;
+
+ /** The parent of this node. */
+ private AreaNode4a parent;
+
+ /** The children of this node. */
+ private List<AreaNode4a> children = new ArrayList<AreaNode4a>();
+
+ /** Indicates whether this is a new span area. */
+ private boolean isNewSpanArea;
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area.
+ */
+ private MainRa4a(final RegionRaBody parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @return The new instance.
+ */
+ static MainRa4a makeMainReferenceArea(final RegionBody generatedBy, final RegionRaBody parentArea) {
+ final MainRa4a newMainRA = new MainRa4a(parentArea);
+ newMainRA.foLink = newMainRA.getLink(generatedBy);
+ newMainRA.registerLink(generatedBy);
+ return newMainRA;
+ }
+
+ @Override
+ public NormalFlowRa4a getNormalFlow(final Fo fo) throws AreaTreeException {
+ /* The next cut of this method should also inspect the FO to see
+ * whether the area to be returned ought not to be the footnote
+ * or before-float reference area.*/
+ this.isNewSpanArea = false;
+
+ Span span = Span.NONE;
+ if (fo instanceof Block) {
+ span = ((Block) fo).traitSpan(this);
+ } else if (fo instanceof BlockContainer) {
+ span = ((BlockContainer) fo).traitSpan(this);
+ }
+
+ if (this.getChildren().isEmpty()) {
+ if (span == Span.ALL) {
+ return addSpanArea(1);
+ }
+ return addSpanArea(traitColumnCount());
+ }
+
+ final List<AreaNode4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size() - 1);
+
+ if ((span == Span.ALL)
+ && (spanArea.traitColumnCount() == 1)) {
+ // return the single column area in the same span area
+ return spanArea.getCurrentColumnArea();
+ } else if ((span == Span.NONE)
+ && (spanArea.traitColumnCount()
+ == this.traitColumnCount())) {
+ // return the current column area in the same span area
+ return spanArea.getCurrentColumnArea();
+ } else if (span == Span.ALL) {
+ // create new span area with one column; return column area
+ return addSpanArea(1);
+ } else if (span == Span.NONE) {
+ /* create new span area with multiple columns; return first column
+ * area */
+ return addSpanArea(this.traitColumnCount());
+ } else {
+ throw new AreaTreeException("BodyAreaContainer::getNextArea(): "
+ + "Span attribute messed up");
+ }
+ }
+
+ /**
+ * Add a new span area with specified number of column areas.
+ * @param numColumns The number of columns in the new span area.
+ * @return The next normal flow area.
+ */
+ public NormalFlowRa4a addSpanArea(final int numColumns) {
+ final SpanRa4a spanArea = this.makeSpanArea(numColumns);
+ return spanArea.getCurrentColumnArea();
+ }
+
+ /**
+ * Creates a new span area in this main reference area.
+ * @param numColumns The number of columns in the new span area.
+ * @return The new span area.
+ */
+ public SpanRa4a makeSpanArea(final int numColumns) {
+ final SpanRa4a spanArea = SpanRa4a.makeSpanArea(this.traitGeneratedBy(),
+ this, numColumns);
+ this.children.add(spanArea);
+ this.isNewSpanArea = true;
+ return spanArea;
+ }
+
+ /**
+ * {@inheritDoc}
+ * This almost does what getNewArea() does, without actually
+ * returning an area. These 2 methods can be reworked.
+ * @param fo The next formatting object
+ * @return boolean True if we need to balance.
+ */
+ @Override
+ public boolean isBalancingRequired(final Fo fo) {
+ if (this.getChildren().isEmpty()) {
+ return false;
+ }
+
+ final List<AreaNode4a> spanAreas = this.getChildren();
+ final SpanRa4a spanArea = (SpanRa4a) spanAreas.get(spanAreas.size()
+ - 1);
+
+ if (spanArea.isBalanced()) {
+ return false;
+ }
+
+ Span span = Span.NONE;
+ if (fo instanceof Block) {
+ span = ((Block) fo).traitSpan(this);
+ } else if (fo instanceof BlockContainer) {
+ span = ((BlockContainer) fo).traitSpan(this);
+ }
+
+ if ((span == Span.ALL)
+ && (spanArea.traitColumnCount() == 1)) {
+ return false;
+ } else if ((span == Span.NONE)
+ && (spanArea.traitColumnCount() == traitColumnCount())) {
+ return false;
+ } else if (span == Span.ALL) {
+ return true;
+ } else if (span == Span.NONE) {
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * This is where the balancing algorithm lives, or gets called.
+ * Right now it's...
[truncated message content] |
|
From: <vic...@us...> - 2022-01-05 16:16:19
|
Revision: 12341
http://sourceforge.net/p/foray/code/12341
Author: victormote
Date: 2022-01-05 16:16:17 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Rename some interfaces for either clarity or conformity with the XSL-FO Recommendation.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java
trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FlowPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -33,7 +33,7 @@
import org.axsl.area.Area;
import org.axsl.area.AreaClass;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContainerRefArea;
+import org.axsl.area.BlockLevelRa;
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.LinkType;
@@ -63,13 +63,13 @@
* Returns the nearest ancestor area that is a block container.
* @return The nearest ancestor area that is a block container.
*/
- public BlockContainerRefArea getNearestAncestorAreaContainer() {
+ public BlockLevelRa getNearestAncestorAreaContainer() {
AreaNode4a areaNode = this.getParent();
while (areaNode != null
- && !(areaNode instanceof BlockContainerRefArea)) {
+ && !(areaNode instanceof BlockLevelRa)) {
areaNode = areaNode.getParent();
}
- return (BlockContainerRefArea) areaNode;
+ return (BlockLevelRa) areaNode;
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BeforeFloatRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -45,7 +45,7 @@
* Manages the before-float-reference-area. Its parent should always be an
* instance of RegionRaBody.
*/
-public final class BeforeFloatRa extends AreaFixed implements BeforeFloatAreaG5, org.axsl.area.BeforeFloatRefArea {
+public final class BeforeFloatRa extends AreaFixed implements BeforeFloatAreaG5, org.axsl.area.BeforeFloatRa {
/** The link to the FO tree. */
private Link<RegionBody> foLink;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/BlockContainerRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -56,8 +56,7 @@
/**
* The container area for the contents of a block-container FO.
*/
-public final class BlockContainerRa extends ContainerRa
- implements BlockContainerAreaG5, org.axsl.area.BlockContainerRefArea {
+public final class BlockContainerRa extends ContainerRa implements BlockContainerAreaG5, org.axsl.area.BlockLevelRa {
/** The link to the FO tree. */
private Link<BlockContainer> foLink;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/FootnoteRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -44,7 +44,7 @@
/**
* Manages the footnote reference area for a page.
*/
-public final class FootnoteRa extends AreaFixed implements FootnoteAreaG5, org.axsl.area.FootnoteRefArea {
+public final class FootnoteRa extends AreaFixed implements FootnoteAreaG5, org.axsl.area.FootnoteRa {
/** The link to the FO tree. */
private Link<RegionBody> foLink;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -47,7 +47,7 @@
* Manages the main-reference-area. Its parent should always be an instance of
* RegionRaBody, and its children should always be instances of SpanRa.
*/
-public final class MainRa extends AreaFixed implements org.axsl.area.MainRefArea {
+public final class MainRa extends AreaFixed implements org.axsl.area.MainRa {
/** A definitely-not-sacred legacy span safety factor. It appears to be
* allowing for 2 12-point lines with leading of 30%. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalFlowRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -53,7 +53,7 @@
* span-reference-areas and normal-flow-reference-areas.
*/
public final class NormalFlowRa extends ContainerRa
- implements org.axsl.area.NormalFlowRefArea {
+ implements org.axsl.area.NormalFlowRa {
/** The link to the FO tree. */
private Link<RegionBody> foLink;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -57,7 +57,7 @@
/**
* This class is used to manage a region-reference-area.
*/
-public final class RegionRa extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionRefArea {
+public final class RegionRa extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionRa {
/** The link to the FO tree. */
private Link<Region> foLink;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/RegionRaBody.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -48,7 +48,7 @@
/**
* Area containing a region-body.
*/
-public final class RegionRaBody extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionBodyRefArea {
+public final class RegionRaBody extends AreaFixed implements RegionAreaG5, org.axsl.area.RegionBodyRa {
/* TODO: Why doesn't this class extend RegionRa? */
/** The link to the FO tree. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/SpanRa.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -47,8 +47,7 @@
* span-reference-area. The best guess is that it is generated by the
* region-body fo.
*/
-public final class SpanRa extends ContainerRa
- implements org.axsl.area.SpanRefArea {
+public final class SpanRa extends ContainerRa implements org.axsl.area.SpanRa {
/** The link to the FO tree. */
private Link<RegionBody> foLink;
Modified: trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-layout/src/main/java/org/foray/layout/LayoutStrategy.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -33,7 +33,7 @@
import org.axsl.area.LineArea;
import org.axsl.area.PageArea;
import org.axsl.area.PageCollection;
-import org.axsl.area.RegionRefArea;
+import org.axsl.area.RegionRa;
import org.axsl.area.factory.LineContentFactory;
import org.axsl.fotree.FoLineNonText;
import org.axsl.fotree.FoLineText;
@@ -111,18 +111,15 @@
/**
* For a given region, layout the static content for that region.
- * This method allows PageCollection to generate blank pages as needed, and
- * to call back to the LayoutStrategy for layout of the static content,
- * without having to know the specifics of the layout process.
- * @param pageSequence The page sequence whose static content is being
- * processed.
+ * This method allows PageCollection to generate blank pages as needed, and to call back to the LayoutStrategy for
+ * layout of the static content, without having to know the specifics of the layout process.
+ * @param pageSequence The page sequence whose static content is being processed.
* @param region The page region whose static content is being laid out.
- * @param area The region area into which the static content should be
- * placed.
+ * @param area The region area into which the static content should be placed.
* @throws AreaTreeException For errors during layout.
*/
- public abstract void layoutStaticContent(PageSequence pageSequence,
- Region region, RegionRefArea area) throws AreaTreeException;
+ public abstract void layoutStaticContent(PageSequence pageSequence, Region region, RegionRa area)
+ throws AreaTreeException;
@Override
public void handleLineBreakText(final OutputLine lineOutput,
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/BlockContainerPnr.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -30,7 +30,7 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.BlockContainerRefArea;
+import org.axsl.area.BlockLevelRa;
import org.axsl.area.factory.BlockLevelAreaFactory;
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.BlockContainer;
@@ -66,8 +66,7 @@
setProgress(0);
}
- final BlockContainerRefArea blockContainer =
- bcArea.makeBlockContainerArea(this.node);
+ final BlockLevelRa blockContainer = bcArea.makeBlockContainerArea(this.node);
for (int i = this.getProgress(); i < this.node.formattingObjectCount(); i++) {
final Fo fo = this.node.formattingObjectAt(i);
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FlowPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FlowPnr.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FlowPnr.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -31,7 +31,7 @@
import org.axsl.area.Area;
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.RegionBodyRefArea;
+import org.axsl.area.RegionBodyRa;
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.Flow;
@@ -67,7 +67,7 @@
}
// flow is *always* laid out into a BodyAreaContainer
- final RegionBodyRefArea bac = (RegionBodyRefArea) areaNode;
+ final RegionBodyRa bac = (RegionBodyRa) areaNode;
boolean prevChildMustKeepWithNext = false;
final int numChildren = getFONode().formattingObjectCount();
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/FootnoteBodyPnr.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -30,9 +30,9 @@
import org.axsl.area.AreaNode;
import org.axsl.area.AreaTreeException;
-import org.axsl.area.FootnoteRefArea;
+import org.axsl.area.FootnoteRa;
import org.axsl.area.PageArea;
-import org.axsl.area.RegionBodyRefArea;
+import org.axsl.area.RegionBodyRa;
import org.axsl.fotree.Fo;
import org.axsl.fotree.fo.FootnoteBody;
import org.axsl.fotree.fo.PageSequence;
@@ -61,7 +61,7 @@
if (getProgress() == FoNodePnr.START) {
setProgress(0);
}
- final FootnoteRefArea referenceArea = (FootnoteRefArea) areaNode;
+ final FootnoteRa referenceArea = (FootnoteRa) areaNode;
final int numChildren = this.node.formattingObjectCount();
for (int i = getProgress(); i < numChildren; i++) {
@@ -83,8 +83,8 @@
*/
public boolean layoutFootnote(final PageArea p) {
/* TODO: This needs to handle multiple body-regions properly. */
- final RegionBodyRefArea bac = p.getRegionBody("xsl-region-body");
- final FootnoteRefArea footArea = bac.getFootnoteRefArea();
+ final RegionBodyRa bac = p.getRegionBody("xsl-region-body");
+ final FootnoteRa footArea = bac.getFootnoteRefArea();
try {
layoutFootnoteSeparator(bac, footArea);
final Status status = layout(footArea);
@@ -105,8 +105,7 @@
* created.
* @throws AreaTreeException For errors during layout.
*/
- private void layoutFootnoteSeparator(final RegionBodyRefArea bac,
- final FootnoteRefArea footArea) throws AreaTreeException {
+ private void layoutFootnoteSeparator(final RegionBodyRa bac, final FootnoteRa footArea) throws AreaTreeException {
/* TODO: It seems like this logic should be done once when the
* PageCollection is first started, and cached there for reuse. */
if (footArea.areaNodeCount() != 0) {
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-01-05 15:42:24 UTC (rev 12340)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-01-05 16:16:17 UTC (rev 12341)
@@ -33,11 +33,11 @@
import org.axsl.area.Area;
import org.axsl.area.AreaTreeException;
import org.axsl.area.NormalBlockArea;
-import org.axsl.area.NormalFlowRefArea;
+import org.axsl.area.NormalFlowRa;
import org.axsl.area.PageArea;
import org.axsl.area.PageCollection;
-import org.axsl.area.RegionBodyRefArea;
-import org.axsl.area.RegionRefArea;
+import org.axsl.area.RegionBodyRa;
+import org.axsl.area.RegionRa;
import org.axsl.fotree.Fo;
import org.axsl.fotree.FoVisitor;
import org.axsl.fotree.fo.BasicLink;
@@ -222,7 +222,7 @@
*/
final FlowPnr flowPL = (FlowPnr) this.getLayoutProxy(flow);
for (String regionBodyName : regionBodies) {
- final RegionBodyRefArea bodyArea = currentPage.getRegionBody(
+ final RegionBodyRa bodyArea = currentPage.getRegionBody(
regionBodyName);
flowPL.layout(bodyArea);
}
@@ -251,7 +251,7 @@
@Override
public void layoutStaticContent(final PageSequence pageSequence,
- final Region region, final RegionRefArea area)
+ final Region region, final RegionRa area)
throws AreaTreeException {
if (region == null) {
return;
@@ -287,7 +287,7 @@
return Status.OK;
}
final BreakBeforePa breakableNode = (BreakBeforePa) node;
- if (!(area instanceof NormalFlowRefArea)) {
+ if (!(area instanceof NormalFlowRa)) {
switch (breakableNode.traitBreakBefore(area)) {
case PAGE:
return Status.FORCE_PAGE_BREAK;
@@ -301,7 +301,7 @@
return Status.OK;
}
}
- final NormalFlowRefArea colArea = (NormalFlowRefArea) area;
+ final NormalFlowRa colArea = (NormalFlowRa) area;
switch (breakableNode.traitBreakBefore(area)) {
case PAGE: {
// if first ColumnArea, and empty, return OK
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-05 15:42:27
|
Revision: 12340
http://sourceforge.net/p/foray/code/12340
Author: victormote
Date: 2022-01-05 15:42:24 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Remove unneeded interface.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-04 18:01:17 UTC (rev 12339)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/Area4a.java 2022-01-05 15:42:24 UTC (rev 12340)
@@ -693,6 +693,8 @@
/**
* Indicates whether this area is a reference area.
* @return True if and only if this area is a reference area.
+ * @see "XSL-FO Recommendation 1.1, Section 4.1"
+ * @see "XSL-FO Recommendation 1.1, Section 4.2.2"
*/
public boolean traitIsReferenceArea() {
return traitGeneratedBy().traitIsReferenceArea();
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2022-01-04 18:01:17 UTC (rev 12339)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MainRa.java 2022-01-05 15:42:24 UTC (rev 12340)
@@ -39,7 +39,6 @@
import org.axsl.fotree.fo.RegionBody;
import org.axsl.galley.GalleyVisitor;
import org.axsl.galley.GalleyVisitorException;
-import org.axsl.galley.MainReferenceAreaG5;
import java.util.ArrayList;
import java.util.List;
@@ -48,8 +47,7 @@
* Manages the main-reference-area. Its parent should always be an instance of
* RegionRaBody, and its children should always be instances of SpanRa.
*/
-public final class MainRa extends AreaFixed implements MainReferenceAreaG5,
- org.axsl.area.MainRefArea {
+public final class MainRa extends AreaFixed implements org.axsl.area.MainRefArea {
/** A definitely-not-sacred legacy span safety factor. It appears to be
* allowing for 2 12-point lines with leading of 30%. */
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-04 18:01:17 UTC (rev 12339)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-05 15:42:24 UTC (rev 12340)
@@ -136,15 +136,14 @@
}
@Override
- public Area4a getOverflowArea(final Area4a childRequesting)
- throws AreaTreeException {
+ public NormalBlockArea4a getOverflowArea(final Area4a childRequesting) throws AreaTreeException {
final Area4a overflow = ancestorArea().getOverflowArea(this);
if (overflow == null) {
- throw new AreaTreeException("BlockArea overflow failed.");
+ throw new AreaTreeException(NormalBlockArea4a.class.getName() + " overflow failed.");
}
if (! (overflow instanceof BlockLevelAreaFactory)) {
- throw new AreaTreeException("NormalBlockArea overflow parent "
- + "expected to be a BlockLevelAreaFactory.");
+ throw new AreaTreeException(NormalBlockArea4a.class.getName() + " overflow parent expected to be a " +
+ BlockLevelAreaFactory.class.getName());
}
final BlockLevelAreaFactory bcFactory = (BlockLevelAreaFactory) overflow;
final Fo fo = this.traitGeneratedBy();
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-01-04 18:01:17 UTC (rev 12339)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/Renderer.java 2022-01-05 15:42:24 UTC (rev 12340)
@@ -58,7 +58,6 @@
import org.axsl.galley.GraphicAreaG5;
import org.axsl.galley.InlineAreaG5;
import org.axsl.galley.LineAreaG5;
-import org.axsl.galley.MainReferenceAreaG5;
import org.axsl.galley.NormalBlockAreaG5;
import org.axsl.galley.PageCollectionG5;
import org.axsl.galley.PageG5;
@@ -499,12 +498,6 @@
}
@Override
- public Void visit(final MainReferenceAreaG5 area) throws GalleyVisitorException {
- renderChildren(area);
- return null;
- }
-
- @Override
public Void visit(final InlineAreaG5 area) throws GalleyVisitorException {
markBorder(area);
markBackground(area);
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2022-01-04 18:01:17 UTC (rev 12339)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/xml/XmlRenderer.java 2022-01-05 15:42:24 UTC (rev 12340)
@@ -58,7 +58,6 @@
import org.axsl.galley.InlineAreaG5;
import org.axsl.galley.LeaderAreaG5;
import org.axsl.galley.LineAreaG5;
-import org.axsl.galley.MainReferenceAreaG5;
import org.axsl.galley.NormalBlockAreaG5;
import org.axsl.galley.PageG5;
import org.axsl.galley.RegionAreaG5;
@@ -234,17 +233,6 @@
}
@Override
- public Void visit(final MainReferenceAreaG5 area) throws GalleyVisitorException {
- final StringBuilder buffer = new StringBuilder();
- outputCommonAttributes(area, buffer);
- writeStartTag(area, buffer);
- outputAllRectangles(area);
- renderChildren(area);
- writeEndTag(area);
- return null;
- }
-
- @Override
public Void visit(final RegionAreaG5 area) throws GalleyVisitorException {
final StringBuilder buffer = new StringBuilder();
outputCommonAttributes(area, buffer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 18:01:20
|
Revision: 12339
http://sourceforge.net/p/foray/code/12339
Author: victormote
Date: 2022-01-04 18:01:17 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Make sure all of the content is included.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-01-04 17:56:29 UTC (rev 12338)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-01-04 18:01:17 UTC (rev 12339)
@@ -310,14 +310,15 @@
}
}
- /* Create breakpoint for the last line. */
+ /* Make sure there is at least one line if there is any content. */
if (state.breakpoints.length() < 1
&& paragraph.paraLeafSize() > 0) {
state.breakpoints.append(paragraph.paraLeafSize());
}
+ /* Make sure the last line catches all of the content. */
if (paragraph.paraLeafSize() > state.breakpoints.lastElement()) {
- throw new IllegalStateException("Paragraph content was missed.");
+ state.breakpoints.setIntAt(state.breakpoints.length() - 1, paragraph.paraLeafSize());
}
while (state.lineLengths.length() > state.breakpoints.length()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 17:56:32
|
Revision: 12338
http://sourceforge.net/p/foray/code/12338
Author: victormote
Date: 2022-01-04 17:56:29 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Clean up difference between word segment and word component.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-04 17:28:12 UTC (rev 12337)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2022-01-04 17:56:29 UTC (rev 12338)
@@ -29,6 +29,7 @@
package org.foray.orthography;
import org.axsl.orthography.Word;
+import org.axsl.orthography.WordComponent;
import org.axsl.orthography.WordSegment;
/**
@@ -109,15 +110,12 @@
@Override
public int paraLeafSize() {
- /* Each syllable has a leaf for itself and one for the discretionary hyphen that follows it, except the last
- * syllable, which is not followed by a hyphen. */
- return (this.segments.length * 2) - 1;
+ return getQtyWordComponents();
}
@Override
- public StringWordSegment paraLeafAt(final int index) {
- final int dictionaryIndex = this.segments[index];
- return this.dictionary.getWordSegment(dictionaryIndex);
+ public WordComponent paraLeafAt(final int index) {
+ return getWordComponent(index);
}
@Override
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-04 17:28:12 UTC (rev 12337)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-04 17:56:29 UTC (rev 12338)
@@ -174,6 +174,8 @@
@Override
public int getQtyWordComponents() {
+ /* Each syllable has a leaf for itself and one for the discretionary hyphen that follows it, except the last
+ * syllable, which is not followed by a hyphen. */
return (this.getQtyWordSegments() * 2) - 1;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 17:28:14
|
Revision: 12337
http://sourceforge.net/p/foray/code/12337
Author: victormote
Date: 2022-01-04 17:28:12 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Add assertions for all leaves.
Modified Paths:
--------------
trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2022-01-04 17:14:09 UTC (rev 12336)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2022-01-04 17:28:12 UTC (rev 12337)
@@ -131,30 +131,56 @@
Assert.assertEquals(50, out.paraLeafSize());
/* Test the /leaves/ at each end. */
- Assert.assertEquals("B", out.paraLeafAt(0).getText());
- Assert.assertEquals("e", out.paraLeafAt(1).getText());
- Assert.assertEquals(" ", out.paraLeafAt(2).getText());
- Assert.assertEquals("not", out.paraLeafAt(3).getText());
- Assert.assertEquals("upon", out.paraLeafAt(43).getText());
- Assert.assertEquals(" ", out.paraLeafAt(44).getText());
- Assert.assertEquals("t", out.paraLeafAt(45).getText());
- Assert.assertEquals("h", out.paraLeafAt(46).getText());
- Assert.assertEquals("e", out.paraLeafAt(47).getText());
- Assert.assertEquals("m", out.paraLeafAt(48).getText());
- Assert.assertEquals(".", out.paraLeafAt(49).getText());
-
- /* Make sure other nested branches can find their child nodes properly. */
- Assert.assertEquals("great", out.paraLeafAt(9).getText());
- Assert.assertEquals("-", out.paraLeafAt(10).getText());
- Assert.assertEquals("ness", out.paraLeafAt(11).getText());
-
- Assert.assertEquals("great", out.paraLeafAt(37).getText());
- Assert.assertEquals("-", out.paraLeafAt(38).getText());
- Assert.assertEquals("ness", out.paraLeafAt(39).getText());
-
- /* Test some internal leaves. */
+ Assert.assertEquals("B", out.paraLeafAt(0).getText());
+ Assert.assertEquals("e", out.paraLeafAt(1).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(2).getText());
+ Assert.assertEquals("not", out.paraLeafAt(3).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(4).getText());
Assert.assertEquals("afraid", out.paraLeafAt(5).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(6).getText());
+ Assert.assertEquals("of", out.paraLeafAt(7).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(8).getText());
+ Assert.assertEquals("great", out.paraLeafAt(9).getText());
+ Assert.assertEquals("-", out.paraLeafAt(10).getText());
+ Assert.assertEquals("ness", out.paraLeafAt(11).getText());
+ Assert.assertEquals(".", out.paraLeafAt(12).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(13).getText());
+ Assert.assertEquals("Some", out.paraLeafAt(14).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(15).getText());
+ Assert.assertEquals("are", out.paraLeafAt(16).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(17).getText());
+ Assert.assertEquals("born", out.paraLeafAt(18).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(19).getText());
+ Assert.assertEquals("great,", out.paraLeafAt(20).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(21).getText());
+ Assert.assertEquals("some", out.paraLeafAt(22).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(23).getText());
Assert.assertEquals("achieve", out.paraLeafAt(24).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(25).getText());
+ Assert.assertEquals("great", out.paraLeafAt(26).getText());
+ Assert.assertEquals("-", out.paraLeafAt(27).getText());
+ Assert.assertEquals("ness", out.paraLeafAt(28).getText());
+ Assert.assertEquals(",", out.paraLeafAt(29).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(30).getText());
+ Assert.assertEquals("and", out.paraLeafAt(31).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(32).getText());
+ Assert.assertEquals("some", out.paraLeafAt(33).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(34).getText());
+ Assert.assertEquals("have", out.paraLeafAt(35).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(36).getText());
+ Assert.assertEquals("great", out.paraLeafAt(37).getText());
+ Assert.assertEquals("-", out.paraLeafAt(38).getText());
+ Assert.assertEquals("ness", out.paraLeafAt(39).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(40).getText());
+ Assert.assertEquals("thrust", out.paraLeafAt(41).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(42).getText());
+ Assert.assertEquals("upon", out.paraLeafAt(43).getText());
+ Assert.assertEquals(" ", out.paraLeafAt(44).getText());
+ Assert.assertEquals("t", out.paraLeafAt(45).getText());
+ Assert.assertEquals("h", out.paraLeafAt(46).getText());
+ Assert.assertEquals("e", out.paraLeafAt(47).getText());
+ Assert.assertEquals("m", out.paraLeafAt(48).getText());
+ Assert.assertEquals(".", out.paraLeafAt(49).getText());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 17:14:11
|
Revision: 12336
http://sourceforge.net/p/foray/code/12336
Author: victormote
Date: 2022-01-04 17:14:09 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Implement getLineLength().
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-04 16:07:17 UTC (rev 12335)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-04 17:14:09 UTC (rev 12336)
@@ -483,8 +483,7 @@
@Override
public int getLineLength(final int lineNumber) {
- // TODO Auto-generated method stub
- return 0;
+ return this.crIpd();
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 16:07:20
|
Revision: 12335
http://sourceforge.net/p/foray/code/12335
Author: victormote
Date: 2022-01-04 16:07:17 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Fix linebreaking problem on short line.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-01-04 15:17:29 UTC (rev 12334)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/linebreak/FirstFitLb.java 2022-01-04 16:07:17 UTC (rev 12335)
@@ -259,13 +259,6 @@
this.clearProvisionalContent();
}
- /**
- * Marks the end of the paragraph by creating a line break there if one has not already been created there.
- */
- private void markEndOfParagraph() {
- markBreakpointInternal();
- }
-
}
@Override
@@ -316,7 +309,17 @@
}
}
}
- state.markEndOfParagraph();
+
+ /* Create breakpoint for the last line. */
+ if (state.breakpoints.length() < 1
+ && paragraph.paraLeafSize() > 0) {
+ state.breakpoints.append(paragraph.paraLeafSize());
+ }
+
+ if (paragraph.paraLeafSize() > state.breakpoints.lastElement()) {
+ throw new IllegalStateException("Paragraph content was missed.");
+ }
+
while (state.lineLengths.length() > state.breakpoints.length()) {
state.lineLengths.pop();
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2022-01-04 15:17:29 UTC (rev 12334)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/FirstFitLbTests.java 2022-01-04 16:07:17 UTC (rev 12335)
@@ -55,7 +55,7 @@
final LineBreakResult4a actual = out.breakIntoLines(para, paraConfig, paraContext);
Assert.assertEquals(1, actual.getQtyLines());
Assert.assertEquals(468000, actual.getLineLength(0));
- Assert.assertEquals(1, actual.getBreakPosition(0));
+ Assert.assertEquals(2, actual.getBreakPosition(0));
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 15:17:31
|
Revision: 12334
http://sourceforge.net/p/foray/code/12334
Author: victormote
Date: 2022-01-04 15:17:29 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Add firstElement() and lastElement() methods to primitive sequence interfaces.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractByteSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractCharSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractIntSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractLongSequence.java
trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractShortSequence.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractByteSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractByteSequence.java 2022-01-04 14:43:38 UTC (rev 12333)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractByteSequence.java 2022-01-04 15:17:29 UTC (rev 12334)
@@ -654,12 +654,6 @@
}
@Override
- public byte lastByte() {
- final int index = length() - 1;
- return byteAt(index);
- }
-
- @Override
public ByteSequencePlus asPlus() {
return this;
}
@@ -674,4 +668,14 @@
return new ByteSequenceIterator(this, true);
}
+ @Override
+ public byte firstElement() {
+ return byteAt(0);
+ }
+
+ @Override
+ public byte lastElement() {
+ return byteAt(length() - 1);
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractCharSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractCharSequence.java 2022-01-04 14:43:38 UTC (rev 12333)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractCharSequence.java 2022-01-04 15:17:29 UTC (rev 12334)
@@ -91,4 +91,14 @@
return builder;
}
+ @Override
+ public char firstElement() {
+ return charAt(0);
+ }
+
+ @Override
+ public char lastElement() {
+ return charAt(length() - 1);
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractIntSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractIntSequence.java 2022-01-04 14:43:38 UTC (rev 12333)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractIntSequence.java 2022-01-04 15:17:29 UTC (rev 12334)
@@ -91,4 +91,14 @@
return builder;
}
+ @Override
+ public int firstElement() {
+ return intAt(0);
+ }
+
+ @Override
+ public int lastElement() {
+ return intAt(length() - 1);
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractLongSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractLongSequence.java 2022-01-04 14:43:38 UTC (rev 12333)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractLongSequence.java 2022-01-04 15:17:29 UTC (rev 12334)
@@ -91,4 +91,14 @@
return builder;
}
+ @Override
+ public long firstElement() {
+ return longAt(0);
+ }
+
+ @Override
+ public long lastElement() {
+ return longAt(length() - 1);
+ }
+
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractShortSequence.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractShortSequence.java 2022-01-04 14:43:38 UTC (rev 12333)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/sequence/AbstractShortSequence.java 2022-01-04 15:17:29 UTC (rev 12334)
@@ -108,4 +108,14 @@
return true;
}
+ @Override
+ public short firstElement() {
+ return shortAt(0);
+ }
+
+ @Override
+ public short lastElement() {
+ return shortAt(length() - 1);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 14:43:41
|
Revision: 12333
http://sourceforge.net/p/foray/code/12333
Author: victormote
Date: 2022-01-04 14:43:38 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Remove unneeded constructor.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-01-04 14:42:43 UTC (rev 12332)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextAreaWords.java 2022-01-04 14:43:38 UTC (rev 12333)
@@ -62,16 +62,6 @@
}
/**
- * Constructor.
- * @param parentArea The parent area.
- * @param generatedBy The FO tree linkage.
- */
- private TextAreaWords(final AbstractInlineArea parentArea, final Link<FoTextWords> generatedBy) {
- super(parentArea);
- this.foLink = generatedBy;
- }
-
- /**
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-04 14:42:45
|
Revision: 12332
http://sourceforge.net/p/foray/code/12332
Author: victormote
Date: 2022-01-04 14:42:43 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Add toString() override, for debugging.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-03 20:47:31 UTC (rev 12331)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2022-01-04 14:42:43 UTC (rev 12332)
@@ -243,4 +243,9 @@
codepointAfter);
}
+ @Override
+ public String toString() {
+ return getRawText().toString();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-03 20:47:33
|
Revision: 12331
http://sourceforge.net/p/foray/code/12331
Author: victormote
Date: 2022-01-03 20:47:31 +0000 (Mon, 03 Jan 2022)
Log Message:
-----------
Conform to aXSL change: Add and use new WordComponent interface to complete the word-component API for Word.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-03 20:33:57 UTC (rev 12330)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-03 20:47:31 UTC (rev 12331)
@@ -38,6 +38,7 @@
import org.axsl.common.sequence.ByteSequence;
import org.axsl.orthography.DiscretionaryHyphen;
import org.axsl.orthography.Word;
+import org.axsl.orthography.WordComponent;
import org.axsl.orthography.WordSegment;
import java.io.Serializable;
@@ -177,7 +178,7 @@
}
@Override
- public ParaLeaf getWordComponent(final int componentIndex) {
+ public WordComponent getWordComponent(final int componentIndex) {
if (componentIndex < 0
|| componentIndex >= getQtyWordComponents()) {
throw new IndexOutOfBoundsException(Integer.toString(componentIndex));
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-03 20:33:57 UTC (rev 12330)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-03 20:47:31 UTC (rev 12331)
@@ -32,10 +32,10 @@
import org.foray.orthography.DiscretionaryHyphen4a;
import org.foray.orthography.WordWrapper;
-import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
import org.axsl.orthography.Word;
+import org.axsl.orthography.WordComponent;
/**
* Decorates a normalized word with some additional data.
@@ -89,7 +89,7 @@
}
@Override
- public ParaLeaf getWordComponent(final int componentIndex) {
+ public WordComponent getWordComponent(final int componentIndex) {
if (componentIndex < 0
|| componentIndex >= getQtyWordComponents()) {
throw new IndexOutOfBoundsException(Integer.toString(componentIndex));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-03 20:34:00
|
Revision: 12330
http://sourceforge.net/p/foray/code/12330
Author: victormote
Date: 2022-01-03 20:33:57 +0000 (Mon, 03 Jan 2022)
Log Message:
-----------
Move DiscretionaryHyphen classes from common to orthography.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java
Removed Paths:
-------------
trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -1,146 +0,0 @@
-/*
- * Copyright 2019 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.common.para;
-
-import org.axsl.common.para.ParaBox;
-import org.axsl.common.para.ParaConfig;
-import org.axsl.common.para.ParaContext;
-import org.axsl.common.para.ParaGlue;
-import org.axsl.common.para.ParaLeaf;
-import org.axsl.common.para.ParaPenalty;
-import org.axsl.orthography.DiscretionaryHyphen;
-
-import java.util.EnumMap;
-import java.util.Map;
-
-/**
- * FOray implementation of {@link DiscretionaryHyphen}.
- * Instances of this class are immutable.
- */
-public final class DiscretionaryHyphen4a extends ParaLeaf4a implements DiscretionaryHyphen {
-
- /** Pre-built "heinous" hyphenation point. */
- public static final DiscretionaryHyphen4a HEINOUS = new DiscretionaryHyphen4a(ParaPenalty.Quality.INFINITE_PENALTY);
-
- /** Pre-built "acceptable" hyphenation point. */
- public static final DiscretionaryHyphen4a ACCEPTABLE = new DiscretionaryHyphen4a(ParaPenalty.Quality.ACCEPTABLE);
-
- /** Pre-built "good" hyphenation point. */
- public static final DiscretionaryHyphen4a GOOD = new DiscretionaryHyphen4a(ParaPenalty.Quality.GOOD);
-
- /** Pre-built "best" hyphenation point. */
- public static final DiscretionaryHyphen4a BEST = new DiscretionaryHyphen4a(ParaPenalty.Quality.BEST);
-
- /** The array of pre-constructed instances. */
- private static final Map<ParaPenalty.Quality, DiscretionaryHyphen4a> PRE_CONSTRUCTED_POINTS =
- new EnumMap<ParaPenalty.Quality, DiscretionaryHyphen4a>(ParaPenalty.Quality.class);
- static {
- PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.INFINITE_PENALTY, HEINOUS);
- PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.ACCEPTABLE, ACCEPTABLE);
- PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.GOOD, GOOD);
- PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.BEST, BEST);
- }
-
- /** The quality for this instance. */
- private ParaPenalty.Quality quality;
-
- /**
- * Protected constructor. There are only 3 possible normal values, so these are pre-constructed.
- * Use {@link #fromQuality(org.axsl.common.para.ParaPenalty.Quality)} to obtain an instance of this class.
- * @param quality The quality for this instance.
- */
- protected DiscretionaryHyphen4a(final ParaPenalty.Quality quality) {
- this.quality = quality;
- }
-
- /**
- * Returns an instance of this class for a given quality.
- * @param quality The quality for the desired instance.
- * @return The instance of this class matching {@code quality}.
- */
- public static DiscretionaryHyphen4a fromQuality(final ParaPenalty.Quality quality) {
- return DiscretionaryHyphen4a.PRE_CONSTRUCTED_POINTS.get(quality);
- }
-
- @Override
- public ParaPenalty.Quality getQuality() {
- return this.quality;
- }
-
- @Override
- public String toString() {
- return "-";
- }
-
- @Override
- public int getWidth(final ParaConfig config) {
- return config.getHyphenCharacterWidth();
- }
-
- @Override
- public int getCost(final ParaContext paraContext) {
- return paraContext.getCost(this.quality);
- }
-
- @Override
- public boolean isFlagged() {
- return true;
- }
-
- @Override
- public Type getParaLeafType() {
- return ParaLeaf.Type.PENALTY;
- }
-
- @Override
- public ParaBox asParaBox() {
- return null;
- }
-
- @Override
- public ParaGlue asParaGlue() {
- return null;
- }
-
- @Override
- public ParaPenalty asParaPenalty() {
- return this;
- }
-
- @Override
- public CharSequence getText() {
- return "-";
- }
-
- @Override
- public int paraKpLeafSize() {
- return 1;
- }
-
-}
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -1,213 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed 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
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-/*
- * Known contributors:
- * Carlos Villegas <ca...@un...> (Original author), who credited
- * TeX for the basic scheme.
- */
-
-package org.foray.common.para;
-
-import org.foray.common.WellKnownConstants;
-
-import org.axsl.common.para.ParaBox;
-import org.axsl.common.para.ParaBranch;
-import org.axsl.common.para.ParaConfig;
-import org.axsl.common.para.ParaContext;
-import org.axsl.common.para.ParaGlue;
-import org.axsl.common.para.ParaLeaf;
-import org.axsl.common.para.ParaNode;
-import org.axsl.common.para.ParaPenalty;
-import org.axsl.orthography.DiscretionaryHyphenMutating;
-
-import java.io.Serializable;
-
-/**
- * <p>Specialized information about a specific hyphenation break opportunity in
- * a word.
- * This handles "hard" hyphenation cases, such as those where the word changes
- * spelling when it is hyphenated.
- * See {@link org.axsl.orthography.DiscretionaryHyphenMutating} for more information about the
- * general use of this class.</p>
- *
- * <p>A 'full' hyphen is made of 3 parts:
- * the pre-break text, post-break text and no-break. If no line-break
- * is generated at this position, the no-break text is used, otherwise,
- * pre-break and post-break are used. Typically, pre-break is equal to
- * the hyphen character and the others are empty.</p>
- */
-public class DiscretionaryHyphenMutating4a implements Serializable, DiscretionaryHyphenMutating {
-
- /** Constant needed for serialization. */
- private static final long serialVersionUID = 990405609314441965L;
-
- /** The quality for this instance. */
- private ParaPenalty.Quality quality;
-
- /** The pre-break text. */
- private String preBreak;
-
- /** The no-break text. */
- private String noBreak;
-
- /** The post-break text. */
- private String postBreak;
-
- /**
- * Constructor.
- * @param quality The quality for this instance.
- * @param pre The pre-break text.
- * @param no The no-break text (can be null).
- * @param post The post-break text (can be null).
- */
- DiscretionaryHyphenMutating4a(final ParaPenalty.Quality quality, final String pre, final String no,
- final String post) {
- this.quality = quality;
- this.preBreak = pre;
- this.noBreak = no;
- this.postBreak = post;
- }
-
- @Override
- public String toString() {
- if (this.noBreak == null
- && this.postBreak == null
- && this.preBreak != null
- && this.preBreak.equals("-")) {
- return "-";
- }
- final StringBuilder res = new StringBuilder("{");
- res.append(this.preBreak);
- res.append("}{");
- res.append(this.postBreak);
- res.append("}{");
- res.append(this.noBreak);
- res.append('}');
- return res.toString();
- }
-
- /**
- * Returns the "no break" String.
- * @return Returns the noBreak.
- */
- public String getNoBreak() {
- return this.noBreak;
- }
-
- @Override
- public String preDelete() {
- /* TODO: Implement this. */
- return WellKnownConstants.EMPTY_STRING;
- }
-
- @Override
- public String preInsert() {
- /* TODO: Implement this. */
- return WellKnownConstants.EMPTY_STRING;
- }
-
- @Override
- public String postDelete() {
- /* TODO: Implement this. */
- return WellKnownConstants.EMPTY_STRING;
- }
-
- @Override
- public String postInsert() {
- /* TODO: Implement this. */
- return WellKnownConstants.EMPTY_STRING;
- }
-
- @Override
- public Quality getQuality() {
- return this.quality;
- }
-
- @Override
- public int getWidth(final ParaConfig config) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getCost(final ParaContext paraContext) {
- return paraContext.getCost(this.quality);
- }
-
- @Override
- public boolean isFlagged() {
- return true;
- }
-
- @Override
- public Type getParaLeafType() {
- return ParaLeaf.Type.PENALTY;
- }
-
- @Override
- public ParaBox asParaBox() {
- return null;
- }
-
- @Override
- public ParaGlue asParaGlue() {
- return null;
- }
-
- @Override
- public ParaPenalty asParaPenalty() {
- return this;
- }
-
- @Override
- public org.axsl.common.para.ParaNode.Type getParaNodeType() {
- return ParaNode.Type.LEAF;
- }
-
- @Override
- public ParaLeaf asParaLeaf() {
- return this;
- }
-
- @Override
- public ParaBranch asParaBranch() {
- return null;
- }
-
- @Override
- public CharSequence getText() {
- return "-";
- }
-
- @Override
- public int paraKpLeafSize() {
- return 1;
- }
-
-}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java (from rev 12329, trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphen4a.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2019 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.orthography;
+
+import org.foray.common.para.ParaLeaf4a;
+
+import org.axsl.common.para.ParaBox;
+import org.axsl.common.para.ParaConfig;
+import org.axsl.common.para.ParaContext;
+import org.axsl.common.para.ParaGlue;
+import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaPenalty;
+import org.axsl.orthography.DiscretionaryHyphen;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * FOray implementation of {@link DiscretionaryHyphen}.
+ * Instances of this class are immutable.
+ */
+public final class DiscretionaryHyphen4a extends ParaLeaf4a implements DiscretionaryHyphen {
+
+ /** Pre-built "heinous" hyphenation point. */
+ public static final DiscretionaryHyphen4a HEINOUS = new DiscretionaryHyphen4a(ParaPenalty.Quality.INFINITE_PENALTY);
+
+ /** Pre-built "acceptable" hyphenation point. */
+ public static final DiscretionaryHyphen4a ACCEPTABLE = new DiscretionaryHyphen4a(ParaPenalty.Quality.ACCEPTABLE);
+
+ /** Pre-built "good" hyphenation point. */
+ public static final DiscretionaryHyphen4a GOOD = new DiscretionaryHyphen4a(ParaPenalty.Quality.GOOD);
+
+ /** Pre-built "best" hyphenation point. */
+ public static final DiscretionaryHyphen4a BEST = new DiscretionaryHyphen4a(ParaPenalty.Quality.BEST);
+
+ /** The array of pre-constructed instances. */
+ private static final Map<ParaPenalty.Quality, DiscretionaryHyphen4a> PRE_CONSTRUCTED_POINTS =
+ new EnumMap<ParaPenalty.Quality, DiscretionaryHyphen4a>(ParaPenalty.Quality.class);
+ static {
+ PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.INFINITE_PENALTY, HEINOUS);
+ PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.ACCEPTABLE, ACCEPTABLE);
+ PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.GOOD, GOOD);
+ PRE_CONSTRUCTED_POINTS.put(ParaPenalty.Quality.BEST, BEST);
+ }
+
+ /** The quality for this instance. */
+ private ParaPenalty.Quality quality;
+
+ /**
+ * Protected constructor. There are only 3 possible normal values, so these are pre-constructed.
+ * Use {@link #fromQuality(org.axsl.common.para.ParaPenalty.Quality)} to obtain an instance of this class.
+ * @param quality The quality for this instance.
+ */
+ protected DiscretionaryHyphen4a(final ParaPenalty.Quality quality) {
+ this.quality = quality;
+ }
+
+ /**
+ * Returns an instance of this class for a given quality.
+ * @param quality The quality for the desired instance.
+ * @return The instance of this class matching {@code quality}.
+ */
+ public static DiscretionaryHyphen4a fromQuality(final ParaPenalty.Quality quality) {
+ return DiscretionaryHyphen4a.PRE_CONSTRUCTED_POINTS.get(quality);
+ }
+
+ @Override
+ public ParaPenalty.Quality getQuality() {
+ return this.quality;
+ }
+
+ @Override
+ public String toString() {
+ return "-";
+ }
+
+ @Override
+ public int getWidth(final ParaConfig config) {
+ return config.getHyphenCharacterWidth();
+ }
+
+ @Override
+ public int getCost(final ParaContext paraContext) {
+ return paraContext.getCost(this.quality);
+ }
+
+ @Override
+ public boolean isFlagged() {
+ return true;
+ }
+
+ @Override
+ public Type getParaLeafType() {
+ return ParaLeaf.Type.PENALTY;
+ }
+
+ @Override
+ public ParaBox asParaBox() {
+ return null;
+ }
+
+ @Override
+ public ParaGlue asParaGlue() {
+ return null;
+ }
+
+ @Override
+ public ParaPenalty asParaPenalty() {
+ return this;
+ }
+
+ @Override
+ public CharSequence getText() {
+ return "-";
+ }
+
+ @Override
+ public int paraKpLeafSize() {
+ return 1;
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java (from rev 12328, trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DiscretionaryHyphenMutating4a.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+/*
+ * Known contributors:
+ * Carlos Villegas <ca...@un...> (Original author), who credited
+ * TeX for the basic scheme.
+ */
+
+package org.foray.orthography;
+
+import org.foray.common.WellKnownConstants;
+
+import org.axsl.common.para.ParaBox;
+import org.axsl.common.para.ParaBranch;
+import org.axsl.common.para.ParaConfig;
+import org.axsl.common.para.ParaContext;
+import org.axsl.common.para.ParaGlue;
+import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaNode;
+import org.axsl.common.para.ParaPenalty;
+import org.axsl.orthography.DiscretionaryHyphenMutating;
+
+import java.io.Serializable;
+
+/**
+ * <p>Specialized information about a specific hyphenation break opportunity in
+ * a word.
+ * This handles "hard" hyphenation cases, such as those where the word changes
+ * spelling when it is hyphenated.
+ * See {@link org.axsl.orthography.DiscretionaryHyphenMutating} for more information about the
+ * general use of this class.</p>
+ *
+ * <p>A 'full' hyphen is made of 3 parts:
+ * the pre-break text, post-break text and no-break. If no line-break
+ * is generated at this position, the no-break text is used, otherwise,
+ * pre-break and post-break are used. Typically, pre-break is equal to
+ * the hyphen character and the others are empty.</p>
+ */
+public class DiscretionaryHyphenMutating4a implements Serializable, DiscretionaryHyphenMutating {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 990405609314441965L;
+
+ /** The quality for this instance. */
+ private ParaPenalty.Quality quality;
+
+ /** The pre-break text. */
+ private String preBreak;
+
+ /** The no-break text. */
+ private String noBreak;
+
+ /** The post-break text. */
+ private String postBreak;
+
+ /**
+ * Constructor.
+ * @param quality The quality for this instance.
+ * @param pre The pre-break text.
+ * @param no The no-break text (can be null).
+ * @param post The post-break text (can be null).
+ */
+ DiscretionaryHyphenMutating4a(final ParaPenalty.Quality quality, final String pre, final String no,
+ final String post) {
+ this.quality = quality;
+ this.preBreak = pre;
+ this.noBreak = no;
+ this.postBreak = post;
+ }
+
+ @Override
+ public String toString() {
+ if (this.noBreak == null
+ && this.postBreak == null
+ && this.preBreak != null
+ && this.preBreak.equals("-")) {
+ return "-";
+ }
+ final StringBuilder res = new StringBuilder("{");
+ res.append(this.preBreak);
+ res.append("}{");
+ res.append(this.postBreak);
+ res.append("}{");
+ res.append(this.noBreak);
+ res.append('}');
+ return res.toString();
+ }
+
+ /**
+ * Returns the "no break" String.
+ * @return Returns the noBreak.
+ */
+ public String getNoBreak() {
+ return this.noBreak;
+ }
+
+ @Override
+ public String preDelete() {
+ /* TODO: Implement this. */
+ return WellKnownConstants.EMPTY_STRING;
+ }
+
+ @Override
+ public String preInsert() {
+ /* TODO: Implement this. */
+ return WellKnownConstants.EMPTY_STRING;
+ }
+
+ @Override
+ public String postDelete() {
+ /* TODO: Implement this. */
+ return WellKnownConstants.EMPTY_STRING;
+ }
+
+ @Override
+ public String postInsert() {
+ /* TODO: Implement this. */
+ return WellKnownConstants.EMPTY_STRING;
+ }
+
+ @Override
+ public Quality getQuality() {
+ return this.quality;
+ }
+
+ @Override
+ public int getWidth(final ParaConfig config) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getCost(final ParaContext paraContext) {
+ return paraContext.getCost(this.quality);
+ }
+
+ @Override
+ public boolean isFlagged() {
+ return true;
+ }
+
+ @Override
+ public Type getParaLeafType() {
+ return ParaLeaf.Type.PENALTY;
+ }
+
+ @Override
+ public ParaBox asParaBox() {
+ return null;
+ }
+
+ @Override
+ public ParaGlue asParaGlue() {
+ return null;
+ }
+
+ @Override
+ public ParaPenalty asParaPenalty() {
+ return this;
+ }
+
+ @Override
+ public org.axsl.common.para.ParaNode.Type getParaNodeType() {
+ return ParaNode.Type.LEAF;
+ }
+
+ @Override
+ public ParaLeaf asParaLeaf() {
+ return this;
+ }
+
+ @Override
+ public ParaBranch asParaBranch() {
+ return null;
+ }
+
+ @Override
+ public CharSequence getText() {
+ return "-";
+ }
+
+ @Override
+ public int paraKpLeafSize() {
+ return 1;
+ }
+
+}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -28,8 +28,6 @@
package org.foray.orthography;
-import org.foray.common.para.DiscretionaryHyphenMutating4a;
-
import org.axsl.orthography.DiscretionaryHyphen;
import java.io.Serializable;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -28,7 +28,6 @@
package org.foray.orthography;
-import org.foray.common.para.DiscretionaryHyphen4a;
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.primitive.NumberUtils;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -28,7 +28,6 @@
package org.foray.orthography;
-import org.foray.common.para.DiscretionaryHyphen4a;
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.primitive.NumberUtils;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -28,8 +28,8 @@
package org.foray.orthography.wrapper;
-import org.foray.common.para.DiscretionaryHyphen4a;
import org.foray.common.primitive.NumberUtils;
+import org.foray.orthography.DiscretionaryHyphen4a;
import org.foray.orthography.WordWrapper;
import org.axsl.common.para.ParaLeaf;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-03 20:26:05 UTC (rev 12329)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-03 20:33:57 UTC (rev 12330)
@@ -28,8 +28,6 @@
package org.foray.orthography;
-import org.foray.common.para.DiscretionaryHyphen4a;
-
import org.axsl.orthography.DiscretionaryHyphen;
import org.junit.Assert;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-03 20:26:08
|
Revision: 12329
http://sourceforge.net/p/foray/code/12329
Author: victormote
Date: 2022-01-03 20:26:05 +0000 (Mon, 03 Jan 2022)
Log Message:
-----------
Minor discretionary hyphen refactorings.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java
trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-03 19:45:08 UTC (rev 12328)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-03 20:26:05 UTC (rev 12329)
@@ -29,7 +29,7 @@
package org.foray.area;
import org.foray.area.link.Link;
-import org.foray.common.para.DiscretionaryHyphen4a;
+import org.foray.common.para.ParaPenalty4a;
import org.axsl.area.AreaTreeException;
import org.axsl.area.NormalBlockArea;
@@ -519,7 +519,7 @@
@Override
public int getCost(final ParaPenalty.Quality quality) {
/* TODO: This should be more configurable. */
- return DiscretionaryHyphen4a.DEFAULT_PENALTY;
+ return ParaPenalty4a.DEFAULT_PENALTY;
}
@Override
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2022-01-03 19:45:08 UTC (rev 12328)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2022-01-03 20:26:05 UTC (rev 12329)
@@ -45,10 +45,6 @@
*/
public final class DiscretionaryHyphen4a extends ParaLeaf4a implements DiscretionaryHyphen {
- /** The default penalty for a discretionary hyphen using the Knuth-Plass model. Derived from [KP-03], p. 74, Table
- * 1.*/
- public static final int DEFAULT_PENALTY = 50;
-
/** Pre-built "heinous" hyphenation point. */
public static final DiscretionaryHyphen4a HEINOUS = new DiscretionaryHyphen4a(ParaPenalty.Quality.INFINITE_PENALTY);
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java 2022-01-03 19:45:08 UTC (rev 12328)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaPenalty4a.java 2022-01-03 20:26:05 UTC (rev 12329)
@@ -43,6 +43,10 @@
*/
public final class ParaPenalty4a extends ParaLeaf4a implements ParaPenalty {
+ /** The default penalty for a discretionary hyphen using the Knuth-Plass model. Derived from [KP-03], p. 74, Table
+ * 1.*/
+ public static final int DEFAULT_PENALTY = 50;
+
/** A penalty instance indicating that a break cannot be taken here under any circumstances. */
public static final ParaPenalty4a DISALLOWED_BREAK =
new ParaPenalty4a(0, ParaPenalty.Quality.INFINITE_PENALTY.getNumericValue(), false);
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2022-01-03 19:45:08 UTC (rev 12328)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/para/ParaBranch4aTests.java 2022-01-03 20:26:05 UTC (rev 12329)
@@ -28,6 +28,8 @@
package org.foray.common.para;
+import org.axsl.common.para.ParaPenalty;
+
import org.junit.Assert;
import org.junit.Test;
@@ -47,10 +49,13 @@
* -- William Shakespeare, "Twelfth Night," Act II, Scene 5.
*/
+ final ParaPenalty discretionaryHyphen = new ParaPenaltyChars("-", 0, false);
+
final ParaBranch4a out = new ParaBranch4a();
final ParaBranch4a nodeGreatness = new ParaBranch4a();
nodeGreatness.addNode(new ParaBoxChars("great"));
- nodeGreatness.addNode(DiscretionaryHyphen4a.GOOD);
+
+ nodeGreatness.addNode(discretionaryHyphen);
nodeGreatness.addNode(new ParaBoxChars("ness"));
/* Putting "Be" in a branch is unnecessary, but we wish to test a branch as the first node. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-01-03 19:45:12
|
Revision: 12328
http://sourceforge.net/p/foray/code/12328
Author: victormote
Date: 2022-01-03 19:45:08 +0000 (Mon, 03 Jan 2022)
Log Message:
-----------
Conform to aXSL changes: Move DiscretionaryHyphen classes from common to orthography.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/NormalBlockArea4a.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -34,8 +34,8 @@
import org.axsl.area.AreaTreeException;
import org.axsl.area.NormalBlockArea;
import org.axsl.area.factory.BlockLevelAreaFactory;
-import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaContext;
+import org.axsl.common.para.ParaPenalty;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.BorderStyle;
import org.axsl.common.value.RelativeAxis;
@@ -517,7 +517,7 @@
}
@Override
- public int getCost(final DiscretionaryHyphen.Quality quality) {
+ public int getCost(final ParaPenalty.Quality quality) {
/* TODO: This should be more configurable. */
return DiscretionaryHyphen4a.DEFAULT_PENALTY;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphen4a.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -28,7 +28,6 @@
package org.foray.common.para;
-import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaBox;
import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaContext;
@@ -35,6 +34,7 @@
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaPenalty;
+import org.axsl.orthography.DiscretionaryHyphen;
import java.util.EnumMap;
import java.util.Map;
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/DiscretionaryHyphenMutating4a.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -36,8 +36,6 @@
import org.foray.common.WellKnownConstants;
-import org.axsl.common.para.DiscretionaryHyphen;
-import org.axsl.common.para.DiscretionaryHyphenMutating;
import org.axsl.common.para.ParaBox;
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaConfig;
@@ -46,6 +44,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
+import org.axsl.orthography.DiscretionaryHyphenMutating;
import java.io.Serializable;
@@ -54,7 +53,7 @@
* a word.
* This handles "hard" hyphenation cases, such as those where the word changes
* spelling when it is hyphenated.
- * See {@link org.axsl.common.para.DiscretionaryHyphenMutating} for more information about the
+ * See {@link org.axsl.orthography.DiscretionaryHyphenMutating} for more information about the
* general use of this class.</p>
*
* <p>A 'full' hyphen is made of 3 parts:
@@ -69,7 +68,7 @@
private static final long serialVersionUID = 990405609314441965L;
/** The quality for this instance. */
- private DiscretionaryHyphen.Quality quality;
+ private ParaPenalty.Quality quality;
/** The pre-break text. */
private String preBreak;
@@ -87,7 +86,7 @@
* @param no The no-break text (can be null).
* @param post The post-break text (can be null).
*/
- DiscretionaryHyphenMutating4a(final DiscretionaryHyphen.Quality quality, final String pre, final String no,
+ DiscretionaryHyphenMutating4a(final ParaPenalty.Quality quality, final String pre, final String no,
final String post) {
this.quality = quality;
this.preBreak = pre;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LineBreaker4aTests.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -37,8 +37,8 @@
import org.foray.font.util.MockFontUse;
import org.foray.orthography.Punctuation4a;
-import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaContext;
+import org.axsl.common.para.ParaPenalty;
import org.junit.Assert;
import org.mockito.Mockito;
@@ -389,7 +389,7 @@
*/
public ParaContext createParaContext(final int lineWidth) {
final ParaContext paraControl = Mockito.mock(ParaContext.class);
- Mockito.when(paraControl.getCost(Mockito.any(DiscretionaryHyphen.Quality.class))).thenReturn(50);
+ Mockito.when(paraControl.getCost(Mockito.any(ParaPenalty.Quality.class))).thenReturn(50);
if (lineWidth < 0) {
/* Page is 8.5 inches wide, 1 inch margin on both ends, leaving 6.5 inches, or 468,000 millipoints. */
Mockito.when(paraControl.getLineLength(Mockito.anyInt())).thenReturn(468000);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -30,7 +30,7 @@
import org.foray.common.para.DiscretionaryHyphenMutating4a;
-import org.axsl.common.para.DiscretionaryHyphen;
+import org.axsl.orthography.DiscretionaryHyphen;
import java.io.Serializable;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -32,8 +32,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.primitive.NumberUtils;
-import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaLeaf;
+import org.axsl.common.para.ParaPenalty;
/**
* A word implementation that wraps a set of {@link StringWordSegmentUtf16}, a thin wrapper around a {@link String}.
@@ -141,7 +141,7 @@
/* Every even-numbered index points to a segment of this word. Every odd-numbered index points to a
* discretionary hyphen. */
if (NumberUtils.isOdd(leafIndex)) {
- return DiscretionaryHyphen4a.fromQuality(DiscretionaryHyphen.Quality.GOOD);
+ return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.GOOD);
}
final int segmentIndex = leafIndex / 2;
return this.segments[segmentIndex];
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -32,11 +32,12 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.primitive.NumberUtils;
-import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaBranch;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
+import org.axsl.common.para.ParaPenalty;
import org.axsl.common.sequence.ByteSequence;
+import org.axsl.orthography.DiscretionaryHyphen;
import org.axsl.orthography.Word;
import org.axsl.orthography.WordSegment;
@@ -163,7 +164,7 @@
@Override
public DiscretionaryHyphen getHyphenationPoint(final int pointIndex) {
- return DiscretionaryHyphen4a.fromQuality(DiscretionaryHyphen.Quality.ACCEPTABLE);
+ return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
}
@Override
@@ -184,7 +185,7 @@
}
/* Even-indexed components will always be segments, odd-indexed components will always be hyphenation points. */
if (NumberUtils.isOdd(componentIndex)) {
- return DiscretionaryHyphen4a.fromQuality(DiscretionaryHyphen.Quality.ACCEPTABLE);
+ return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
} else {
final int segmentIndex = componentIndex / 2;
return getWordSegment(segmentIndex);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -32,9 +32,9 @@
import org.foray.common.primitive.NumberUtils;
import org.foray.orthography.WordWrapper;
-import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
+import org.axsl.common.para.ParaPenalty;
import org.axsl.orthography.Word;
/**
@@ -96,7 +96,7 @@
}
/* Even-indexed components will always be segments, odd-indexed components will always be hyphenation points. */
if (NumberUtils.isOdd(componentIndex)) {
- return DiscretionaryHyphen4a.fromQuality(DiscretionaryHyphen.Quality.ACCEPTABLE);
+ return DiscretionaryHyphen4a.fromQuality(ParaPenalty.Quality.ACCEPTABLE);
} else {
final int index = componentIndex / 2;
return getWordSegment(index);
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-03 19:18:57 UTC (rev 12327)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java 2022-01-03 19:45:08 UTC (rev 12328)
@@ -30,7 +30,7 @@
import org.foray.common.para.DiscretionaryHyphen4a;
-import org.axsl.common.para.DiscretionaryHyphen;
+import org.axsl.orthography.DiscretionaryHyphen;
import org.junit.Assert;
import org.junit.Test;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|