From 3b22862c156bd167af8ea0bed80c8dd3aa5069c3 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Mon, 16 Sep 2002 05:31:16 +0000 Subject: [PATCH] Namespace indices handled in XMLNamespaces. get/expect buffer events from SyncedXmlEventsBuffer. type argument for FONode subclasses. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195200 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/pagination/FoLayoutMasterSet.java | 26 +++++++------ .../fo/pagination/FoPageSequenceMaster.java | 38 +++++++++++-------- .../fop/fo/pagination/FoSimplePageMaster.java | 10 +++-- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java b/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java index 592dc50be..d95b446fc 100644 --- a/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java +++ b/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java @@ -6,10 +6,12 @@ import java.util.NoSuchElementException; import org.apache.fop.apps.FOPException; import org.apache.fop.xml.XMLEvent; +import org.apache.fop.fo.FObjectNames; import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FONode; import org.apache.fop.fo.expr.PropertyException; -import org.apache.fop.datastructs.SyncedCircularBuffer; +import org.apache.fop.xml.XMLNamespaces; +import org.apache.fop.xml.SyncedXmlEventsBuffer; import org.apache.fop.datastructs.Tree; import org.apache.fop.fo.pagination.FoPageSequenceMaster; import org.apache.fop.fo.pagination.FoPageSequenceMaster.SubSequenceSpecifier; @@ -17,14 +19,11 @@ import org.apache.fop.fo.pagination .FoPageSequenceMaster.SubSequenceSpecifier.ConditionalPageMasterReference; /* - * FoLayoutMasterSet.java * $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. * - * Created: Mon Nov 12 23:30:51 2001 - * * @author Peter B. West * @version $Revision$ $Name$ */ @@ -36,6 +35,9 @@ import org.apache.fop.fo.pagination public class FoLayoutMasterSet extends FONode { + private static final String tag = "$Name$"; + private static final String revision = "$Revision$"; + /** * Hash of SimplePageMaster and PageSequenceMaster objects, * indexed by master-name of the object. @@ -58,7 +60,8 @@ public class FoLayoutMasterSet extends FONode { (FOTree foTree, FONode parent, XMLEvent event) throws Tree.TreeException, FOPException, PropertyException { - super(foTree, parent, event, FONode.LAYOUT); + super(foTree, FObjectNames.LAYOUT_MASTER_SET, parent, event, + FONode.LAYOUT); } /** @@ -71,17 +74,18 @@ public class FoLayoutMasterSet extends FONode { // Set up a list with the two possibilities LinkedList list = new LinkedList(); list.add((Object)(new XMLEvent.UriLocalName - (XMLEvent.XSLNSpaceIndex, "simple-page-master"))); + (XMLNamespaces.XSLNSpaceIndex, "simple-page-master"))); list.add((Object)(new XMLEvent.UriLocalName - (XMLEvent.XSLNSpaceIndex, "page-sequence-master"))); + (XMLNamespaces.XSLNSpaceIndex, "page-sequence-master"))); try { do { FoSimplePageMaster simple; String simpleName; + String localName; FoPageSequenceMaster pageSeq; - XMLEvent ev = - XMLEvent.expectStartElement(xmlevents, list); - if (ev.localName.equals("simple-page-master")) { + XMLEvent ev = xmlevents.expectStartElement(list); + localName = ev.getLocalName(); + if (localName.equals("simple-page-master")) { System.out.println("Found simple-page-master"); try { simple = new FoSimplePageMaster(foTree, this, ev); @@ -123,7 +127,7 @@ public class FoLayoutMasterSet extends FONode { ConditionalPageMasterReference cond = subSeq.new ConditionalPageMasterReference(simpleName); pageMasters.put(simpleName, seqMaster); - } else if (ev.localName.equals("page-sequence-master")) { + } else if (localName.equals("page-sequence-master")) { System.out.println("Found page-sequence-master"); try { pageSeq = new FoPageSequenceMaster(foTree, this, ev); diff --git a/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java b/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java index c3c164dbc..28c9468df 100644 --- a/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java +++ b/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java @@ -16,9 +16,11 @@ import java.util.NoSuchElementException; // FOP import org.apache.fop.fo.FOAttributes; import org.apache.fop.xml.XMLEvent; +import org.apache.fop.xml.XMLNamespaces; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; +import org.apache.fop.fo.FObjectNames; import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FONode; import org.apache.fop.datastructs.Tree; @@ -32,6 +34,9 @@ import org.apache.fop.datastructs.Tree; */ public class FoPageSequenceMaster extends FONode { + private static final String tag = "$Name$"; + private static final String revision = "$Revision$"; + private String masterName; private ArrayList subSequenceList = new ArrayList(1); @@ -40,14 +45,16 @@ public class FoPageSequenceMaster extends FONode { (FOTree foTree, FONode parent, String masterName) throws Tree.TreeException, FOPException, PropertyException { - super(foTree, parent, null, FONode.NONE); + super(foTree, FObjectNames.PAGE_SEQUENCE_MASTER, parent, null, + FONode.LAYOUT); this.masterName = masterName; } public FoPageSequenceMaster(FOTree foTree, FONode parent, XMLEvent event) throws Tree.TreeException, FOPException, PropertyException { - super(foTree, parent, event, FONode.LAYOUT); + super(foTree, FObjectNames.PAGE_SEQUENCE_MASTER, parent, event, + FONode.LAYOUT); if (event == null) { System.out.println("Null event; throwing FOPException"); throw new FOPException @@ -60,27 +67,26 @@ public class FoPageSequenceMaster extends FONode { } // Process sequence members here LinkedList list = new LinkedList(); + list.add((Object)(new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, "single-page-master-reference"))); + list.add((Object)(new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, + "repeatable-page-master-reference"))); list.add((Object) (new XMLEvent.UriLocalName - (XMLEvent.XSLNSpaceIndex, "single-page-master-reference"))); - list.add((Object) - (new XMLEvent.UriLocalName - (XMLEvent.XSLNSpaceIndex, - "repeatable-page-master-reference"))); - list.add((Object) - (new XMLEvent.UriLocalName - (XMLEvent.XSLNSpaceIndex, - "repeatable-page-master-alternatives"))); + (XMLNamespaces.XSLNSpaceIndex, + "repeatable-page-master-alternatives"))); try { do { - XMLEvent ev = XMLEvent.expectStartElement(xmlevents, list); - if (ev.localName.equals("single-page-master-reference")) { + XMLEvent ev = xmlevents.expectStartElement(list); + String localName = ev.getLocalName(); + if (localName.equals("single-page-master-reference")) { System.out.println("Found single-page-master-reference"); - } else if (ev.localName.equals + } else if (localName.equals ("repeatable-page-master-reference")) { System.out.println ("Found repeatable-page-master-reference"); - } else if (ev.localName.equals + } else if (localName.equals ("repeatable-page-master-alternatives")) { System.out.println ("Found repeatable-page-master-reference"); @@ -91,7 +97,7 @@ public class FoPageSequenceMaster extends FONode { } catch (NoSuchElementException e) { // sub-sequence specifiers exhausted } - XMLEvent ev = XMLEvent.getEndElement(xmlevents, event); + XMLEvent ev = xmlevents.getEndElement(event); } /** diff --git a/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java b/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java index e23120c51..2cea7baa4 100644 --- a/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java @@ -13,17 +13,20 @@ package org.apache.fop.fo.pagination; import org.apache.fop.fo.FOAttributes; import org.apache.fop.xml.XMLEvent; import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FObjectNames; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTree; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.datastructs.Tree; -import org.apache.fop.datastructs.SyncedCircularBuffer; /** * Implements the fo:simple-page-master flow object */ public class FoSimplePageMaster extends FONode { + private static final String tag = "$Name$"; + private static final String revision = "$Revision$"; + private String masterName; /** @@ -35,7 +38,8 @@ public class FoSimplePageMaster extends FONode { public FoSimplePageMaster(FOTree foTree, FONode parent, XMLEvent event) throws Tree.TreeException, FOPException, PropertyException { - super(foTree, parent, event, FONode.LAYOUT); + super(foTree, FObjectNames.SIMPLE_PAGE_MASTER, parent, event, + FONode.LAYOUT); System.out.println("FOAttributes: " + event); try { masterName = foAttributes.getFoAttrValue("master-name"); @@ -43,7 +47,7 @@ public class FoSimplePageMaster extends FONode { throw new FOPException(e.getMessage()); } // Process regions here - XMLEvent ev = XMLEvent.getEndElement(xmlevents, event); + XMLEvent ev = xmlevents.getEndElement(event); } /** -- 2.39.5