1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package th.co.edge.jseq.argouml.pgml;
24
25 import org.w3c.dom.Document;
26 import org.w3c.dom.Element;
27 import org.w3c.dom.Text;
28
29 import th.co.edge.jseq.util.XMLUtil;
30
31 public class FigText extends Fig {
32 String text;
33 int x;
34 int y;
35 String font;
36 int textSize;
37
38 public FigText(String name, String text, int x, int y, String font,
39 int textSize, Stroke stroke, StrokeColor strokeColor) {
40 super(name, Fill.OFF, FillColor.WHITE, stroke, strokeColor);
41 this.text = text;
42 this.x = x;
43 this.y = y;
44 this.font = font;
45 this.textSize = textSize;
46 }
47
48 public Element getXML(Document doc) {
49 Element textElement = createElement(doc, "text");
50 textElement.setAttribute("x", Integer.toString(getX()));
51 textElement.setAttribute("y", Integer.toString(getY()));
52 textElement.setAttribute("font", getFont());
53 textElement.setAttribute("textsize", Integer.toString(getTextSize()));
54 Text textNode = doc.createTextNode(XMLUtil.makeXMLSafe(getText()));
55 textElement.appendChild(textNode);
56 return textElement;
57 }
58
59 public String getText() {
60 return text;
61 }
62
63 public int getX() {
64 return x;
65 }
66
67 public int getY() {
68 return y;
69 }
70
71 public String getFont() {
72 return font;
73 }
74
75 public int getTextSize() {
76 return textSize;
77 }
78 }