Author: nirmal070125
Date: Fri Aug 12 02:55:15 2011
New Revision: 1156944

URL: http://svn.apache.org/viewvc?rev=1156944&view=rev
Log:
added an algorithm (1 line) to make compositeArtifacts lie in center, and fixed 
a possible bug in layout algo

Modified:
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite.xml
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
    
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite.xml
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite.xml?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite.xml
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite.xml
 Fri Aug 12 02:55:15 2011
@@ -45,5 +45,15 @@
     <component name="DivideServiceComponent">
         <implementation.java class="calculator.DivideServiceImpl"/>
     </component>
+    
+    <component name="StockQuoteMediatorComponent">
+
+         <implementation.java class="services.myvalue.SQMediatorImpl"/>
+
+         <property name="currency">EURO</property>
+
+         <reference name="stockQuoteService"/>
+
+   </component>
 
 </composite>
\ No newline at end of file

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
 Fri Aug 12 02:55:15 2011
@@ -57,6 +57,15 @@
          <reference name="stockQuoteService"/>
 
    </component>
+   
+   <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl"/>
+    </component>
+   
 
  
 
@@ -70,7 +79,7 @@
 
    </reference>
 
- 
+  <property name="currency">EURO</property>
 
    <reference name="StockQuoteService" 
 

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
 Fri Aug 12 02:55:15 2011
@@ -1 +1 @@
-<?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" alignment-baseline="middle" fill="#E5E5D0" 
width="1400" rx="20" ry="20" height="1340" stroke="#919191"/><rect x="200" 
y="100" alignment-baseline="middle" fill="#E5E5E5" width="1000" rx="20" ry="20" 
height="1140" stroke="#919191"/><text x="700" font-size="15" y="120" 
dominant-baseline="mathematical">Calculator</text><rect x="400" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="350" 
dominant-baseline="mathematical">CalculatorServiceComponent</text><polygon 
fill="#00CD66" points="380,210 410,210 425,225 410,240 380,240 395,225 " 
stroke="#008B45"/><text x="380" font-size="15" y="209" 
dominant-baseline="mathematical">Calculato
 rService</text><polygon fill="#BF3EFF" points="586,210 608,210 619,221 608,232 
586,232 597,221 " stroke="#68228B"/><text x="586" font-size="15" y="209" 
dominant-baseline="mathematical">addService</text><polygon fill="#BF3EFF" 
points="586,242 608,242 619,253 608,264 586,264 597,253 " 
stroke="#68228B"/><text x="586" font-size="15" y="241" 
dominant-baseline="mathematical">subtractService</text><polygon fill="#BF3EFF" 
points="586,274 608,274 619,285 608,296 586,296 597,285 " 
stroke="#68228B"/><text x="586" font-size="15" y="273" 
dominant-baseline="mathematical">multiplyService</text><polygon fill="#BF3EFF" 
points="586,306 608,306 619,317 608,328 586,328 597,317 " 
stroke="#68228B"/><text x="586" font-size="15" y="305" 
dominant-baseline="mathematical">divideService</text><rect x="800" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="350" 
dominant-baseline="mathematical">AddServiceComponent</text><
 polygon fill="#00CD66" points="780,210 810,210 825,225 810,240 780,240 795,225 
" stroke="#008B45"/><text x="780" font-size="15" y="209" 
dominant-baseline="mathematical">AddService</text><rect x="800" y="460" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="610" 
dominant-baseline="mathematical">SubtractServiceComponent</text><polygon 
fill="#00CD66" points="780,470 810,470 825,485 810,500 780,500 795,485 " 
stroke="#008B45"/><text x="780" font-size="15" y="469" 
dominant-baseline="mathematical">SubtractService</text><rect x="800" y="720" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="870" 
dominant-baseline="mathematical">MultiplyServiceComponent</text><polygon 
fill="#00CD66" points="780,730 810,730 825,745 810,760 780,760 795,745 " 
stroke="#008B45"/><text x="780" font-size="15" y="729" 
dominant-baseline="mathematical">Multipl
 yService</text><rect x="800" y="980" fill-opacity="0.75" fill="#3D59AB" 
