diff options
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik')
6 files changed, 0 insertions, 191 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/component.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/component.svg deleted file mode 100755 index c1acd47edd..0000000000 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/component.svg +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="100" font-size="20" dominant-baseline="mathematical" y="70" text-anchor="middle">SCA Component</text></svg>
\ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/reference.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/reference.svg deleted file mode 100755 index 00a4f8e33e..0000000000 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/reference.svg +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><polygon fill="#BF3EFF" points="45,15 30,30 0,30 15,15 0,0 30,0 " stroke="#68228B"/></svg>
\ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/service.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/service.svg deleted file mode 100755 index 07f0a65b0b..0000000000 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/service.svg +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><polygon fill="#00CD66" points="15,15 0,0 30,0 45,15 30,30 0,30 " stroke="#008B45"/></svg>
\ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/test.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/test.svg deleted file mode 100755 index c1acd47edd..0000000000 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/test.svg +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="100" font-size="20" dominant-baseline="mathematical" y="70" text-anchor="middle">SCA Component</text></svg>
\ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/PropertyAllocator.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/PropertyAllocator.java deleted file mode 100755 index a05951f3ac..0000000000 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/PropertyAllocator.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.tuscany.sca.impl.layout; - -import java.util.Iterator; - -import org.apache.tuscany.sca.impl.artifacts.Component; -import org.apache.tuscany.sca.impl.artifacts.Reference; - -public class PropertyAllocator { -// Entity entity; -// -// public PropertyAllocator(Entity e) { -// entity = e; -// } -// -// public void allocatePropertiesOfRefs(){ -// int height=0; -// -// -// for(Iterator it=entity.getReferenceToServiceMap().keySet().iterator();it.hasNext();){ -// String ref = it.next(); -// -// } -// } - - -} diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/SVGDiagramGenerator.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/SVGDiagramGenerator.java deleted file mode 100644 index bce24de749..0000000000 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/SVGDiagramGenerator.java +++ /dev/null @@ -1,161 +0,0 @@ -/* -un * 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.main; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.apache.batik.dom.svg.SVGDOMImplementation; -import org.apache.tuscany.sca.impl.artifacts.Component; -import org.apache.tuscany.sca.impl.artifacts.Composite; -import org.apache.tuscany.sca.impl.artifacts.Property; -import org.apache.tuscany.sca.impl.artifacts.Reference; -import org.apache.tuscany.sca.impl.artifacts.Service; -import org.apache.tuscany.sca.impl.artifacts.Text; -import org.apache.tuscany.sca.impl.artifacts.Wire; - - - -public class SVGDiagramGenerator { - - private static final File outFile = new File(System.getProperty("user.dir") - + "/output/reference.svg"); - - /** - * @param args - * @throws Exception - */ - public static void main(String[] args) throws Exception { - fileWriter(buildSVGDocument()); - - } - - - public static Document buildSVGDocument(){ - DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); - String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; - Document doc = impl.createDocument(svgNS, "svg", null); - - // Get the root element (the 'svg' element). - Element svgRoot = doc.getDocumentElement(); - - Composite composite = new Composite(); - - Component comp1 = new Component(); - Component comp2 = new Component(); - Component comp3 = new Component(); - - Property prop1 = new Property(); - Property prop2 = new Property(); - - Service ser1 = new Service(); - Service ser2 = new Service(); - Service ser3 = new Service(); - - Reference ref1 = new Reference(); - Reference ref2 = new Reference(); - - Wire edge1 = new Wire(); - Wire edge2 = new Wire(); - - Element rectangle1 = comp1.addElement(doc, svgNS, 0, 0, 130, 200); - Element text1 = Text.addTextElement(doc, svgNS, 100, 70, "SCA Component"); - - Element property1 = prop1.addElement(doc, svgNS, 120, 10, 20); - Element property2 = prop2.addElement(doc, svgNS, 160, 10, 20); - - Element polygon1 = ser1.addElement(doc, svgNS, 15, 15, 30); - - Element polygon2 = ref1.addElement(doc, svgNS, 45, 15, 30); - Element polygon3 = ref2.addElement(doc, svgNS, 270, 110, 30); - - //Element wire1 = edge1.addElement(doc, svgNS, 270, 60, 390, 85); - - Element rectangle2 = comp2.addElement(doc, svgNS, 400, 20, 130, 200); - Element text2 = Text.addTextElement(doc, svgNS, 500, 90, "SCA Component"); - - Element polygon4 = ser2.addElement(doc, svgNS, 400, 90, 30); - //Element polygon3 = Reference.addReferenceElement(doc, svgNS, 600, 105); - - Element rectangle3 = comp3.addElement(doc, svgNS, 400, 200, 130, 200); - Element text3 = Text.addTextElement(doc, svgNS, 500, 270, "SCA Component"); - - Element polygon5 = ser3.addElement(doc, svgNS, 400, 270, 30); - - Element wire1 = edge1.addElement(doc, svgNS, ref1, ser2); - Element wire2 = edge2.addElement(doc, svgNS, ref2, ser3); - //Element wire2 = Wire.addWireElement(doc, svgNS, 270, 110, 390, 265); - - // Set the width and height attributes on the root 'svg' element. -// svgRoot.setAttributeNS(null, "width", "200"); -// svgRoot.setAttributeNS(null, "height", "130"); - - Element composi = composite.addElement(doc, svgNS, 0, 0, 350, 650); - Element text4 = Text.addTextElement(doc, svgNS, 75, 320, "Composite"); - -// svgRoot.appendChild(composi); -// svgRoot.appendChild(text4); - -// // Attach the rectangle to the root 'svg' element. -// svgRoot.appendChild(rectangle1); -// svgRoot.appendChild(text1); -// svgRoot.appendChild(property1); -// svgRoot.appendChild(property2); -// svgRoot.appendChild(polygon1); - svgRoot.appendChild(polygon2); -// svgRoot.appendChild(polygon3); -// -// svgRoot.appendChild(rectangle2); -// svgRoot.appendChild(text2); -// svgRoot.appendChild(polygon4); -// //svgRoot.appendChild(polygon3); -// -// svgRoot.appendChild(rectangle3); -// svgRoot.appendChild(text3); -// svgRoot.appendChild(polygon5); -// -// svgRoot.appendChild(wire1); -// svgRoot.appendChild(wire2); -// //svgRoot.setAttributeNS(null, "fill", "#CAE1FF"); -// //System.out.println(doc.getDocumentElement().getAttribute("width")); - - return doc; - } - - public static void fileWriter(Document doc) throws Exception{ - - FileWriter fileWriter = new FileWriter(outFile); - BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - DOMSource source = new DOMSource(doc); - StreamResult result = new StreamResult(bufferedWriter); - transformer.transform(source, result); - - } -} |