From acb77d471e5f0597ccaf7e2da4911ee24f84fb5f Mon Sep 17 00:00:00 2001 From: nirmal070125 Date: Thu, 11 Aug 2011 14:50:14 +0000 Subject: Few adjustments based on suggestions from Jean and Ant git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1156638 13f79535-47bb-0310-9956-ffa450edef68 --- .../input/composite_with_compositeService.xml | 2 +- .../output/Calculator_diagram.svg | 2 +- .../output/MyValueComposite2_diagram.svg | 2 +- .../output/store_diagram.svg | 2 +- .../output/supplychain_diagram.svg | 2 +- .../sca/impl/artifacts/CompositeArtifact.java | 2 +- .../tuscany/sca/impl/artifacts/Constant.java | 2 +- .../apache/tuscany/sca/impl/artifacts/Layer.java | 2 +- .../tuscany/sca/impl/diagram/DiagramGenerator.java | 70 ++++++++++++---------- .../tuscany/sca/impl/layout/ComponentEntity.java | 2 +- .../java/org/apache/tuscany/sca/main/Main.java | 2 +- 11 files changed, 47 insertions(+), 43 deletions(-) (limited to 'collaboration') diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml index 722bdeb0a5..33809ea6c3 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml @@ -62,7 +62,7 @@ + promote="MyValueServiceComponent/customerService StockQuoteMediatorComponent"> diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg index 70540cfe70..eb342f4c7e 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg @@ -1 +1 @@ -CalculatorCalculatorServiceComponentCalculatorServiceaddServicesubtractServicemultiplyServicedivideServiceAddServiceComponentAddServiceSubtractServiceComponentSubtractServiceMultiplyServiceComponentMultiplyServiceDivideServiceComponentDivideServiceIncluded Composites \ No newline at end of file +CalculatorCalculatorServiceComponentCalculatorServiceaddServicesubtractServicemultiplyServicedivideServiceAddServiceComponentAddServiceSubtractServiceComponentSubtractServiceMultiplyServiceComponentMultiplyServiceDivideServiceComponentDivideService \ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg index 66adacf9e1..294a7e03df 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg @@ -1 +1 @@ -MyValueComposite2MyValueServiceComponentmyValueServicestockQuoteServicecustomerServicecurrencyStockQuoteMediatorComponentSQMediatorstockQuoteServicecurrencyMyValueServiceCustomerServiceStockQuoteServiceIncluded Composites store , Calculator , supplychain , \ No newline at end of file +MyValueComposite2MyValueServiceComponentmyValueServicestockQuoteServicecustomerServicecurrencyStockQuoteMediatorComponentSQMediatorstockQuoteServicecurrencyMyValueServiceCustomerServiceStockQuoteServiceIncluded Composites store , Calculator , supplychain , \ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg index 46eea2290d..396cc733b9 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg @@ -1 +1 @@ -storeStoreWidgetcatalogshoppingCartshoppingTotalCatalogCatalogcurrencyConvertercurrencyCodeShoppingCartCartTotalCurrencyConverterCurrencyConverterIncluded Composites \ No newline at end of file +storeStoreWidgetcatalogshoppingCartshoppingTotalCatalogcurrencyCodeCatalogcurrencyConverterShoppingCartCartTotalCurrencyConverterCurrencyConverter \ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg index a56a2c1c79..11be7dd98d 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg @@ -1 +1 @@ -supplychainCustomerComponentCustomerComponentretailerRetailerComponentRetailerComponentwarehouseWarehouseComponentWarehouseComponentshipperShipperComponentShipperComponentcustomerIncluded Composites \ No newline at end of file +supplychainCustomerComponentCustomerComponentretailerRetailerComponentRetailerComponentwarehouseWarehouseComponentWarehouseComponentshipperShipperComponentShipperComponentcustomer \ No newline at end of file diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java index 34f3dd7fa9..af2a525577 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java @@ -46,7 +46,7 @@ public class CompositeArtifact extends Artifact{ rectangle.setAttributeNS(null, "height", height+""); rectangle.setAttributeNS(null, "fill", "#E5E5E5"); rectangle.setAttributeNS(null, "stroke", "#919191"); - rectangle.setAttributeNS(null, "alignment-baseline", "central"); + rectangle.setAttributeNS(null, "alignment-baseline", "middle"); return rectangle; } diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java index 24f755616f..79d7a2981a 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java @@ -21,6 +21,6 @@ public final class Constant { 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_TEXT = 1 ; } diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java index 22ec76ff09..0a1ca90c1d 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java @@ -46,7 +46,7 @@ public class Layer extends Artifact{ rectangle.setAttributeNS(null, "height", height+""); rectangle.setAttributeNS(null, "fill", "#E5E5D0"); rectangle.setAttributeNS(null, "stroke", "#919191"); - rectangle.setAttributeNS(null, "alignment-baseline", "central"); + rectangle.setAttributeNS(null, "alignment-baseline", "middle"); return rectangle; } diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java index 166ec6abe3..07c781f3e4 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java @@ -99,14 +99,14 @@ public class DiagramGenerator { for(ComponentEntity ent: comp.getComponentList()){ addComponent(ent); + addComponentProperties(ent); addComponentService(ent); addComponentReference(ent); - addComponentProperties(ent); } + addCompositeProperties(); addCompositeService(); addCompositeReference(); - addCompositeProperties(); addComponentConnections(); addReferencePromotion(); @@ -164,31 +164,35 @@ public class DiagramGenerator { } private void addInclusions() { - 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, ""); - - for(String includedComposite : comp.getIncludedComposites()){ - - Link link = new Link(); - Element aLink = link.addElement(doc, svgNS, includedComposite+comp.getFileNameSuffix(), includedComposite); - text.appendChild(aLink); + + 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, ""); + + for(String includedComposite : comp.getIncludedComposites()){ + + Link link = new Link(); + Element aLink = link.addElement(doc, svgNS, includedComposite+comp.getFileNameSuffix(), includedComposite); + text.appendChild(aLink); + + } + svgRoot.appendChild(text); } - svgRoot.appendChild(text); } /** @@ -286,7 +290,7 @@ public class DiagramGenerator { 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, prop); + Element text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, prop); svgRoot.appendChild(property); svgRoot.appendChild(text); @@ -307,7 +311,7 @@ public class DiagramGenerator { 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+refHeight/2, ref); + Element text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, ref); svgRoot.appendChild(polygon); svgRoot.appendChild(text); @@ -426,9 +430,9 @@ public class DiagramGenerator { Element polygon = serve.addElement(doc, svgNS, x, y, serHeight); Element text; if(!ser.endsWith("Impl")) - text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ser); + text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, ser); else - text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ""); + text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, ""); svgRoot.appendChild(polygon); svgRoot.appendChild(text); @@ -455,9 +459,9 @@ public class DiagramGenerator { Element polygon = serve.addElement(doc, svgNS, x, y, serHeight); Element text; if(!ser.endsWith("Impl")) - text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ser); + text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, ser); else - text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ""); + text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, ""); svgRoot.appendChild(polygon); svgRoot.appendChild(text); @@ -479,7 +483,7 @@ public class DiagramGenerator { 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+refHeight/2, ref); + Element text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, ref); svgRoot.appendChild(polygon); svgRoot.appendChild(text); @@ -501,7 +505,7 @@ public class DiagramGenerator { 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, prop); + Element text = Text.addTextElement(doc, svgNS, x, y-Constant.SPACING_FOR_TEXT, prop); svgRoot.appendChild(property); svgRoot.appendChild(text); diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java index 9059187c6d..9f71f3aa1e 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java @@ -51,7 +51,7 @@ public class ComponentEntity extends Entity{ setStartPosition(200); setHeight(Constant.COMPONENT_DEFAULT_HEIGHT); - setWidth(Constant.COMPONENT_DEFAULT_HEIGHT); + setWidth(Constant.COMPONENT_DEFAULT_WIDTH); setDefaultNoOfSers( Constant.COMPONENT_DEFAULT_HEIGHT / diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java index f56c88aed4..67e9a5019e 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java @@ -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_with_compositeService.xml");//composite1.xml composite_with_compositeService.xml"); + Document doc =reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite.xml");//composite1.xml composite_with_compositeService.xml"); EntityBuilder eb = new EntityBuilder(doc); CompositeEntity comp =eb.buildCompositeEntity(); -- cgit v1.2.3