summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
blob: 72d3aea69c220159b5b1ee7208f37ea09b0f0c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package org.apache.tuscany.sca.impl.artifacts;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Text {

	public static Element addTextElement(Document document, 
			String svgNs, int x, int y, String content) {
		Element text = document.createElementNS(svgNs, "text");
		text.setAttributeNS(null, "x", x+"");
		text.setAttributeNS(null, "y", y+"");
		text.setAttributeNS(null, "text-anchor", "middle");
		text.setAttributeNS(null, "dominant-baseline", "mathematical");
		text.setAttributeNS(null, "font-size", "20");
		text.setTextContent(content);
		
		return text;
	}
}