width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="800" 
font-size="15" y="1130" 
dominant-baseline="mathematical">DivideServiceComponent</text><polygon 
fill="#00CD66" points="780,990 810,990 825,1005 810,1020 780,1020 795,1005 " 
stroke="#008B45"/><text x="780" font-size="15" y="989" 
dominant-baseline="mathematical">DivideService</text><polyline fill="none" 
stroke-width="2" points="619,221 639,221 639,225 795,225" 
stroke="black"/><polyline fill="none" stroke-width="2" points="619,317 644,317 
644,1005 795,1005" stroke="black"/><polyline fill="none" stroke-width="2" 
points="619,285 649,285 649,745 795,745" stroke="black"/><polyline fill="none" 
stroke-width="2" points="619,253 654,253 654,485 795,485" stroke="black"/></svg>
\ No newline at end of file
+<?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" alignment-baseline="middle" fill="#E5E5D0" 
width="1400" rx="20" ry="20" height="1340" stroke="#919191"/><rect x="200" 
y="100" alignment-baseline="middle" fill="#E5E5E5" width="1000" rx="20" ry="20" 
height="1140" stroke="#919191"/><text x="700" font-size="15" y="120" 
dominant-baseline="mathematical">Calculator</text><rect x="400" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="350" 
dominant-baseline="mathematical">CalculatorServiceComponent</text><polygon 
fill="#00CD66" points="380,210 410,210 425,225 410,240 380,240 395,225 " 
stroke="#008B45"/><text x="380" font-size="15" y="209" 
dominant-baseline="mathematical">Calculato
 rService</text><polygon fill="#BF3EFF" points="586,210 608,210 619,221 608,232 
586,232 597,221 " stroke="#68228B"/><text x="586" font-size="15" y="209" 
dominant-baseline="mathematical">addService</text><polygon fill="#BF3EFF" 
points="586,242 608,242 619,253 608,264 586,264 597,253 " 
stroke="#68228B"/><text x="586" font-size="15" y="241" 
dominant-baseline="mathematical">subtractService</text><polygon fill="#BF3EFF" 
points="586,274 608,274 619,285 608,296 586,296 597,285 " 
stroke="#68228B"/><text x="586" font-size="15" y="273" 
dominant-baseline="mathematical">multiplyService</text><polygon fill="#BF3EFF" 
points="586,306 608,306 619,317 608,328 586,328 597,317 " 
stroke="#68228B"/><text x="586" font-size="15" y="305" 
dominant-baseline="mathematical">divideService</text><rect x="800" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="350" 
dominant-baseline="mathematical">AddServiceComponent</text><
 polygon fill="#00CD66" points="780,210 810,210 825,225 810,240 780,240 795,225 
" stroke="#008B45"/><text x="780" font-size="15" y="209" 
dominant-baseline="mathematical">AddService</text><rect x="800" y="460" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="610" 
dominant-baseline="mathematical">SubtractServiceComponent</text><polygon 
fill="#00CD66" points="780,470 810,470 825,485 810,500 780,500 795,485 " 
stroke="#008B45"/><text x="780" font-size="15" y="469" 
dominant-baseline="mathematical">SubtractService</text><rect x="800" y="720" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="870" 
dominant-baseline="mathematical">MultiplyServiceComponent</text><polygon 
fill="#00CD66" points="780,730 810,730 825,745 810,760 780,760 795,745 " 
stroke="#008B45"/><text x="780" font-size="15" y="729" 
dominant-baseline="mathematical">Multipl
 yService</text><rect x="800" y="980" fill-opacity="0.75" fill="#3D59AB" 
width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="800" 
font-size="15" y="1130" 
dominant-baseline="mathematical">DivideServiceComponent</text><polygon 
fill="#00CD66" points="780,990 810,990 825,1005 810,1020 780,1020 795,1005 " 
stroke="#008B45"/><text x="780" font-size="15" y="989" 
dominant-baseline="mathematical">DivideService</text><rect x="400" y="460" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="610" 
dominant-baseline="mathematical">StockQuoteMediatorComponent</text><rect 
fill="#EEEE00" x="420" width="20" height="20" y="450" stroke="#EEC900"/><text 
x="420" font-size="15" y="449" 
dominant-baseline="mathematical">currency</text><polygon fill="#00CD66" 
points="380,470 410,470 425,485 410,500 380,500 395,485 " 
stroke="#008B45"/><text x="380" font-size="15" y="469" 
dominant-baseline="mathematical">SQMediator<
 /text><polygon fill="#BF3EFF" points="580,470 610,470 625,485 610,500 580,500 
595,485 " stroke="#68228B"/><text x="580" font-size="15" y="469" 
dominant-baseline="mathematical">stockQuoteService</text><polyline fill="none" 
stroke-width="2" points="619,221 639,221 639,225 795,225" 
stroke="black"/><polyline fill="none" stroke-width="2" points="619,317 644,317 
644,1005 795,1005" stroke="black"/><polyline fill="none" stroke-width="2" 
points="619,285 649,285 649,745 795,745" stroke="black"/><polyline fill="none" 
stroke-width="2" points="619,253 654,253 654,485 795,485" stroke="black"/></svg>
\ No newline at end of file

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
 Fri Aug 12 02:55:15 2011
