1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package net.sourceforge.jeuclid.fop;
29
30 import java.util.HashMap;
31
32 import net.sourceforge.jeuclid.elements.AbstractJEuclidElement;
33
34 import org.apache.fop.fo.ElementMapping;
35 import org.apache.fop.fo.FONode;
36 import org.w3c.dom.DOMImplementation;
37
38
39
40
41
42
43 public class JEuclidElementMapping extends ElementMapping {
44
45
46 public JEuclidElementMapping() {
47 this.namespaceURI = AbstractJEuclidElement.URI;
48 }
49
50
51 @Override
52 public DOMImplementation getDOMImplementation() {
53 return ElementMapping.getDefaultDOMImplementation();
54 }
55
56
57 @SuppressWarnings("unchecked")
58 @Override
59 protected void initialize() {
60 if (this.foObjs == null) {
61 this.foObjs = new HashMap();
62 this.foObjs.put("math", new ME());
63 this.foObjs.put(ElementMapping.DEFAULT, new MathMLMaker());
64
65 }
66 }
67
68 static final class MathMLMaker extends ElementMapping.Maker {
69
70 private MathMLMaker() {
71 }
72
73 @Override
74 public FONode make(final FONode parent) {
75 return new JEuclidObj(parent);
76 }
77 }
78
79 static final class ME extends ElementMapping.Maker {
80
81 private ME() {
82 }
83
84 @Override
85 public FONode make(final FONode parent) {
86 return new JEuclidElement(parent);
87 }
88 }
89
90 }