summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java')
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java70
1 files changed, 37 insertions, 33 deletions
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);