aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}