diff options
author | Keiron Liddle <keiron@apache.org> | 2001-12-13 09:40:04 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-12-13 09:40:04 +0000 |
commit | 0c1075bfe6de132c82ae58d1e8370f777c4995ef (patch) | |
tree | 4c3df4fecbd795326d895fe7c4af48b9bd0be825 /src/org/apache | |
parent | 08a0cfd14dc86ad6c856821ee3cceb40d23b97ea (diff) | |
download | xmlgraphics-fop-0c1075bfe6de132c82ae58d1e8370f777c4995ef.tar.gz xmlgraphics-fop-0c1075bfe6de132c82ae58d1e8370f777c4995ef.zip |
properly setup the element mappings
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r-- | src/org/apache/fop/extensions/ExtensionElementMapping.java | 12 | ||||
-rw-r--r-- | src/org/apache/fop/fo/FOElementMapping.java | 119 | ||||
-rw-r--r-- | src/org/apache/fop/svg/SVGElementMapping.java | 33 |
3 files changed, 87 insertions, 77 deletions
diff --git a/src/org/apache/fop/extensions/ExtensionElementMapping.java b/src/org/apache/fop/extensions/ExtensionElementMapping.java index c14d0d353..479c4b3ca 100644 --- a/src/org/apache/fop/extensions/ExtensionElementMapping.java +++ b/src/org/apache/fop/extensions/ExtensionElementMapping.java @@ -19,22 +19,26 @@ public class ExtensionElementMapping implements ElementMapping { private static HashMap foObjs = null; - public synchronized void addToBuilder(FOTreeBuilder builder) { + private static synchronized void setupExt() { if(foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap(); foObjs.put("outline", new O()); foObjs.put("label", new L()); } + } + + public void addToBuilder(FOTreeBuilder builder) { + setupExt(); builder.addMapping(URI, foObjs); } - class O extends ElementMapping.Maker { + static class O extends ElementMapping.Maker { public FONode make(FONode parent) { return new Outline(parent); } } - class L extends ElementMapping.Maker { + static class L extends ElementMapping.Maker { public FONode make(FONode parent) { return new Label(parent); } diff --git a/src/org/apache/fop/fo/FOElementMapping.java b/src/org/apache/fop/fo/FOElementMapping.java index 5c4e248e7..0599b9a2f 100644 --- a/src/org/apache/fop/fo/FOElementMapping.java +++ b/src/org/apache/fop/fo/FOElementMapping.java @@ -16,8 +16,7 @@ import org.apache.fop.fo.pagination.*; public class FOElementMapping implements ElementMapping { private static HashMap foObjs = null; - public synchronized void addToBuilder(FOTreeBuilder builder) { - + private static synchronized void setupFO() { if(foObjs == null) { foObjs = new HashMap(); @@ -106,341 +105,345 @@ public class FOElementMapping implements ElementMapping { foObjs.put("retrieve-marker", new RM()); } + } + + public void addToBuilder(FOTreeBuilder builder) { + setupFO(); String uri = "http://www.w3.org/1999/XSL/Format"; builder.addMapping(uri, foObjs); } - class R extends ElementMapping.Maker { + static class R extends ElementMapping.Maker { public FONode make(FONode parent) { return new Root(parent); } } - class Dec extends ElementMapping.Maker { + static class Dec extends ElementMapping.Maker { public FONode make(FONode parent) { return new Declarations(parent); } } - class CP extends ElementMapping.Maker { + static class CP extends ElementMapping.Maker { public FONode make(FONode parent) { return new ColorProfile(parent); } } - class PS extends ElementMapping.Maker { + static class PS extends ElementMapping.Maker { public FONode make(FONode parent) { return new PageSequence(parent); } } - class LMS extends ElementMapping.Maker { + static class LMS extends ElementMapping.Maker { public FONode make(FONode parent) { return new LayoutMasterSet(parent); } } - class PSM extends ElementMapping.Maker { + static class PSM extends ElementMapping.Maker { public FONode make(FONode parent) { return new PageSequenceMaster(parent); } } - class SPMR extends ElementMapping.Maker { + static class SPMR extends ElementMapping.Maker { public FONode make(FONode parent) { return new SinglePageMasterReference(parent); } } - class RPMR extends ElementMapping.Maker { + static class RPMR extends ElementMapping.Maker { public FONode make(FONode parent) { return new RepeatablePageMasterReference(parent); } } - class RPMA extends ElementMapping.Maker { + static class RPMA extends ElementMapping.Maker { public FONode make(FONode parent) { return new RepeatablePageMasterAlternatives(parent); } } - class CPMR extends ElementMapping.Maker { + static class CPMR extends ElementMapping.Maker { public FONode make(FONode parent) { return new ConditionalPageMasterReference(parent); } } - class SPM extends ElementMapping.Maker { + static class SPM extends ElementMapping.Maker { public FONode make(FONode parent) { return new SimplePageMaster(parent); } } - class RB extends ElementMapping.Maker { + static class RB extends ElementMapping.Maker { public FONode make(FONode parent) { return new RegionBody(parent); } } - class RBefore extends ElementMapping.Maker { + static class RBefore extends ElementMapping.Maker { public FONode make(FONode parent) { return new RegionBefore(parent); } } - class RA extends ElementMapping.Maker { + static class RA extends ElementMapping.Maker { public FONode make(FONode parent) { return new RegionAfter(parent); } } - class RS extends ElementMapping.Maker { + static class RS extends ElementMapping.Maker { public FONode make(FONode parent) { return new RegionStart(parent); } } - class RE extends ElementMapping.Maker { + static class RE extends ElementMapping.Maker { public FONode make(FONode parent) { return new RegionEnd(parent); } } - class Fl extends ElementMapping.Maker { + static class Fl extends ElementMapping.Maker { public FONode make(FONode parent) { return new Flow(parent); } } - class SC extends ElementMapping.Maker { + static class SC extends ElementMapping.Maker { public FONode make(FONode parent) { return new StaticContent(parent); } } - class T extends ElementMapping.Maker { + static class T extends ElementMapping.Maker { public FONode make(FONode parent) { return new Title(parent); } } - class B extends ElementMapping.Maker { + static class B extends ElementMapping.Maker { public FONode make(FONode parent) { return new Block(parent); } } - class BC extends ElementMapping.Maker { + static class BC extends ElementMapping.Maker { public FONode make(FONode parent) { return new BlockContainer(parent); } } - class BO extends ElementMapping.Maker { + static class BO extends ElementMapping.Maker { public FONode make(FONode parent) { return new BidiOverride(parent); } } - class Ch extends ElementMapping.Maker { + static class Ch extends ElementMapping.Maker { public FONode make(FONode parent) { return new org.apache.fop.fo.flow.Character(parent); } } - class IPS extends ElementMapping.Maker { + static class IPS extends ElementMapping.Maker { public FONode make(FONode parent) { return new InitialPropertySet(parent); } } - class EG extends ElementMapping.Maker { + static class EG extends ElementMapping.Maker { public FONode make(FONode parent) { return new ExternalGraphic(parent); } } - class IFO extends ElementMapping.Maker { + static class IFO extends ElementMapping.Maker { public FONode make(FONode parent) { return new InstreamForeignObject(parent); } } - class In extends ElementMapping.Maker { + static class In extends ElementMapping.Maker { public FONode make(FONode parent) { return new Inline(parent); } } - class IC extends ElementMapping.Maker { + static class IC extends ElementMapping.Maker { public FONode make(FONode parent) { return new InlineContainer(parent); } } - class L extends ElementMapping.Maker { + static class L extends ElementMapping.Maker { public FONode make(FONode parent) { return new Leader(parent); } } - class PN extends ElementMapping.Maker { + static class PN extends ElementMapping.Maker { public FONode make(FONode parent) { return new PageNumber(parent); } } - class PNC extends ElementMapping.Maker { + static class PNC extends ElementMapping.Maker { public FONode make(FONode parent) { return new PageNumberCitation(parent); } } - class TAC extends ElementMapping.Maker { + static class TAC extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableAndCaption(parent); } } - class Ta extends ElementMapping.Maker { + static class Ta extends ElementMapping.Maker { public FONode make(FONode parent) { return new Table(parent); } } - class TC extends ElementMapping.Maker { + static class TC extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableColumn(parent); } } - class TCaption extends ElementMapping.Maker { + static class TCaption extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableCaption(parent); } } - class TH extends ElementMapping.Maker { + static class TH extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableHeader(parent); } } - class TF extends ElementMapping.Maker { + static class TF extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableFooter(parent); } } - class TB extends ElementMapping.Maker { + static class TB extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableBody(parent); } } - class TR extends ElementMapping.Maker { + static class TR extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableRow(parent); } } - class TCell extends ElementMapping.Maker { + static class TCell extends ElementMapping.Maker { public FONode make(FONode parent) { return new TableCell(parent); } } - class LB extends ElementMapping.Maker { + static class LB extends ElementMapping.Maker { public FONode make(FONode parent) { return new ListBlock(parent); } } - class LI extends ElementMapping.Maker { + static class LI extends ElementMapping.Maker { public FONode make(FONode parent) { return new ListItem(parent); } } - class LIB extends ElementMapping.Maker { + static class LIB extends ElementMapping.Maker { public FONode make(FONode parent) { return new ListItemBody(parent); } } - class LIL extends ElementMapping.Maker { + static class LIL extends ElementMapping.Maker { public FONode make(FONode parent) { return new ListItemLabel(parent); } } - class BL extends ElementMapping.Maker { + static class BL extends ElementMapping.Maker { public FONode make(FONode parent) { return new BasicLink(parent); } } - class MS extends ElementMapping.Maker { + static class MS extends ElementMapping.Maker { public FONode make(FONode parent) { return new MultiSwitch(parent); } } - class MC extends ElementMapping.Maker { + static class MC extends ElementMapping.Maker { public FONode make(FONode parent) { return new MultiCase(parent); } } - class MT extends ElementMapping.Maker { + static class MT extends ElementMapping.Maker { public FONode make(FONode parent) { return new MultiToggle(parent); } } - class MP extends ElementMapping.Maker { + static class MP extends ElementMapping.Maker { public FONode make(FONode parent) { return new MultiProperties(parent); } } - class MPS extends ElementMapping.Maker { + static class MPS extends ElementMapping.Maker { public FONode make(FONode parent) { return new MultiPropertySet(parent); } } - class F extends ElementMapping.Maker { + static class F extends ElementMapping.Maker { public FONode make(FONode parent) { return new org.apache.fop.fo.flow.Float(parent); } } - class Foot extends ElementMapping.Maker { + static class Foot extends ElementMapping.Maker { public FONode make(FONode parent) { return new Footnote(parent); } } - class FB extends ElementMapping.Maker { + static class FB extends ElementMapping.Maker { public FONode make(FONode parent) { return new FootnoteBody(parent); } } - class W extends ElementMapping.Maker { + static class W extends ElementMapping.Maker { public FONode make(FONode parent) { return new Wrapper(parent); } } - class M extends ElementMapping.Maker { + static class M extends ElementMapping.Maker { public FONode make(FONode parent) { return new Marker(parent); } } - class RM extends ElementMapping.Maker { + static class RM extends ElementMapping.Maker { public FONode make(FONode parent) { return new RetrieveMarker(parent); } diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java index a4db558e0..c4e4a19c0 100644 --- a/src/org/apache/fop/svg/SVGElementMapping.java +++ b/src/org/apache/fop/svg/SVGElementMapping.java @@ -21,20 +21,23 @@ public class SVGElementMapping implements ElementMapping { private static HashMap foObjs = null; - public synchronized void addToBuilder(FOTreeBuilder builder) { - try { - if (foObjs == null) { - // this sets the parser that will be used - // by default (SVGBrokenLinkProvider) - // normally the user agent value is used - XMLResourceDescriptor.setXMLParserClassName( - Driver.getParserClassName()); - - foObjs = new HashMap(); - foObjs.put("svg", new SE()); - foObjs.put(DEFAULT, new SVGMaker()); - } + private static synchronized void setupSVG() { + if (foObjs == null) { + // this sets the parser that will be used + // by default (SVGBrokenLinkProvider) + // normally the user agent value is used + XMLResourceDescriptor.setXMLParserClassName( + Driver.getParserClassName()); + + foObjs = new HashMap(); + foObjs.put("svg", new SE()); + foObjs.put(DEFAULT, new SVGMaker()); + } + } + public void addToBuilder(FOTreeBuilder builder) { + try { + setupSVG(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; builder.addMapping(svgNS, foObjs); } catch (Throwable t) { @@ -42,13 +45,13 @@ public class SVGElementMapping implements ElementMapping { } } - class SVGMaker extends ElementMapping.Maker { + static class SVGMaker extends ElementMapping.Maker { public FONode make(FONode parent) { return new SVGObj(parent); } } - class SE extends ElementMapping.Maker { + static class SE extends ElementMapping.Maker { public FONode make(FONode parent) { return new SVGElement(parent); } |