1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sourceforge.jeuclid.elements.presentation.general;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import net.sourceforge.jeuclid.LayoutContext;
25 import net.sourceforge.jeuclid.context.InlineLayoutContext;
26 import net.sourceforge.jeuclid.context.RelativeScriptlevelLayoutContext;
27 import net.sourceforge.jeuclid.layout.LayoutableNode;
28
29 import org.apache.batik.dom.AbstractDocument;
30 import org.w3c.dom.Node;
31 import org.w3c.dom.mathml.MathMLElement;
32
33
34
35
36
37
38 public final class Mroot extends AbstractRoot {
39
40
41
42
43 public static final String ELEMENT = "mroot";
44
45 private static final long serialVersionUID = 1L;
46
47
48
49
50
51
52
53
54
55 public Mroot(final String qname, final AbstractDocument odoc) {
56 super(qname, odoc);
57 }
58
59
60 @Override
61 protected Node newNode() {
62 return new Mroot(this.nodeName, this.ownerDocument);
63 }
64
65
66 @Override
67 protected List<LayoutableNode> getContent() {
68 final List<LayoutableNode> mList = new ArrayList<LayoutableNode>(1);
69 mList.add((LayoutableNode) this.getRadicand());
70 return mList;
71 }
72
73
74 public MathMLElement getIndex() {
75 return this.getMathElement(1);
76 }
77
78
79 public MathMLElement getRadicand() {
80 return this.getMathElement(0);
81 }
82
83
84 public void setIndex(final MathMLElement index) {
85 this.setMathElement(1, index);
86 }
87
88
89 public void setRadicand(final MathMLElement radicand) {
90 this.setMathElement(0, radicand);
91 }
92
93
94 @Override
95 public LayoutContext getChildLayoutContext(final int childNum,
96 final LayoutContext context) {
97 final LayoutContext now = this.applyLocalAttributesToContext(context);
98 if (childNum == 0) {
99 return now;
100 } else {
101
102 return new RelativeScriptlevelLayoutContext(
103 new InlineLayoutContext(now), 2);
104 }
105 }
106
107 }