| 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 | 12 | super(name, Fill.OFF, FillColor.WHITE, stroke, strokeColor); |
| 41 | 12 | this.text = text; |
| 42 | 12 | this.x = x; |
| 43 | 12 | this.y = y; |
| 44 | 12 | this.font = font; |
| 45 | 12 | this.textSize = textSize; |
| 46 | 12 | } |
| 47 | |
|
| 48 | |
public Element getXML(Document doc) { |
| 49 | 12 | Element textElement = createElement(doc, "text"); |
| 50 | 12 | textElement.setAttribute("x", Integer.toString(getX())); |
| 51 | 12 | textElement.setAttribute("y", Integer.toString(getY())); |
| 52 | 12 | textElement.setAttribute("font", getFont()); |
| 53 | 12 | textElement.setAttribute("textsize", Integer.toString(getTextSize())); |
| 54 | 12 | Text textNode = doc.createTextNode(XMLUtil.makeXMLSafe(getText())); |
| 55 | 12 | textElement.appendChild(textNode); |
| 56 | 12 | return textElement; |
| 57 | |
} |
| 58 | |
|
| 59 | |
public String getText() { |
| 60 | 12 | return text; |
| 61 | |
} |
| 62 | |
|
| 63 | |
public int getX() { |
| 64 | 12 | return x; |
| 65 | |
} |
| 66 | |
|
| 67 | |
public int getY() { |
| 68 | 12 | return y; |
| 69 | |
} |
| 70 | |
|
| 71 | |
public String getFont() { |
| 72 | 12 | return font; |
| 73 | |
} |
| 74 | |
|
| 75 | |
public int getTextSize() { |
| 76 | 12 | return textSize; |
| 77 | |
} |
| 78 | |
} |