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.table;
20
21 import org.apache.batik.dom.AbstractDocument;
22 import org.w3c.dom.Node;
23 import org.w3c.dom.mathml.MathMLTableCellElement;
24
25
26
27
28
29
30 public final class Mtd extends AbstractTableElement implements
31 MathMLTableCellElement {
32
33
34
35
36 public static final String ELEMENT = "mtd";
37
38
39 private static final String ATTR_ROWSPAN = "rowspan";
40
41
42 private static final String ATTR_COLUMNSPAN = "columnspan";
43
44 private static final String VALUE_ONE = "1";
45
46 private static final long serialVersionUID = 1L;
47
48
49
50
51
52
53
54
55
56 public Mtd(final String qname, final AbstractDocument odoc) {
57 super(qname, odoc);
58
59 this.setDefaultMathAttribute(Mtd.ATTR_ROWSPAN, Mtd.VALUE_ONE);
60 this.setDefaultMathAttribute(Mtd.ATTR_COLUMNSPAN, Mtd.VALUE_ONE);
61 }
62
63
64 @Override
65 protected Node newNode() {
66 return new Mtd(this.nodeName, this.ownerDocument);
67 }
68
69
70
71
72 public String getRowspan() {
73 return this.getMathAttribute(Mtd.ATTR_ROWSPAN);
74 }
75
76
77
78
79
80 public void setRowspan(final String rowspan) {
81 this.setAttribute(Mtd.ATTR_ROWSPAN, rowspan);
82 }
83
84
85
86
87 public String getColumnspan() {
88 return this.getMathAttribute(Mtd.ATTR_COLUMNSPAN);
89 }
90
91
92
93
94
95 public void setColumnspan(final String columnspan) {
96 this.setAttribute(Mtd.ATTR_COLUMNSPAN, columnspan);
97 }
98
99
100 public String getCellindex() {
101 return Integer.toString(this.getParent().getIndexOfMathElement(this));
102 }
103
104
105 public boolean getHasaligngroups() {
106 return this.getGroupalign() != null;
107 }
108
109 }