return currentPresentationTextObject;
}
+ /**
+ * 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.
*
*/
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);
}
/**
/** {@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 {
import java.io.IOException;
import java.io.OutputStream;
-import java.util.List;
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.
*/
this.tleSequence = tleSequence;
}
- private List getTagLogicalElements() {
- if (tagLogicalElements == null) {
- this.tagLogicalElements = new java.util.ArrayList();
- }
- return this.tagLogicalElements;
- }
-
/**
* Creates a TagLogicalElement on the page.
*
/** {@inheritDoc} */
protected void writeContent(OutputStream os) throws IOException {
- writeObjects(tagLogicalElements, os);
+ writeObjects(tagLogicalElements, os, true);
super.writeContent(os);
}