@@ -1 +1 @@
-<?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" alignment-baseline="middle" fill="#E5E5D0" 
width="1400" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" 
y="100" alignment-baseline="middle" fill="#E5E5E5" width="1000" rx="20" ry="20" 
height="360" stroke="#919191"/><text x="700" font-size="15" y="120" 
dominant-baseline="mathematical">MyValueComposite2</text><rect x="400" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="130" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="350" 
dominant-baseline="mathematical">MyValueServiceComponent</text><polygon 
fill="#00CD66" points="380,210 410,210 425,225 410,240 380,240 395,225 " 
stroke="#008B45"/><text x="380" font-size="15" y="225" 
dominant-baseline="mathematical">myValue
 Service</text><polygon fill="#BF3EFF" points="510,210 540,210 555,225 540,240 
510,240 525,225 " stroke="#68228B"/><text x="510" font-size="15" y="225" 
dominant-baseline="mathematical">stockQuoteService</text><polygon 
fill="#BF3EFF" points="510,250 540,250 555,265 540,280 510,280 525,265 " 
stroke="#68228B"/><text x="510" font-size="15" y="265" 
dominant-baseline="mathematical">customerService</text><rect fill="#EEEE00" 
x="420" width="20" height="20" y="190" stroke="#EEC900"/><text x="420" 
font-size="15" y="190" dominant-baseline="mathematical">currency</text><rect 
x="660" y="200" fill-opacity="0.75" fill="#3D59AB" width="130" rx="20" ry="20" 
height="130" stroke="#104E8B"/><text x="660" font-size="15" y="350" 
dominant-baseline="mathematical">StockQuoteMediatorComponent</text><polygon 
fill="#00CD66" points="640,210 670,210 685,225 670,240 640,240 655,225 " 
stroke="#008B45"/><text x="640" font-size="15" y="225" 
dominant-baseline="mathematical">SQMediator</text><polygon fill="#BF3
 EFF" points="770,210 800,210 815,225 800,240 770,240 785,225 " 
stroke="#68228B"/><text x="770" font-size="15" y="225" 
dominant-baseline="mathematical">stockQuoteService</text><rect fill="#EEEE00" 
x="680" width="20" height="20" y="190" stroke="#EEC900"/><text x="680" 
font-size="15" y="190" dominant-baseline="mathematical">currency</text><polygon 
fill="#00CD66" points="140,130 230,130 275,175 230,220 140,220 185,175 " 
stroke="#008B45"/><text x="140" font-size="15" y="175" 
dominant-baseline="mathematical">MyValueService</text><polygon fill="#BF3EFF" 
points="1140,130 1230,130 1275,175 1230,220 1140,220 1185,175 " 
stroke="#68228B"/><text x="1140" font-size="15" y="175" 
dominant-baseline="mathematical">CustomerService</text><polygon fill="#BF3EFF" 
points="1140,250 1230,250 1275,295 1230,340 1140,340 1185,295 " 
stroke="#68228B"/><text x="1140" font-size="15" y="295" 
dominant-baseline="mathematical">StockQuoteService</text><polyline fill="none" 
stroke-width="2" points="555,225 655,2
 25" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" 
stroke-width="2" points="815,225 840,225 840,295 1185,295" 
stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" 
points="555,265 585,265 585,175 1185,175" stroke="black"/><polyline fill="none" 
stroke-dasharray="3 3" stroke-width="2" points="815,225 850,225 850,175 
1185,175" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" 
stroke-width="2" points="275,175 315,175 315,225 395,225" stroke="black"/><rect 
x="205" y="390" alignment-baseline="middle" fill="#E5E5C0" width="990" rx="20" 
ry="20" height="65" stroke="#919191"/><text x="210" font-size="15" y="400" 
dominant-baseline="mathematical">Included Composites</text><text x="210" 
font-size="15" y="425" dominant-baseline="mathematical"><a 
xlink:href="store_diagram.svg" xlink:actuate="onRequest" xlink:type="simple" 
xlink:show="new" xmlns:xlink="http://www.w3.org/1999/xlink";> store ,</a><a 
xlink:href="Calculator_diagram.svg" xlink:actu
 ate="onRequest" xlink:type="simple" xlink:show="new" 
