incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r954223 - in /incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat: Relationship.js elements/RelationshipElement.js
Date Sun, 13 Jun 2010 13:41:09 GMT
Author: zoe
Date: Sun Jun 13 13:41:08 2010
New Revision: 954223

URL: http://svn.apache.org/viewvc?rev=954223&view=rev
Log:
ARIES-319 Make relationsip elements register both ends of the relationship with the appropriate
components

Modified:
    incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/Relationship.js
    incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/elements/RelationshipElement.js

Modified: incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/Relationship.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/Relationship.js?rev=954223&r1=954222&r2=954223&view=diff
==============================================================================
--- incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/Relationship.js
(original)
+++ incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/Relationship.js
Sun Jun 13 13:41:08 2010
@@ -65,47 +65,32 @@ update : function(sscRelationship){
 	this.activate();
 },
 activate : function(){
-	//create relationship element for each connection defined by this relationship.
 	//console.log(">activate");
+	
+	//Create a relationship element for each consuming component. Use the consuming component
because it's
+	//a 1:1 relationship whereas the providing component may provide the element to many different
consuming
+	//components.
+	
 	dojo.forEach(this.sscRelationship.consumedBy, function(component){
 		//console.log("processing relationship prov by "+this.sscRelationship.providedBy.id+" to
"+component.id);
 		
-		// What values do we expect for the types?
-		//surface, name, type, fromComponent, toComponent, aspects
 		var r = new goat.elements.RelationshipElement(surface, this.sscRelationship.name, this.sscRelationship.type,
components[this.sscRelationship.providedBy.id],components[component.id] );
-		// Add a decorator if needed 
+
 		console.log("type is " + this.sscRelationship.type);
-		if(this.sscRelationship.type=="packageImport"){
-	//		this.typeOffset=5;
-	//		this.stroke = '#F08080';
-		}else if(this.sscRelationship.type=="packageExport"){
-	//		this.stroke = '#80F080';
-	//		this.typeOffset=-5;
-		} else if (this.sscRelationship.type == "serviceExport") {
-										// this.stroke = '#F080F0';
-										// this.typeOffset=10;
-										r
-												.addDecorator(new goat.elements.TriangleDecorator(
-														this.theme,surface));
-									} else if (this.sscRelationship.type == "serviceImport") {
-										// this.stroke = '#8080F0';
-										// this.typeOffset=-10;
-										r
-												.addDecorator(new goat.elements.TriangleDecorator(
-														this.theme,surface));
-									} else if (this.sscRelationship.type == "Service") {
-										//		this.stroke = '#8080F0';
-										//		this.typeOffset=-10;
-										var d = new goat.elements.TriangleDecorator(
-												this.theme,surface);
-										r.addDecorator(d);
-									}
+		//Add a service decorator if it is a service relationship
+		if (this.sscRelationship.type == "serviceExport") {
+			r.addDecorator(new goat.elements.TriangleDecorator(this.theme,surface));
+
+		} else if (this.sscRelationship.type == "serviceImport") {
+			r.addDecorator(new goat.elements.TriangleDecorator(this.theme,surface));
+
+		} else if (this.sscRelationship.type == "Service") {
+			r.addDecorator(new goat.elements.TriangleDecorator(this.theme,surface));
+		}
 
 		
 		//console.log("create of relationship element complete");
 		this.relationshipElements.push(r);
-		//hmm.. do we want to reverse-register the relationship like this?
-		components[component.id].relationshipManager.registerRelationship(r);	
 	},this);	
 	//console.log(this.relationshipElements);
 	//console.log("<activate");

Modified: incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/elements/RelationshipElement.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/elements/RelationshipElement.js?rev=954223&r1=954222&r2=954223&view=diff
==============================================================================
--- incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/elements/RelationshipElement.js
(original)
+++ incubator/aries/trunk/samples/goat/goat-web/src/main/resources/web/goat/elements/RelationshipElement.js
Sun Jun 13 13:41:08 2010
@@ -82,15 +82,16 @@ constructor: function(surface, name, typ
 	this.subs.push(dojo.subscribe("goat.component.onclick."+toComponent.id, this, this.onComponentClick));
 	this.subs.push(dojo.subscribe("goat.component.onclick."+fromComponent.id, this, this.onComponentClick));
 
-    // When a component is resized teh relationship line needs to eb re-drawn.
+    // When a component is resized teh relationship line needs to be re-drawn.
     this.subs.push(dojo.subscribe("goat.component.resize."+fromComponent.id, this, this.onComponentResize));
     this.subs.push(dojo.subscribe("goat.component.resize."+toComponent.id, this, this.onComponentResize));
     
 	
 	this.decorators = new Array();
 	
-	//console.log("Publishing relationship create event");
+	console.log("Publishing relationship create to event", fromComponent.id, toComponent.id);
 	dojo.publish("goat.relationship.create."+fromComponent.id,[this]);
+	dojo.publish("goat.relationship.create."+toComponent.id,[this]);
 },
 addDecorator: function(decorator) {
 	decorator.setStroke(this.stroke);



Mime
View raw message