tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r1164133 [1/3] - in /tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src: main/java/org/apache/tuscany/sca/diagram/ main/java/org/apache/tuscany/sca/diagram/artifacts/ main/java/org/apache/tuscany/sca/diagram/gene...
Date Thu, 01 Sep 2011 16:22:39 GMT
Author: rfeng
Date: Thu Sep  1 16:22:37 2011
New Revision: 1164133

URL: http://svn.apache.org/viewvc?rev=1164133&view=rev
Log:
Rename packages to reflect the functions

Added:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/ComponentEntity.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/CompositeEntity.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/Entity.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/EntityBuilder.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/LayoutBuilder.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/layout/TuscanyCompositeEntityBuilder.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/main/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/main/Main.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/test/java/org/apache/tuscany/sca/diagram/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/test/java/org/apache/tuscany/sca/diagram/layout/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/test/java/org/apache/tuscany/sca/diagram/layout/LayoutBuilderTestCase.java   (with props)
Modified:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/io/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+import org.w3c.dom.Document;
+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;
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Artifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.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);
+
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ComponentArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+import org.w3c.dom.Document;
+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;
+    //	}
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/CompositeArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,26 @@
+package org.apache.tuscany.sca.diagram.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;
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Constant.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.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--> 
+
+     */
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/DashedWire.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+import org.w3c.dom.Document;
+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;
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Layer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * An "a" element to link two SVG diagrams: not a SCA artifact
+ *
+ */
+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;
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Link.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.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;
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/NormalWire.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.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);
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/PropertyArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+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) {
+
+        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);
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ReferenceArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+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) {
+
+        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);
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/ServiceArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.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", "15");
+        text.setTextContent(content);
+
+        return text;
+    }
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/Text.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.artifacts;
+
+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;
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/artifacts/WireArtifact.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,602 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.generator;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.tuscany.sca.diagram.artifacts.ComponentArtifact;
+import org.apache.tuscany.sca.diagram.artifacts.CompositeArtifact;
+import org.apache.tuscany.sca.diagram.artifacts.Constant;
+import org.apache.tuscany.sca.diagram.artifacts.DashedWire;
+import org.apache.tuscany.sca.diagram.artifacts.Layer;
+import org.apache.tuscany.sca.diagram.artifacts.Link;
+import org.apache.tuscany.sca.diagram.artifacts.NormalWire;
+import org.apache.tuscany.sca.diagram.artifacts.PropertyArtifact;
+import org.apache.tuscany.sca.diagram.artifacts.ReferenceArtifact;
+import org.apache.tuscany.sca.diagram.artifacts.ServiceArtifact;
+import org.apache.tuscany.sca.diagram.artifacts.Text;
+import org.apache.tuscany.sca.diagram.artifacts.WireArtifact;
+import org.apache.tuscany.sca.diagram.layout.ComponentEntity;
+import org.apache.tuscany.sca.diagram.layout.CompositeEntity;
+import org.apache.tuscany.sca.diagram.layout.Entity;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class DiagramGenerator {
+
+    private CompositeEntity comp;
+    private Document doc;
+    private String svgNS;
+    private Element svgRoot;
+    private ArrayList<ReferenceArtifact> refs = new ArrayList<ReferenceArtifact>();
+    private ArrayList<ServiceArtifact> sers = new ArrayList<ServiceArtifact>();
+    private int diagramHeight, diagramWidth;
+
+    private boolean isHtml;
+
+    private int lastUsedChangingFactor = 0;
+
+    enum changingFactor {
+        a(20), b(25), c(30), d(35), e(40), f(15);
+
+        private final int val;
+
+        private changingFactor(int x) {
+            val = x;
+        }
+
+        public int getVal() {
+            return val;
+        }
+
+    };
+
+    enum color {
+        black
+    }//, violet, red, green};
+
+    private int previousWireColor = 0;
+
+    /**
+     * Constructor to generate a SVG diagram for a given CompositeEntity
+     * Object.
+     */
+    public DiagramGenerator(CompositeEntity comp, boolean isHtml) {
+
+        this.comp = comp;
+        this.isHtml = isHtml;
+
+    }
+
+    /**
+     * Draws the diagram.
+     */
+    public Document buildSVGDocument() {
+
+        DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
+        svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
+        doc = impl.createDocument(svgNS, "svg", null);
+
+        // Get the root element (the 'svg' element).
+        svgRoot = doc.getDocumentElement();
+
+        setDiagramHeight(comp.getHeight() + 200);
+        setDiagramWidth(comp.getWidth() + 400);
+
+        svgRoot.setAttributeNS(null, "viewBox", "0 0 " + getDiagramWidth() + " " + getDiagramHeight());
+
+        addLayer();
+        addComposite();
+
+        for (ComponentEntity ent : comp.getComponentList()) {
+
+            addComponent(ent);
+            addComponentProperties(ent);
+            addComponentService(ent);
+            addComponentReference(ent);
+        }
+
+        addCompositeProperties();
+        addCompositeService();
+        addCompositeReference();
+
+        addComponentConnections();
+        addReferencePromotion();
+        addServicePromotion();
+
+        addInclusions();
+
+        return doc;
+    }
+
+    private void addLayer() {
+
+        Layer outerLayer = new Layer();
+        Element layerElt = outerLayer.addElement(doc, svgNS, 0, 0, getDiagramHeight(), getDiagramWidth());
+        svgRoot.appendChild(layerElt);
+    }
+
+    private void addReferencePromotion() {
+
+        for (Iterator it = comp.getPromoteAReference().entrySet().iterator(); it.hasNext();) {
+            Entry entry = (Entry)it.next();
+            String compositeRef = (String)entry.getKey();
+            ArrayList<String> componentRef = (ArrayList<String>)entry.getValue();
+
+            ReferenceArtifact r1 = getRef(compositeRef);
+
+            for (String ref : componentRef) {
+
+                ReferenceArtifact r2 = getRef(ref);
+
+                if (r1 != null && r2 != null) {
+                    addWire(r2, r1);
+                }
+            }
+
+        }
+    }
+
+    private void addServicePromotion() {
+
+        for (Iterator it = comp.getPromoteAService().entrySet().iterator(); it.hasNext();) {
+            Entry entry = (Entry)it.next();
+            String compositeSer = (String)entry.getKey();
+            String componentSer = (String)entry.getValue();
+
+            ServiceArtifact s1 = getSer(compositeSer);
+            ServiceArtifact s2 = getSer(componentSer);
+
+            if (s1 != null && s2 != null) {
+                addWire(s1, s2);
+            }
+        }
+    }
+
+    private void addInclusions() {
+
+        if (!comp.getIncludedComposites().isEmpty()) {
+
+            Layer inclusionLayer = new Layer();
+            int constant = 5;
+            int x0 = comp.getX() + constant;
+            int y0 = comp.getY() + comp.getHeight() - (Constant.COMPONENT_DEFAULT_HEIGHT / 2 + constant);
+            int height = Constant.COMPONENT_DEFAULT_HEIGHT / 2;
+            int width = comp.getWidth() - constant * 2;
+
+            Element layerElt = inclusionLayer.addElement(doc, svgNS, x0, y0, height, width, "#E5E5C0");
+
+            Element text = Text.addTextElement(doc, svgNS, x0 + constant, y0 + constant * 2, "Included Composites");
+
+            svgRoot.appendChild(layerElt);
+            svgRoot.appendChild(text);
+
+            text = Text.addTextElement(doc, svgNS, x0 + constant, y0 + constant * 7, "");
+
+            String ext;
+
+            if (isHtml) {
+                ext = ".html";
+            } else {
+                ext = ".svg";
+            }
+
+            for (String includedComposite : comp.getIncludedComposites()) {
+
+                Link link = new Link();
+                Element aLink =
+                    link.addElement(doc, svgNS, includedComposite + comp.getFileNameSuffix() + ext, includedComposite);
+                text.appendChild(aLink);
+
+            }
+            svgRoot.appendChild(text);
+        }
+    }
+
+    /**
+     * Connects references to services.
+     */
+    private void addComponentConnections() {
+
+        for (Entity ent : comp.getComponentList()) {
+            //if(ent instanceof ComponentEntity){
+
+            for (Iterator it = ((ComponentEntity)ent).getReferenceToServiceMap().entrySet().iterator(); it.hasNext();) {
+                Entry entry = (Entry)it.next();
+                String ref = (String)entry.getKey();
+                String ser = (String)entry.getValue();
+
+                ReferenceArtifact r = getRef(ref);
+                ServiceArtifact s = getSer(ser);
+
+                if (r != null && s != null) {
+                    addWire(r, s);
+                }
+            }
+            //}
+        }
+    }
+
+    /**
+     * This is to remove overlapping of wire elements
+     */
+    private String getColor() {
+
+        previousWireColor = previousWireColor % color.values().length;
+        return color.values()[previousWireColor++].toString();
+    }
+
+    /**
+     * This is to remove overlapping of wire elements
+     */
+    private int getChangingFactor() {
+
+        lastUsedChangingFactor = lastUsedChangingFactor % changingFactor.values().length;
+        return changingFactor.values()[lastUsedChangingFactor++].getVal();
+
+    }
+
+    private void addWire(ReferenceArtifact r, ServiceArtifact s) {
+
+        WireArtifact edge = new NormalWire();
+        Element wire = edge.addElement(doc, svgNS, r, s, getChangingFactor(), getColor());
+        svgRoot.appendChild(wire);
+    }
+
+    private void addWire(ServiceArtifact s1, ServiceArtifact s2) {
+
+        DashedWire edge = new DashedWire();
+        Element wire = edge.addElement(doc, svgNS, s1, s2, getChangingFactor(), getColor());
+        svgRoot.appendChild(wire);
+    }
+
+    private void addWire(ReferenceArtifact r1, ReferenceArtifact r2) {
+
+        DashedWire edge = new DashedWire();
+        Element wire = edge.addElement(doc, svgNS, r1, r2, getChangingFactor(), getColor());
+        svgRoot.appendChild(wire);
+    }
+
+    private ServiceArtifact getSer(String ser) {
+
+        for (ServiceArtifact s : sers) {
+            if (s.getContainerName().equals(ser) || s.getName().equals(ser)) {
+                return s;
+            }
+        }
+        return null;
+    }
+
+    private ReferenceArtifact getRef(String ref) {
+
+        for (ReferenceArtifact r : refs) {
+
+            if (r.getContainerName().equals(ref) || r.getName().equals(ref)) {
+                return r;
+            }
+        }
+        return null;
+    }
+
+    private void addComponentProperties(ComponentEntity ent) {
+        int propLen = ent.getPropLength();
+        int x = ent.getX() + Constant.SPACING_FOR_COMPONENT_OF_PROPERTY;
+        int y = ent.getY() - propLen / 2;
+
+        for (String prop : ent.getProperties()) {
+            PropertyArtifact pro = new PropertyArtifact();
+            Element property = pro.addElement(doc, svgNS, x, y, propLen);
+            Element text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, prop);
+
+            svgRoot.appendChild(property);
+            svgRoot.appendChild(text);
+
+            x += (propLen + Constant.SPACING_FOR_COMPONENT_OF_PROPERTY);
+
+            pro.setName(prop);
+            pro.setContainerName(ent.getName());
+        }
+    }
+
+    private void addComponentReference(ComponentEntity ent) {
+
+        int refHeight = ent.getRefHeight();
+        int x = (ent.getX() + ent.getWidth()) - (refHeight * 2 / 3);
+        int y = ent.getY() + Constant.SPACING_FOR_COMPONENT_OF_REFERENCE;
+
+        for (String ref : setRefOrder(ent)) {
+            ReferenceArtifact refer = new ReferenceArtifact();
+            Element polygon = refer.addElement(doc, svgNS, x, y, refHeight);
+            Element text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, ref);
+            svgRoot.appendChild(polygon);
+            svgRoot.appendChild(text);
+
+            y += (refHeight + Constant.SPACING_FOR_COMPONENT_OF_REFERENCE);
+
+            refer.setName(ref);
+            refer.setContainerName(ent.getName());
+            refs.add(refer);
+
+        }
+    }
+
+    /**
+     * This method is used to organize the Component References,
+     * in a manner where they are stay approximately in-line with the
+     * connecting Service. This would enhance the clearness of the diagram.
+     */
+    private String[] setRefOrder(ComponentEntity e) {
+
+        ArrayList<String> refs = e.getReferences();
+        ArrayList<String> sers = new ArrayList<String>();
+        String[] orderedRefs = new String[refs.size()];
+
+        //sers = new ArrayList<String>(e.getReferenceToServiceMap().values());
+
+        sers = buildReferenceToMappingServiceList(refs, e);
+
+        for (String eName : e.getAdjacentEntities()) {
+            for (Entity ent : comp.getComponentList()) {
+
+                if (ent.getName().equals(eName)) {
+                    for (String s : sers) {
+                        for (String s1 : ent.getServices()) {
+                            //System.err.println("XXXXX "+ s1 +" ::: "+s);
+                            if (s1.equals(s) || s.equals(ent.getName())) {
+                                //System.err.println("|||||||| "+ sers.size()+ " ||| " + refs.size()+"|| "+orderedRefs.length);
+                                if (orderedRefs[ent.getLevel()] == null) {
+                                    //System.err.println("XXXXX "+ sers.get(1)+ " ::::::: "+refs.get(1));
+                                    //									System.err.println("XXXXX "+ sers.get(2)+ " ::::::: "+refs.get(2));
+                                    //									System.err.println("XXXXX "+ sers.get(3)+ " ::::::: "+refs.get(3));
+                                    //System.err.println("XXXXX "+ refs.get(sers.indexOf(s))+" ::: "+ent.getLevel()+" ::: "+ent.getName());
+                                    orderedRefs[ent.getLevel()] = refs.get(sers.indexOf(s));
+                                    break;
+                                } else {
+                                    for (int i = ent.getLevel(); i < orderedRefs.length; i++) {
+                                        if (orderedRefs[i] == null) {
+
+                                            orderedRefs[i] = refs.get(sers.indexOf(s));
+                                            break;
+                                        }
+                                        //										else{
+                                        //											if(i==orderedRefs.length)
+                                        //												System.out.println("GRRR");
+                                        //										}
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        //adding references which are not connected to any service
+        for (String ref : refs) {
+            for (int i = 0; i < orderedRefs.length; i++) {
+                if (ref.equals(orderedRefs[i])) {
+                    break;
+                } else if (orderedRefs[i] == null) {
+                    orderedRefs[i] = ref;
+                    break;
+                }
+            }
+        }
+
+        return orderedRefs;
+    }
+
+    private ArrayList<String> buildReferenceToMappingServiceList(ArrayList<String> refs, ComponentEntity e) {
+
+        ArrayList<String> sers = new ArrayList<String>();
+
+        for (int i = 0; i < refs.size(); i++) {
+            sers.add(i, "");
+        }
+
+        for (Iterator it = e.getReferenceToServiceMap().entrySet().iterator(); it.hasNext();) {
+
+            Entry entry = (Entry)it.next();
+            String ref = (String)entry.getKey();
+            String ser = (String)entry.getValue();
+            //System.out.println("---------"+ref);
+            int idx = refs.indexOf(ref);
+            //System.out.println("---------"+sers.get(idx));
+            sers.remove(idx);
+            sers.add(idx, ser);
+            //System.out.println(refs.get(idx)+"---"+sers.get(idx));
+
+        }
+
+        return sers;
+    }
+
+    private void addComponentService(ComponentEntity ent) {
+        int serHeight = ent.getSerHeight();
+        int x = ent.getX() - (serHeight * 2 / 3);
+        int y = ent.getY() + Constant.SPACING_FOR_COMPONENT_OF_SERVICE;
+
+        //System.out.println("''''''"+ent.getName() +" '''''' "+ ent.getServices().size());
+        for (String ser : ent.getServices()) {
+
+            ServiceArtifact serve = new ServiceArtifact();
+            Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
+            Element text;
+            if (!ser.endsWith("Impl"))
+                text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, ser);
+            else
+                text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, "");
+
+            svgRoot.appendChild(polygon);
+            svgRoot.appendChild(text);
+
+            y += (serHeight + Constant.SPACING_FOR_COMPONENT_OF_SERVICE);
+
+            serve.setName(ser);
+            serve.setContainerName(ent.getName());
+            sers.add(serve);
+        }
+    }
+
+    private void addCompositeService() {
+
+        int serHeight = comp.getSerHeight();
+        int x = comp.getX() - (serHeight * 2 / 3);
+        int y =
+            comp.getY() + getStartingPoint(comp.getHeight(), serHeight, Constant.SPACING_FOR_COMPOSITE_OF_SERVICE, comp
+                .getServices().size());
+
+        //int y= comp.getY() + Constant.SPACING_FOR_COMPOSITE_OF_SERVICE;
+
+        //System.err.println(serHeight);
+        //System.out.println("''''''"+((CompositeEntity)comp).getName() +" '''''' "+ comp.getServices().size());
+        for (String ser : comp.getServices()) {
+
+            ServiceArtifact serve = new ServiceArtifact();
+            Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
+            Element text;
+            if (!ser.endsWith("Impl"))
+                text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, ser);
+            else
+                text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, "");
+
+            svgRoot.appendChild(polygon);
+            svgRoot.appendChild(text);
+
+            y += (serHeight + Constant.SPACING_FOR_COMPOSITE_OF_SERVICE);
+
+            serve.setName(ser);
+            serve.setContainerName(comp.getName());
+            sers.add(serve);
+        }
+    }
+
+    private void addCompositeReference() {
+
+        int refHeight = comp.getRefHeight();
+
+        int x = (comp.getX() + comp.getWidth()) - (refHeight * 2 / 3);
+        int y =
+            comp.getY() + getStartingPoint(comp.getHeight(),
+                                           refHeight,
+                                           Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE,
+                                           comp.getReferences().size());
+
+        for (String ref : comp.getReferences()) {
+            ReferenceArtifact refer = new ReferenceArtifact();
+            Element polygon = refer.addElement(doc, svgNS, x, y, refHeight);
+            Element text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, ref);
+            svgRoot.appendChild(polygon);
+            svgRoot.appendChild(text);
+
+            y += (refHeight + Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE);
+
+            refer.setName(ref);
+            refer.setContainerName(comp.getName());
+            refs.add(refer);
+
+        }
+
+    }
+
+    //Algorithm to position in center
+    private int getStartingPoint(int compDim, int artifactDim, int gap, int artifactQty) {
+
+        int x = (compDim - artifactQty * artifactDim - (artifactQty - 1) * gap) / 2;
+        return x;
+    }
+
+    private void addCompositeProperties() {
+        int propLen = comp.getPropLength();
+
+        int x =
+            comp.getX() + getStartingPoint(comp.getWidth(), propLen, Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY, comp
+                .getProperties().size());
+        //int x= comp.getX() + Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY;
+        int y = comp.getY() - propLen / 2;
+
+        for (String prop : comp.getProperties()) {
+            PropertyArtifact pro = new PropertyArtifact();
+            Element property = pro.addElement(doc, svgNS, x, y, propLen);
+            Element text = Text.addTextElement(doc, svgNS, x, y - Constant.SPACING_FOR_TEXT, prop);
+
+            svgRoot.appendChild(property);
+            svgRoot.appendChild(text);
+
+            x += (propLen + Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY);
+
+            pro.setName(prop);
+            pro.setContainerName(comp.getName());
+        }
+    }
+
+    private void addComponent(Entity ent) {
+
+        ComponentArtifact comp = new ComponentArtifact();
+        //System.err.println(ent.getX());
+        Element com = comp.addElement(doc, svgNS, ent.getX(), ent.getY(), ent.getHeight(), ent.getWidth());
+        Element text =
+            Text.addTextElement(doc,
+                                svgNS,
+                                ent.getX(),
+                                ent.getY() + (ent.getHeight() + Constant.COMPONENT_TEXT_SPACING),
+                                ent.getName());
+
+        svgRoot.appendChild(com);
+        svgRoot.appendChild(text);
+
+        comp.setName(ent.getName());
+    }
+
+    private void addComposite() {
+
+        CompositeArtifact composite = new CompositeArtifact();
+
+        Element composi = composite.addElement(doc, svgNS, comp.getX(), comp.getY(), comp.getHeight(), comp.getWidth());
+        Element text = Text.addTextElement(doc, svgNS, comp.getX() + 20, comp.getY() + 20, comp.getName());
+
+        svgRoot.appendChild(composi);
+        svgRoot.appendChild(text);
+
+        composite.setName(comp.getName());
+
+    }
+
+    public void setDiagramHeight(int diagramHeight) {
+        this.diagramHeight = diagramHeight;
+    }
+
+    public int getDiagramHeight() {
+        return diagramHeight;
+    }
+
+    public void setDiagramWidth(int diagramWidth) {
+        this.diagramWidth = diagramWidth;
+    }
+
+    public int getDiagramWidth() {
+        return diagramWidth;
+    }
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/generator/DiagramGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.html;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+public class HTMLWrapper {
+
+    private File htmlFilePath;
+    private String compositeName;
+    private String svg;
+
+    /**
+     * 
+     * @param svg
+     * @param compositeName
+     * @param htmlFilePath
+     */
+    public HTMLWrapper(String svg, String compositeName, File htmlFilePath) {
+
+        this.svg = svg;
+        this.compositeName = compositeName;
+        this.htmlFilePath = htmlFilePath;
+    }
+
+    public String buildHTML() throws Exception {
+        String content =
+            "" + "<html>\n"
+                + "<head>\n"
+                + "<h1 align='center'>Apache Tuscany - Composite Diagram Generator</h1>\n"
+                + "<h2 align='center'>"
+                + compositeName
+                + "</h2>\n"
+                + "</br>\n"
+                +
+                //				"<script type=\"text/javascript\" src=\""+CANVG_LIB_DIR+RGB_FILE+"\"></script>\n" +
+                //				"<script type=\"text/javascript\" src=\""+CANVG_LIB_DIR+CANVG_FILE+"\"></script>\n" +
+                //				"<script type=\"text/javascript\">\n" +
+                //				"window.onload = function() {\n" +
+                //				"//load '../path/to/your.svg' in the canvas with id = 'canvas'\n" +
+                //				"canvg('canvas', '"+svgFileName+"')\n" +
+                //				"//load a svg snippet in the canvas with id = 'drawingArea'\n" +
+                //				"canvg(document.getElementById('drawingArea'), '<svg>...</svg>')\n" +
+                //				"canvg('canvas', '"+svgFileName+"', {})\n" +
+                //				"}\n" +
+                //				"</script>\n" +
+                "</head>\n"
+                + "<body>\n"
+                + svg
+                + "\n"
+                +
+                //				"<canvas id=\"canvas\" width=\""+compositeWidth+"px\" height=\""+compositeHeight+"px\">\n" +
+                //				"</canvas>\n" +
+                "</body>\n"
+                + "</html>";
+
+        fileWriter(content);
+
+        return content;
+
+    }
+
+    private void fileWriter(String content) throws Exception {
+
+        FileWriter fileWriter = new FileWriter(htmlFilePath);
+        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+        bufferedWriter.append(content);
+        bufferedWriter.close();
+
+    }
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/html/HTMLWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.io;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+
+public class XMLReader {
+
+    //get the factory
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    private Document dom;
+
+    public Document parseXMLFile(String file) throws Exception {
+        //Using factory get an instance of document builder
+        DocumentBuilder db = dbf.newDocumentBuilder();
+
+        //parse using builder to get DOM representation of the XML file
+        dom = db.parse(file);
+
+        return dom;
+    }
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java?rev=1164133&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java Thu Sep  1 16:22:37 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.diagram.io;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+public class XMLWriter {
+
+    public void fileWriter(String content, File outFile) throws Exception {
+
+        FileWriter fileWriter = new FileWriter(outFile);
+        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+        bufferedWriter.write(content);
+        bufferedWriter.close();
+
+        //		TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        //		Transformer transformer = transformerFactory.newTransformer();
+        //		DOMSource source = new DOMSource(doc);
+        //		StreamResult result =  new StreamResult(bufferedWriter);
+        //		transformer.transform(source, result);
+
+    }
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/diagram/io/XMLWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message