xmlns:xlink="http://www.w3.org/1999/xlink";> Calculator ,</a><a 
xlink:href="supplychain_diagram.svg" xlink:actuate="onRequest" 
xlink:type="simple" xlink:show="new" 
xmlns:xlink="http://www.w3.org/1999/xlink";> supplychain ,</a></text></svg>
\ No newline at end of file
+<?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" alignment-baseline="middle" fill="#E5E5D0" 
width="1400" rx="20" ry="20" height="1080" stroke="#919191"/><rect x="200" 
y="100" alignment-baseline="middle" fill="#E5E5E5" width="1000" rx="20" ry="20" 
height="880" stroke="#919191"/><text x="220" font-size="15" y="120" 
dominant-baseline="mathematical">MyValueComposite2</text><rect x="400" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="350" 
dominant-baseline="mathematical">MyValueServiceComponent</text><rect 
fill="#EEEE00" x="420" width="20" height="20" y="190" stroke="#EEC900"/><text 
x="420" font-size="15" y="189" 
dominant-baseline="mathematical">currency</text><polygon fill
 ="#00CD66" points="380,210 410,210 425,225 410,240 380,240 395,225 " 
stroke="#008B45"/><text x="380" font-size="15" y="209" 
dominant-baseline="mathematical">myValueService</text><polygon fill="#BF3EFF" 
points="580,210 610,210 625,225 610,240 580,240 595,225 " 
stroke="#68228B"/><text x="580" font-size="15" y="209" 
dominant-baseline="mathematical">stockQuoteService</text><polygon 
fill="#BF3EFF" points="580,250 610,250 625,265 610,280 580,280 595,265 " 
stroke="#68228B"/><text x="580" font-size="15" y="249" 
dominant-baseline="mathematical">customerService</text><rect x="800" y="200" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="800" font-size="15" y="350" 
dominant-baseline="mathematical">StockQuoteMediatorComponent</text><rect 
fill="#EEEE00" x="820" width="20" height="20" y="190" stroke="#EEC900"/><text 
x="820" font-size="15" y="189" 
dominant-baseline="mathematical">currency</text><polygon fill="#00CD66" 
points="780,210 81
 0,210 825,225 810,240 780,240 795,225 " stroke="#008B45"/><text x="780" 
font-size="15" y="209" 
dominant-baseline="mathematical">SQMediator</text><polygon fill="#BF3EFF" 
points="980,210 1010,210 1025,225 1010,240 980,240 995,225 " 
stroke="#68228B"/><text x="980" font-size="15" y="209" 
dominant-baseline="mathematical">stockQuoteService</text><rect x="400" y="460" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="610" 
dominant-baseline="mathematical">SubtractServiceComponent</text><polygon 
fill="#00CD66" points="380,470 410,470 425,485 410,500 380,500 395,485 " 
stroke="#008B45"/><text x="380" font-size="15" y="469" 
dominant-baseline="mathematical">SubtractService</text><rect x="400" y="720" 
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" 
stroke="#104E8B"/><text x="400" font-size="15" y="870" 
dominant-baseline="mathematical">MultiplyServiceComponent</text><polygon 
fill="#00CD6
 6" points="380,730 410,730 425,745 410,760 380,760 395,745 " 
stroke="#008B45"/><text x="380" font-size="15" y="729" 
dominant-baseline="mathematical">MultiplyService</text><rect fill="#EEEE00" 
x="670" width="60" height="60" y="70" stroke="#EEC900"/><text x="670" 
font-size="15" y="69" dominant-baseline="mathematical">currency</text><polygon 
fill="#00CD66" points="140,495 230,495 275,540 230,585 140,585 185,540 " 
stroke="#008B45"/><text x="140" font-size="15" y="494" 
dominant-baseline="mathematical">MyValueService</text><polygon fill="#BF3EFF" 
points="1140,425 1230,425 1275,470 1230,515 1140,515 1185,470 " 
stroke="#68228B"/><text x="1140" font-size="15" y="424" 
dominant-baseline="mathematical">CustomerService</text><polygon fill="#BF3EFF" 
points="1140,565 1230,565 1275,610 1230,655 1140,655 1185,610 " 
stroke="#68228B"/><text x="1140" font-size="15" y="564" 
dominant-baseline="mathematical">StockQuoteService</text><polyline fill="none" 
stroke-width="2" points="625,225 795,225" st
 roke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" 
