summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts
diff options
context:
space:
mode:
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts')
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java176
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java70
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java58
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java42
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java111
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java63
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java20
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java38
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java66
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java98
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java118
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java23
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java94
13 files changed, 512 insertions, 465 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java
index a2093dbf10..691d9da8d6 100644
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java
@@ -24,87 +24,97 @@ import org.w3c.dom.Element;
public abstract class Artifact {
- private String name;
- private String containerName;
- private int height;
- private int width;
- private int xCoordinate;
- private int yCoordinate;
- private Document doc;
- private String svgNs;
- private static final String ROUND_CORNER = "20" ;
-
- /**
- * Abstract method
- * @param document DOM document
- * @param svgNs namespace URI
- * @param x x-coordinate
- * @param y y-coordinate
- * @param height height of the shape
- * @param width width of the shape
- * @return DOM Element
- */
- public abstract Element addElement(Document document, String svgNs,
- int x, int y, int height, int width);
-
-// public abstract Element addElement(Document document, String svgNs,
-// int x, int y);
-
- public int getHeight() {
- return height;
- }
- public void setHeight(int height) {
- this.height = height;
- }
- public int getWidth() {
- return width;
- }
- public void setWidth(int width) {
- this.width = width;
- }
- public int getxCoordinate() {
- return xCoordinate;
- }
- public void setxCoordinate(int xCoordinate) {
- this.xCoordinate = xCoordinate;
- }
- public int getyCoordinate() {
- return yCoordinate;
- }
- public void setyCoordinate(int yCoordinate) {
- this.yCoordinate = yCoordinate;
- }
- public Document getDoc() {
- return doc;
- }
- public void setDoc(Document doc) {
- this.doc = doc;
- }
- public String getSvgNs() {
- return svgNs;
- }
- public void setSvgNs(String svgNs) {
- this.svgNs = svgNs;
- }
-
- public static String getRoundCorner() {
- return ROUND_CORNER;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setContainerName(String containerName) {
- this.containerName = containerName;
- }
-
- public String getContainerName() {
- return containerName;
- }
-
+ private String name;
+ private String containerName;
+ private int height;
+ private int width;
+ private int xCoordinate;
+ private int yCoordinate;
+ private Document doc;
+ private String svgNs;
+ private static final String ROUND_CORNER = "20";
+
+ /**
+ * Abstract method
+ * @param document DOM document
+ * @param svgNs namespace URI
+ * @param x x-coordinate
+ * @param y y-coordinate
+ * @param height height of the shape
+ * @param width width of the shape
+ * @return DOM Element
+ */
+ public abstract Element addElement(Document document, String svgNs, int x, int y, int height, int width);
+
+ // public abstract Element addElement(Document document, String svgNs,
+ // int x, int y);
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getxCoordinate() {
+ return xCoordinate;
+ }
+
+ public void setxCoordinate(int xCoordinate) {
+ this.xCoordinate = xCoordinate;
+ }
+
+ public int getyCoordinate() {
+ return yCoordinate;
+ }
+
+ public void setyCoordinate(int yCoordinate) {
+ this.yCoordinate = yCoordinate;
+ }
+
+ public Document getDoc() {
+ return doc;
+ }
+
+ public void setDoc(Document doc) {
+ this.doc = doc;
+ }
+
+ public String getSvgNs() {
+ return svgNs;
+ }
+
+ public void setSvgNs(String svgNs) {
+ this.svgNs = svgNs;
+ }
+
+ public static String getRoundCorner() {
+ return ROUND_CORNER;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
+
+ public String getContainerName() {
+ return containerName;
+ }
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java
index ae81ad8cda..e2373cf1f5 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java
@@ -22,40 +22,38 @@ package org.apache.tuscany.sca.impl.artifacts;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class ComponentArtifact extends Artifact{
-
-
- /**
- * Create an element with specified height and width
- */
- 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);
-
- Element rectangle = document.createElementNS(svgNs, "rect");
- rectangle.setAttributeNS(null, "x", x+"");
- rectangle.setAttributeNS(null, "y", y+"");
- rectangle.setAttributeNS(null, "rx", getRoundCorner());
- rectangle.setAttributeNS(null, "ry", getRoundCorner());
- rectangle.setAttributeNS(null, "width", width+"");
- rectangle.setAttributeNS(null, "height", height+"");
- rectangle.setAttributeNS(null, "fill", "#3D59AB");
- rectangle.setAttributeNS(null, "stroke", "#104E8B");
- rectangle.setAttributeNS(null, "fill-opacity", "0.75");
- return rectangle;
- }
-
- /**
- * Create an element with default height and width
- */
- public Element addElement(Document document, String svgNs, int x, int y) {
-
- return addElement(document, svgNs, x, y, Constant.COMPONENT_DEFAULT_HEIGHT, Constant.COMPONENT_DEFAULT_WIDTH);
-
- }
-
+public class ComponentArtifact extends Artifact {
+
+ /**
+ * Create an element with specified height and width
+ */
+ 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);
+
+ Element rectangle = document.createElementNS(svgNs, "rect");
+ rectangle.setAttributeNS(null, "x", x + "");
+ rectangle.setAttributeNS(null, "y", y + "");
+ rectangle.setAttributeNS(null, "rx", getRoundCorner());
+ rectangle.setAttributeNS(null, "ry", getRoundCorner());
+ rectangle.setAttributeNS(null, "width", width + "");
+ rectangle.setAttributeNS(null, "height", height + "");
+ rectangle.setAttributeNS(null, "fill", "#3D59AB");
+ rectangle.setAttributeNS(null, "stroke", "#104E8B");
+ rectangle.setAttributeNS(null, "fill-opacity", "0.75");
+ return rectangle;
+ }
+
+ /**
+ * Create an element with default height and width
+ */
+ public Element addElement(Document document, String svgNs, int x, int y) {
+
+ return addElement(document, svgNs, x, y, Constant.COMPONENT_DEFAULT_HEIGHT, Constant.COMPONENT_DEFAULT_WIDTH);
+
+ }
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java
index af2a525577..0496f7c6cc 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java
@@ -26,34 +26,32 @@ import org.w3c.dom.Element;
* Structure of a "Composite" element in SCA, as a SVG element
*
*/
-public class CompositeArtifact extends Artifact{
-
-
- 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);
-
- Element rectangle = document.createElementNS(svgNs, "rect");
- rectangle.setAttributeNS(null, "x", x+"");
- rectangle.setAttributeNS(null, "y", y+"");
- rectangle.setAttributeNS(null, "rx", getRoundCorner());
- rectangle.setAttributeNS(null, "ry", getRoundCorner());
- rectangle.setAttributeNS(null, "width", width+"");
- rectangle.setAttributeNS(null, "height", height+"");
- rectangle.setAttributeNS(null, "fill", "#E5E5E5");
- rectangle.setAttributeNS(null, "stroke", "#919191");
- rectangle.setAttributeNS(null, "alignment-baseline", "middle");
-
- return rectangle;
- }
-
-// //OBSOLETE
-// public Element addElement(Document document, String svgNs, int x, int y) {
-// return null;
-// }
-
+public class CompositeArtifact extends Artifact {
+
+ 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);
+
+ Element rectangle = document.createElementNS(svgNs, "rect");
+ rectangle.setAttributeNS(null, "x", x + "");
+ rectangle.setAttributeNS(null, "y", y + "");
+ rectangle.setAttributeNS(null, "rx", getRoundCorner());
+ rectangle.setAttributeNS(null, "ry", getRoundCorner());
+ rectangle.setAttributeNS(null, "width", width + "");
+ rectangle.setAttributeNS(null, "height", height + "");
+ rectangle.setAttributeNS(null, "fill", "#E5E5E5");
+ rectangle.setAttributeNS(null, "stroke", "#919191");
+ rectangle.setAttributeNS(null, "alignment-baseline", "middle");
+
+ return rectangle;
+ }
+
+ // //OBSOLETE
+ // public Element addElement(Document document, String svgNs, int x, int y) {
+ // return null;
+ // }
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
index a08fedfd49..a2b2a93647 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
@@ -1,26 +1,26 @@
package org.apache.tuscany.sca.impl.artifacts;
public final class Constant {
-
- public static final int COMPONENT_DEFAULT_WIDTH = 200 ;
- public static final int COMPONENT_DEFAULT_HEIGHT = 130 ;
- public static final int COMPONENT_TEXT_SPACING = 20 ;
-
- public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_PROPERTY = 20 ;
- public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY = 60 ;
- public static final int SPACING_FOR_COMPONENT_OF_PROPERTY = 20 ;
- public static final int SPACING_FOR_COMPOSITE_OF_PROPERTY = 60 ;
-
- public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_REFERENCE = 30 ;
- public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE = 90 ;
- public static final int SPACING_FOR_COMPONENT_OF_REFERENCE = 10 ;
- public static final int SPACING_FOR_COMPOSITE_OF_REFERENCE = 50 ;
-
- public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_SERVICE = 30 ;
- public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE = 90 ;
- public static final int SPACING_FOR_COMPONENT_OF_SERVICE = 10 ;
- public static final int SPACING_FOR_COMPOSITE_OF_SERVICE = 50 ;
-
- public static final int SPACING_FOR_TEXT = 1 ;
+
+ public static final int COMPONENT_DEFAULT_WIDTH = 200;
+ public static final int COMPONENT_DEFAULT_HEIGHT = 130;
+ public static final int COMPONENT_TEXT_SPACING = 20;
+
+ public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_PROPERTY = 20;
+ public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY = 60;
+ public static final int SPACING_FOR_COMPONENT_OF_PROPERTY = 20;
+ public static final int SPACING_FOR_COMPOSITE_OF_PROPERTY = 60;
+
+ public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_REFERENCE = 30;
+ public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE = 90;
+ public static final int SPACING_FOR_COMPONENT_OF_REFERENCE = 10;
+ public static final int SPACING_FOR_COMPOSITE_OF_REFERENCE = 50;
+
+ public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_SERVICE = 30;
+ public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE = 90;
+ public static final int SPACING_FOR_COMPONENT_OF_SERVICE = 10;
+ public static final int SPACING_FOR_COMPOSITE_OF_SERVICE = 50;
+
+ public static final int SPACING_FOR_TEXT = 1;
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
index 70c8882c2b..0169cf9936 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
@@ -22,63 +22,60 @@ package org.apache.tuscany.sca.impl.artifacts;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class DashedWire extends WireArtifact{
-
- @Override
- public Element addElement(Document document, String svgNs, Object a,
- Object b, int changingFactor, String color) {
-
- Element polyline = document.createElementNS(svgNs, "polyline");
- int x1=0,x2=0,y1=0,y2=0;
-
- if(a instanceof ServiceArtifact && b instanceof ServiceArtifact){
-
- ServiceArtifact aService1 = (ServiceArtifact)a;
- ServiceArtifact aService2 = (ServiceArtifact)b;
-
- x1=aService1.getxCoordinate()+aService1.getHeight()*3/2;
- y1=aService1.getyCoordinate()+aService1.getHeight()/2;
-
- x2=aService2.getxCoordinate()+aService2.getHeight()/2;
- y2=aService2.getyCoordinate()+aService2.getHeight()/2;
-
- }
-
- else if(a instanceof ReferenceArtifact && b instanceof ReferenceArtifact){
-
- ReferenceArtifact aReference1 = (ReferenceArtifact)a;
- ReferenceArtifact aReference2 = (ReferenceArtifact)b;
-
- x1=aReference1.getxCoordinate()+aReference1.getHeight()*3/2;
- y1=aReference1.getyCoordinate()+aReference1.getHeight()/2;
-
- x2=aReference2.getxCoordinate()+aReference2.getHeight()/2;
- y2=aReference2.getyCoordinate()+aReference2.getHeight()/2;
-
- }
-
- polyline = setWireAttributes(x1, y1, x2, y2, polyline, changingFactor, color);
-
- polyline.setAttributeNS(null, "stroke-dasharray", "3 3");
-
- return polyline;
- }
-
-
- /**
- * <script type="text/ecmascript"><![CDATA[
- <SCRIPT LANGUAGE="JavaScript">
-
-var test = document.open("store_diagram.svg");
-
-</SCRIPT>
- ]]></script>
-
-<!--rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1400" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="360" stroke="#919191"/><text x="700" font-size="20" dominant-baseline="mathematical" y="120" text-anchor="middle">
-
-<a xlink:href="store_diagram.svg" xlink:show="new">MyValueComposite2</a></text-->
-
- */
+public class DashedWire extends WireArtifact {
+ @Override
+ public Element addElement(Document document, String svgNs, Object a, Object b, int changingFactor, String color) {
+
+ Element polyline = document.createElementNS(svgNs, "polyline");
+ int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+
+ if (a instanceof ServiceArtifact && b instanceof ServiceArtifact) {
+
+ ServiceArtifact aService1 = (ServiceArtifact)a;
+ ServiceArtifact aService2 = (ServiceArtifact)b;
+
+ x1 = aService1.getxCoordinate() + aService1.getHeight() * 3 / 2;
+ y1 = aService1.getyCoordinate() + aService1.getHeight() / 2;
+
+ x2 = aService2.getxCoordinate() + aService2.getHeight() / 2;
+ y2 = aService2.getyCoordinate() + aService2.getHeight() / 2;
+
+ }
+
+ else if (a instanceof ReferenceArtifact && b instanceof ReferenceArtifact) {
+
+ ReferenceArtifact aReference1 = (ReferenceArtifact)a;
+ ReferenceArtifact aReference2 = (ReferenceArtifact)b;
+
+ x1 = aReference1.getxCoordinate() + aReference1.getHeight() * 3 / 2;
+ y1 = aReference1.getyCoordinate() + aReference1.getHeight() / 2;
+
+ x2 = aReference2.getxCoordinate() + aReference2.getHeight() / 2;
+ y2 = aReference2.getyCoordinate() + aReference2.getHeight() / 2;
+
+ }
+
+ polyline = setWireAttributes(x1, y1, x2, y2, polyline, changingFactor, color);
+
+ polyline.setAttributeNS(null, "stroke-dasharray", "3 3");
+
+ return polyline;
+ }
+
+ /**
+ * <script type="text/ecmascript"><![CDATA[
+ <SCRIPT LANGUAGE="JavaScript">
+
+ var test = document.open("store_diagram.svg");
+
+ </SCRIPT>
+ ]]></script>
+
+ <!--rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1400" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="360" stroke="#919191"/><text x="700" font-size="20" dominant-baseline="mathematical" y="120" text-anchor="middle">
+
+ <a xlink:href="store_diagram.svg" xlink:show="new">MyValueComposite2</a></text-->
+
+ */
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java
index 0a1ca90c1d..c3a41140f8 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java
@@ -26,38 +26,35 @@ import org.w3c.dom.Element;
* Structure of a "Outermost layer" : not a SCA artifact
*
*/
-public class Layer extends Artifact{
-
-
- 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);
-
- Element rectangle = document.createElementNS(svgNs, "rect");
- rectangle.setAttributeNS(null, "x", x+"");
- rectangle.setAttributeNS(null, "y", y+"");
- rectangle.setAttributeNS(null, "rx", getRoundCorner());
- rectangle.setAttributeNS(null, "ry", getRoundCorner());
- rectangle.setAttributeNS(null, "width", width+"");
- rectangle.setAttributeNS(null, "height", height+"");
- rectangle.setAttributeNS(null, "fill", "#E5E5D0");
- rectangle.setAttributeNS(null, "stroke", "#919191");
- rectangle.setAttributeNS(null, "alignment-baseline", "middle");
-
- return rectangle;
- }
-
- public Element addElement(Document document, String svgNs, int x, int y,
- int height, int width, String fillColor) {
-
- Element rect = addElement(document, svgNs, x, y, height, width);
- rect.setAttributeNS(null, "fill", fillColor);
-
- return rect;
- }
+public class Layer extends Artifact {
+
+ 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);
+
+ Element rectangle = document.createElementNS(svgNs, "rect");
+ rectangle.setAttributeNS(null, "x", x + "");
+ rectangle.setAttributeNS(null, "y", y + "");
+ rectangle.setAttributeNS(null, "rx", getRoundCorner());
+ rectangle.setAttributeNS(null, "ry", getRoundCorner());
+ rectangle.setAttributeNS(null, "width", width + "");
+ rectangle.setAttributeNS(null, "height", height + "");
+ rectangle.setAttributeNS(null, "fill", "#E5E5D0");
+ rectangle.setAttributeNS(null, "stroke", "#919191");
+ rectangle.setAttributeNS(null, "alignment-baseline", "middle");
+
+ return rectangle;
+ }
+
+ public Element addElement(Document document, String svgNs, int x, int y, int height, int width, String fillColor) {
+
+ Element rect = addElement(document, svgNs, x, y, height, width);
+ rect.setAttributeNS(null, "fill", fillColor);
+
+ return rect;
+ }
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java
index e03edfd0e2..533c718595 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java
@@ -28,14 +28,14 @@ import org.w3c.dom.Element;
*/
public class Link {
- public Element addElement(Document document, String svgNs, String fileName, String compName) {
-
- Element link = document.createElementNS(svgNs, "a");
- link.setAttributeNS(null, "xlink:href", fileName);
- link.setAttributeNS(null, "xlink:show", "new");
- link.setTextContent(" "+compName + " ,");
-
- return link;
- }
-
+ public Element addElement(Document document, String svgNs, String fileName, String compName) {
+
+ Element link = document.createElementNS(svgNs, "a");
+ link.setAttributeNS(null, "xlink:href", fileName);
+ link.setAttributeNS(null, "xlink:show", "new");
+ link.setTextContent(" " + compName + " ,");
+
+ return link;
+ }
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
index 517bea1980..69d7bb4a60 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
@@ -22,26 +22,24 @@ package org.apache.tuscany.sca.impl.artifacts;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class NormalWire extends WireArtifact{
-
- @Override
- public Element addElement(Document document, String svgNs, Object a,
- Object b, int changingFactor, String color) {
-
- ReferenceArtifact aReference = (ReferenceArtifact)a;
- ServiceArtifact aService = (ServiceArtifact)b;
-
- Element polyline = document.createElementNS(svgNs, "polyline");
- int x1=aReference.getxCoordinate()+aReference.getHeight()*3/2;
- int y1=aReference.getyCoordinate()+aReference.getHeight()/2;
-
- int x2=aService.getxCoordinate()+aService.getHeight()/2;
- int y2=aService.getyCoordinate()+aService.getHeight()/2;
-
- polyline = setWireAttributes(x1, y1, x2, y2, polyline, changingFactor, color);
-
- return polyline;
- }
+public class NormalWire extends WireArtifact {
+ @Override
+ public Element addElement(Document document, String svgNs, Object a, Object b, int changingFactor, String color) {
+
+ ReferenceArtifact aReference = (ReferenceArtifact)a;
+ ServiceArtifact aService = (ServiceArtifact)b;
+
+ Element polyline = document.createElementNS(svgNs, "polyline");
+ int x1 = aReference.getxCoordinate() + aReference.getHeight() * 3 / 2;
+ int y1 = aReference.getyCoordinate() + aReference.getHeight() / 2;
+
+ int x2 = aService.getxCoordinate() + aService.getHeight() / 2;
+ int y2 = aService.getyCoordinate() + aService.getHeight() / 2;
+
+ polyline = setWireAttributes(x1, y1, x2, y2, polyline, changingFactor, color);
+
+ return polyline;
+ }
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java
index f1151f8b57..d9bad6e017 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java
@@ -22,41 +22,37 @@ package org.apache.tuscany.sca.impl.artifacts;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class PropertyArtifact extends Artifact{
-
- /**
- * Property is a square.
- * ___
- * | |
- * |___|
- *
- */
- 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);
-
- Element rectangle = document.createElementNS(svgNs, "rect");
- rectangle.setAttributeNS(null, "x", x+"");
- rectangle.setAttributeNS(null, "y", y+"");
- rectangle.setAttributeNS(null, "width", height+"");
- rectangle.setAttributeNS(null, "height", height+"");
- rectangle.setAttributeNS(null, "fill", "#EEEE00");
- rectangle.setAttributeNS(null, "stroke", "#EEC900");
- //rectangle.setAttributeNS(null, "fill-opacity", "0.75");
-
- return rectangle;
- }
-
-
- public Element addElement(Document document, String svgNs, int x, int y,
- int height) {
-
- return addElement(document, svgNs, x, y, height, height);
- }
+public class PropertyArtifact extends Artifact {
+ /**
+ * Property is a square.
+ * ___
+ * | |
+ * |___|
+ *
+ */
+ 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);
+
+ Element rectangle = document.createElementNS(svgNs, "rect");
+ rectangle.setAttributeNS(null, "x", x + "");
+ rectangle.setAttributeNS(null, "y", y + "");
+ rectangle.setAttributeNS(null, "width", height + "");
+ rectangle.setAttributeNS(null, "height", height + "");
+ rectangle.setAttributeNS(null, "fill", "#EEEE00");
+ rectangle.setAttributeNS(null, "stroke", "#EEC900");
+ //rectangle.setAttributeNS(null, "fill-opacity", "0.75");
+
+ return rectangle;
+ }
+
+ public Element addElement(Document document, String svgNs, int x, int y, int height) {
+
+ return addElement(document, svgNs, x, y, height, height);
+ }
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java
index 5001f4908e..27a5a426ee 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java
@@ -23,48 +23,64 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class ReferenceArtifact extends Artifact {
-
- /**
- * In a Reference 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 Reference 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", "#BF3EFF");
- polygon.setAttributeNS(null, "stroke", "#68228B");
-
- return polygon;
- }
-
-
- 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", "#BF3EFF");
+ polygon.setAttributeNS(null, "stroke", "#68228B");
+
+ return polygon;
+ }
+
+ public Element addElement(Document document, String svgNs, int x, int y, int height) {
+
+ return this.addElement(document, svgNs, x, y, height, height * 3 / 2);
+ }
}
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);
+ }
-
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
index 40edf226c0..976ccb547f 100644
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
@@ -24,16 +24,15 @@ 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", "15");
- text.setTextContent(content);
-
- return 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", "15");
+ text.setTextContent(content);
+
+ return text;
+ }
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java
index ef179b9a70..4703abb80d 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java
@@ -23,42 +23,64 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public abstract class WireArtifact {
-
- public abstract Element addElement(Document document, String svgNs,
- Object a, Object b, int changingFactor, String color);
-
- public Element setWireAttributes(int x1, int y1, int x2, int y2,
- Element polyline, int changingFactor, String color){
-
- if(y1 == y2 && x2>x1){
- polyline.setAttributeNS(null, "points", x1+","+
- y1+" "+x2+","+y2
- );
- }
- else if(y1 == y2 && x1>x2){
- polyline.setAttributeNS(null, "points", x1+","+
- y1+" "+(x1+changingFactor)+","+y1
- +" "+(x1+changingFactor)+","+(y1-(changingFactor*2))
- +" "+(x2-changingFactor)+","+(y1-(changingFactor*2))
- +" "+(x2-changingFactor)+","+(y1)
- +" "+(x2)+","+(y1)
- );
-
- }
- else{
- polyline.setAttributeNS(null, "points", x1+","+
- y1+" "+(x1+changingFactor)+","+y1
- +" "+(x1+changingFactor)+","+y2
- +" "+x2+","+y2
- );
- }
-
- polyline.setAttributeNS(null, "stroke", color);
- polyline.setAttributeNS(null, "stroke-width", "2");
- polyline.setAttributeNS(null, "fill", "none");
-
- return polyline;
- }
+ public abstract Element addElement(Document document,
+ String svgNs,
+ Object a,
+ Object b,
+ int changingFactor,
+ String color);
+
+ public Element setWireAttributes(int x1, int y1, int x2, int y2, Element polyline, int changingFactor, String color) {
+
+ if (y1 == y2 && x2 > x1) {
+ polyline.setAttributeNS(null, "points", x1 + "," + y1 + " " + x2 + "," + y2);
+ } else if (y1 == y2 && x1 > x2) {
+ polyline.setAttributeNS(null, "points", x1 + ","
+ + y1
+ + " "
+ + (x1 + changingFactor)
+ + ","
+ + y1
+ + " "
+ + (x1 + changingFactor)
+ + ","
+ + (y1 - (changingFactor * 2))
+ + " "
+ + (x2 - changingFactor)
+ + ","
+ + (y1 - (changingFactor * 2))
+ + " "
+ + (x2 - changingFactor)
+ + ","
+ + (y1)
+ + " "
+ + (x2)
+ + ","
+ + (y1));
+
+ } else {
+ polyline.setAttributeNS(null, "points", x1 + ","
+ + y1
+ + " "
+ + (x1 + changingFactor)
+ + ","
+ + y1
+ + " "
+ + (x1 + changingFactor)
+ + ","
+ + y2
+ + " "
+ + x2
+ + ","
+ + y2);
+ }
+
+ polyline.setAttributeNS(null, "stroke", color);
+ polyline.setAttributeNS(null, "stroke-width", "2");
+ polyline.setAttributeNS(null, "fill", "none");
+
+ return polyline;
+ }
}