diff options
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java')
-rwxr-xr-x | collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java | 118 |
1 files changed, 67 insertions, 51 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java index 98ad6ee740..f92b5cab08 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java @@ -22,58 +22,74 @@ package org.apache.tuscany.sca.impl.artifacts; import org.w3c.dom.Document; import org.w3c.dom.Element; -public class ServiceArtifact extends Artifact{ +public class ServiceArtifact extends Artifact { - + /** + * In a Service the (x,y) coordinates refers to the top corner edge of the polygon + * (x,y)______ + * \ \ + * \ \ + * / / + * /____ / + */ + public Element addElement(Document document, String svgNs, int x, int y, int height, int width) { - /** - * In a Service the (x,y) coordinates refers to the top corner edge of the polygon - * (x,y)______ - * \ \ - * \ \ - * / / - * /____ / - */ - public Element addElement(Document document, String svgNs, int x, int y, - int height, int width) { - - this.setHeight(height); - this.setWidth(width); - this.setxCoordinate(x); - this.setyCoordinate(y); - - int halfOfHeight = height/2; - - Element polygon = document.createElementNS(svgNs, "polygon"); - polygon.setAttributeNS(null, "points", - ""+ x +","+y+" " + - ""+ (x+2*halfOfHeight) +","+(y)+" " + - ""+ (x+3*halfOfHeight) +","+(y+halfOfHeight)+" " + - ""+ (x+2*halfOfHeight) +","+(y+2*halfOfHeight)+" " + - ""+ (x) +","+(y+2*halfOfHeight)+" " + - ""+ (x+halfOfHeight) +","+(y+halfOfHeight)+" " - ); - - polygon.setAttributeNS(null, "fill", "#00CD66"); - polygon.setAttributeNS(null, "stroke", "#008B45"); - - return polygon; - } - - /** - * Width is 3/2 times of the height - * @param document - * @param svgNs - * @param x - * @param y - * @param height - * @return - */ - public Element addElement(Document document, String svgNs, int x, int y, - int height) { - - return this.addElement(document, svgNs, x, y, height, height*3/2); - } + this.setHeight(height); + this.setWidth(width); + this.setxCoordinate(x); + this.setyCoordinate(y); + + int halfOfHeight = height / 2; + + Element polygon = document.createElementNS(svgNs, "polygon"); + polygon.setAttributeNS(null, "points", "" + x + + "," + + y + + " " + + "" + + (x + 2 * halfOfHeight) + + "," + + (y) + + " " + + "" + + (x + 3 * halfOfHeight) + + "," + + (y + halfOfHeight) + + " " + + "" + + (x + 2 * halfOfHeight) + + "," + + (y + 2 * halfOfHeight) + + " " + + "" + + (x) + + "," + + (y + 2 * halfOfHeight) + + " " + + "" + + (x + halfOfHeight) + + "," + + (y + halfOfHeight) + + " "); + + polygon.setAttributeNS(null, "fill", "#00CD66"); + polygon.setAttributeNS(null, "stroke", "#008B45"); + + return polygon; + } + + /** + * Width is 3/2 times of the height + * @param document + * @param svgNs + * @param x + * @param y + * @param height + * @return + */ + public Element addElement(Document document, String svgNs, int x, int y, int height) { + + return this.addElement(document, svgNs, x, y, height, height * 3 / 2); + } - } |