summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca
diff options
context:
space:
mode:
authornirmal070125 <nirmal070125@13f79535-47bb-0310-9956-ffa450edef68>2011-08-11 14:50:14 +0000
committernirmal070125 <nirmal070125@13f79535-47bb-0310-9956-ffa450edef68>2011-08-11 14:50:14 +0000
commitacb77d471e5f0597ccaf7e2da4911ee24f84fb5f (patch)
treee6ad78905bce8843bb386c856d43ad52974939d8 /collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca
parentcce27a3d7516195a56d864d85097ba5c98ccbdf8 (diff)
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
Diffstat (limited to '')
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java70
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java2
6 files changed, 42 insertions, 38 deletions
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();