pbwest 2002/10/30 05:19:04
Modified: src/org/apache/fop/fo/pagination Tag: FOP_0-20-0_Alt-Design
FoLayoutMasterSet.java
Log:
Added sparsePropsSet support. Untabified.
Revision Changes Path
No revision
No revision
1.1.2.12 +61 -29
xml-fop/src/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java
Index: FoLayoutMasterSet.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- FoLayoutMasterSet.java 28 Oct 2002 00:08:11 -0000 1.1.2.11
+++ FoLayoutMasterSet.java 30 Oct 2002 13:19:04 -0000 1.1.2.12
@@ -41,6 +41,30 @@
private static final String tag = "$Name$";
private static final String revision = "$Revision$";
+ /** Map of <tt>Integer</tt> indices of <i>sparsePropsSet</i> array.
+ It is indexed by the FO index of the FO associated with a given
+ position in the <i>sparsePropsSet</i> array. See
+ {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
+ */
+ private static final HashMap sparsePropsMap;
+
+ /** An <tt>int</tt> array of of the applicable property indices, in
+ property index order. */
+ private static final int[] sparseIndices;
+
+ /** The number of applicable properties. This is the size of the
+ <i>sparsePropsSet</i> array. */
+ private static final int numProps;
+
+ static {
+ // applicableProps is a HashMap containing the indicies of the
+ // sparsePropsSet array, indexed by the FO index of the FO slot
+ // in sparsePropsSet.
+ sparsePropsMap = new HashMap(0);
+ numProps = 0;
+ sparseIndices = new int[] {};
+ }
+
/**
* An array with <tt>int</tt>s identifying
* <tt>simple-page-master</tt> and <tt>page-sequence-master</tt>
@@ -81,8 +105,15 @@
throws Tree.TreeException, FOPException, PropertyException
{
super(foTree, FObjectNames.LAYOUT_MASTER_SET, parent, event,
- FOPropertySets.LAYOUT_SET);
- setupPageMasters(event);
+ FOPropertySets.LAYOUT_SET, sparsePropsMap, sparseIndices,
+ numProps);
+ setupPageMasters(event);
+ // No need to clean up the build tree, because the whole subtree
+ // will be deleted.
+ // This is problematical: while Node is obliged to belong to a Tree,
+ // any remaining references to elements of the subtree will keep the
+ // whole subtree from being GCed.
+ makeSparsePropsSet();
}
/**
@@ -93,12 +124,12 @@
* @throws <tt>FOPException</tt>.
*/
public void setupPageMasters(FoXMLEvent event)
- throws FOPException, PropertyException
+ throws FOPException, PropertyException
{
- FoSimplePageMaster simple;
- String masterName;
+ FoSimplePageMaster simple;
+ String masterName;
int foType;
- FoPageSequenceMaster foPageSeq;
+ FoPageSequenceMaster foPageSeq;
try {
do {
FoXMLEvent ev =
@@ -125,7 +156,7 @@
//System.out.println("Found page-sequence-master");
try {
foPageSeq =
- new FoPageSequenceMaster(foTree, this, ev);
+ new FoPageSequenceMaster(foTree, this, ev);
} catch (Tree.TreeException e) {
throw new FOPException
("TreeException: " + e.getMessage());
@@ -143,6 +174,8 @@
} else
throw new FOPException
("Aargh! expectStartElement(events, list)");
+ // Flush the master event
+ xmlevents.getEndElement(ev);
} while (true);
} catch (NoSuchElementException e) {
// Unexpected end of file
@@ -155,26 +188,25 @@
throw new FOPException(e);
}
if (pageMasters.size() == 0)
- throw new FOPException("No pageg masters defined in
layout-master-set.");
- // Create the master set structures.
- // Scan the page-sequence-masters
- // N.B. Processing of the page-sequence-masters must be deferred until
- // now because contained master-references may be to
- // simple-page-masters which follow the page-sequence-master in the
- // input tree.
- Set pageSeqSet = pageMasters.keySet();
- Iterator pageSeqNames = pageSeqSet.iterator();
- while (pageSeqNames.hasNext()) {
- masterName = (String)(pageSeqNames.next());
- // Get the FoPageSequenceMaster
- foPageSeq = (FoPageSequenceMaster)(pageMasters.get(masterName));
- // Create a new PageSequenceMaster object - NOT an foPageSeqM
- PageSequenceMaster pageSeq = new PageSequenceMaster
- (masterName, foPageSeq, simplePageMasters);
+ throw new FOPException
+ ("No page masters defined in layout-master-set.");
+ // Create the master set structures.
+ // Scan the page-sequence-masters
+ // N.B. Processing of the page-sequence-masters must be deferred until
+ // now because contained master-references may be to
+ // simple-page-masters which follow the page-sequence-master in the
+ // input tree.
+ Set pageSeqSet = pageMasters.keySet();
+ Iterator pageSeqNames = pageSeqSet.iterator();
+ while (pageSeqNames.hasNext()) {
+ masterName = (String)(pageSeqNames.next());
+ // Get the FoPageSequenceMaster
+ foPageSeq = (FoPageSequenceMaster)(pageMasters.get(masterName));
+ // Create a new PageSequenceMaster object - NOT an foPageSeqM
+ PageSequenceMaster pageSeq = new PageSequenceMaster
+ (masterName, foPageSeq, simplePageMasters);
pageSequenceMasters.put(masterName, pageSeq);
- }
- // Flush to the layout-master-set end event
- xmlevents.getEndElement(event);
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]