points="1025,225 1050,225 1050,610 1185,610" stroke="black"/><polyline 
fill="none" stroke-dasharray="3 3" stroke-width="2" points="625,265 655,265 
655,470 1185,470" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" 
stroke-width="2" points="1025,225 1060,225 1060,470 1185,470" 
stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" 
points="275,540 315,540 315,225 395,225" stroke="black"/><rect x="205" y="910" 
alignment-baseline="middle" fill="#E5E5C0" width="990" rx="20" ry="20" 
height="65" stroke="#919191"/><text x="210" font-size="15" y="920" 
dominant-baseline="mathematical">Included Composites</text><text x="210" 
font-size="15" y="945" dominant-baseline="mathematical"><a 
xlink:href="store_diagram.svg" xlink:actuate="onRequest" xlink:type="simple" 
xlink:show="new" xmlns:xlink="http://www.w3.org/1999/xlink";> store ,</a><a 
xlink:href="Calculator_diagram.svg" xlink:actu
 ate="onRequest" xlink:type="simple" xlink:show="new" 
xmlns:xlink="http://www.w3.org/1999/xlink";> Calculator ,</a><a 
xlink:href="supplychain_diagram.svg" xlink:actuate="onRequest" 
xlink:type="simple" xlink:show="new" 
xmlns:xlink="http://www.w3.org/1999/xlink";> supplychain ,</a></text></svg>
\ No newline at end of file

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
 Fri Aug 12 02:55:15 2011
@@ -14,12 +14,12 @@ public final class Constant {
        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 = 30 ;
+       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 = 30 ;
+       public static final int SPACING_FOR_COMPOSITE_OF_SERVICE = 50 ;
        
        public static final int SPACING_FOR_TEXT = 1 ;
 

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
 Fri Aug 12 02:55:15 2011
@@ -449,10 +449,13 @@ public class DiagramGenerator {
 
                int serHeight = comp.getSerHeight();
                int x= comp.getX()-(serHeight*2/3);
-               int y= comp.getY() + Constant.SPACING_FOR_COMPOSITE_OF_SERVICE;
+               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());
+               //System.err.println(serHeight);
+               //System.out.println("''''''"+((CompositeEntity)comp).getName() 
+" '''''' "+ comp.getServices().size());
                for(String ser: comp.getServices()){
 
                        ServiceArtifact serve= new ServiceArtifact();
@@ -477,8 +480,10 @@ public class DiagramGenerator {
        private void addCompositeReference() {
 
                int refHeight = comp.getRefHeight();
+               
                int x=(comp.getX()+comp.getWidth())-(refHeight*2/3);
-               int y=comp.getY() + Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE;
+               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();
@@ -497,9 +502,19 @@ public class DiagramGenerator {
 
        }
 
+       //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() + Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY;
+               
+               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()){
@@ -537,7 +552,7 @@ public class DiagramGenerator {
                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() 
+comp.getWidth()/2, comp.getY() +20, comp.getName());
+               Element text = Text.addTextElement(doc, svgNS, comp.getX()+20, 
comp.getY() +20, comp.getName());
 
                svgRoot.appendChild(composi);
                svgRoot.appendChild(text);

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
 Fri Aug 12 02:55:15 2011
@@ -82,6 +82,7 @@ public class LayoutBuilder {
                        assignPositions(startEnt);
                }
                
+               assignPositionsOfOtherConncetedEntities();//such as a different 
cluster of components
                assignPositionsOfIdleEntities();
                assignCoordinates();
                
@@ -93,7 +94,17 @@ public class LayoutBuilder {
 
                for(Entity ent: elts){
                        if(!ent.isPossitionSet()){
-                               this.setPosition(ent, ++currentMaxLevel, 0);
+                               
+                               setPosition(ent, currentMaxLevel++, 0);
+                       }
+               }
+       }
+               
+       private void assignPositionsOfOtherConncetedEntities() {
+
+               for(Entity ent: elts){
+                       if(!ent.isPossitionSet() && isConnected(ent.getId())){
+                               assignPositions(ent);
                        }
                }
        }

Modified: 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
URL: 
http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java?rev=1156944&r1=1156943&r2=1156944&view=diff
==============================================================================
--- 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
 (original)
+++ 
tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
 Fri Aug 12 02:55:15 2011
@@ -38,7 +38,7 @@ public class Main {
        public static void main(String[] args) throws Exception {
 
                XMLReader reader = new XMLReader();
-               Document doc 
=reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite.xml");//composite1.xml
 composite_with_compositeService.xml");
+               Document doc 
=reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite_with_compositeService.xml");//composite1.xml
 composite_with_compositeService.xml");
                EntityBuilder eb = new EntityBuilder(doc);
                CompositeEntity comp =eb.buildCompositeEntity();
                


Reply via email to