aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2009-04-24 14:39:32 +0000
committerVincent Hennebert <vhennebert@apache.org>2009-04-24 14:39:32 +0000
commit1aa5983642042d6be6bc63a0d9277fd10e731d99 (patch)
tree8d8a78d809f3f35bb43757f8e050bc20acf21077 /src
parentd39bfced9a5568f5bc44aaca2c8a0f9e97a4eb7f (diff)
downloadxmlgraphics-fop-1aa5983642042d6be6bc63a0d9277fd10e731d99.tar.gz
xmlgraphics-fop-1aa5983642042d6be6bc63a0d9277fd10e731d99.zip
In the AFP stream, put the TLE fields associated to a page sequence before the Page elements instead of after
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@768321 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/afp/modca/AbstractPageObject.java17
-rw-r--r--src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java17
-rw-r--r--src/java/org/apache/fop/afp/modca/PageGroup.java13
3 files changed, 29 insertions, 18 deletions
diff --git a/src/java/org/apache/fop/afp/modca/AbstractPageObject.java b/src/java/org/apache/fop/afp/modca/AbstractPageObject.java
index c043faf2e..cd8c44b5e 100644
--- a/src/java/org/apache/fop/afp/modca/AbstractPageObject.java
+++ b/src/java/org/apache/fop/afp/modca/AbstractPageObject.java
@@ -212,6 +212,17 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject implemen
}
/**
+ * Returns the list of {@link TagLogicalElement}s.
+ * @return the TLEs
+ */
+ protected List getTagLogicalElements() {
+ if (tagLogicalElements == null) {
+ this.tagLogicalElements = new java.util.ArrayList/*<TagLogicalElement>*/();
+ }
+ return this.tagLogicalElements;
+ }
+
+ /**
* Creates a TagLogicalElement on the page.
*
* @param name
@@ -223,10 +234,8 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject implemen
*/
public void createTagLogicalElement(String name, String value, int tleID) {
TagLogicalElement tle = new TagLogicalElement(name, value, tleID);
- if (tagLogicalElements == null) {
- tagLogicalElements = new java.util.ArrayList/*<TagLogicalElement>*/();
- }
- tagLogicalElements.add(tle);
+ List list = getTagLogicalElements();
+ list.add(tle);
}
/**
diff --git a/src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java b/src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java
index 6546fa978..d96b1911e 100644
--- a/src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java
+++ b/src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java
@@ -141,12 +141,25 @@ implements Streamable {
/** {@inheritDoc} */
protected void writeObjects(Collection/*<AbstractAFPObject>*/ objects, OutputStream os)
- throws IOException {
+ throws IOException {
+ writeObjects(objects, os, false);
+ }
+
+ /**
+ * Writes a collection of {@link AbstractAFPObject}s to the AFP Datastream.
+ *
+ * @param objects a list of AFPObjects
+ * @param os The stream to write to
+ * @param forceWrite true if writing should happen in any case
+ * @throws java.io.IOException an I/O exception of some sort has occurred.
+ */
+ protected void writeObjects(Collection/*<AbstractAFPObject>*/ objects, OutputStream os,
+ boolean forceWrite) throws IOException {
if (objects != null && objects.size() > 0) {
Iterator it = objects.iterator();
while (it.hasNext()) {
AbstractAFPObject ao = (AbstractAFPObject)it.next();
- if (canWrite(ao)) {
+ if (forceWrite || canWrite(ao)) {
ao.writeToStream(os);
it.remove();
} else {
diff --git a/src/java/org/apache/fop/afp/modca/PageGroup.java b/src/java/org/apache/fop/afp/modca/PageGroup.java
index 4e578718b..f70b6fc52 100644
--- a/src/java/org/apache/fop/afp/modca/PageGroup.java
+++ b/src/java/org/apache/fop/afp/modca/PageGroup.java
@@ -21,7 +21,6 @@ package org.apache.fop.afp.modca;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.List;
import org.apache.fop.afp.Factory;
@@ -36,9 +35,6 @@ import org.apache.fop.afp.Factory;
*/
public class PageGroup extends AbstractResourceEnvironmentGroupContainer {
- /** The tag logical elements contained within this group */
- private List tagLogicalElements = null;
-
/**
* Sequence number for TLE's.
*/
@@ -56,13 +52,6 @@ public class PageGroup extends AbstractResourceEnvironmentGroupContainer {
this.tleSequence = tleSequence;
}
- private List getTagLogicalElements() {
- if (tagLogicalElements == null) {
- this.tagLogicalElements = new java.util.ArrayList();
- }
- return this.tagLogicalElements;
- }
-
/**
* Creates a TagLogicalElement on the page.
*
@@ -88,7 +77,7 @@ public class PageGroup extends AbstractResourceEnvironmentGroupContainer {
/** {@inheritDoc} */
protected void writeContent(OutputStream os) throws IOException {
- writeObjects(tagLogicalElements, os);
+ writeObjects(tagLogicalElements, os, true);
super.writeContent(os);
}