From 9012126477dfae5d86950a98d633996512271f98 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Sat, 9 Jan 2010 19:23:20 +0000 Subject: [PATCH] Show+remove (but not add) entity at specific relation indexes --- net/systemeD/halcyon/connection/Relation.as | 10 ++++++++ net/systemeD/potlatch2/TagViewer.mxml | 26 ++++++++++++--------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/net/systemeD/halcyon/connection/Relation.as b/net/systemeD/halcyon/connection/Relation.as index f1838ce8..7d804d63 100644 --- a/net/systemeD/halcyon/connection/Relation.as +++ b/net/systemeD/halcyon/connection/Relation.as @@ -29,6 +29,16 @@ package net.systemeD.halcyon.connection { } return -1; } + + public function findEntityMemberIndexes(entity:Entity):Array { + var indexes:Array = []; + for (var index:uint = 0; index < members.length; index++) { + var member:RelationMember = members[index]; + if ( member.entity == entity ) + indexes.push(index); + } + return indexes; + } public function getMember(index:uint):RelationMember { return members[index]; diff --git a/net/systemeD/potlatch2/TagViewer.mxml b/net/systemeD/potlatch2/TagViewer.mxml index 449c05f2..e6053fd3 100644 --- a/net/systemeD/potlatch2/TagViewer.mxml +++ b/net/systemeD/potlatch2/TagViewer.mxml @@ -33,7 +33,7 @@ - + @@ -48,7 +48,8 @@ - + @@ -209,14 +210,16 @@ } else { var relations:Array = []; for each( var rel:Relation in entity.parentRelations ) { - var props:Object = {}; - props["relation"] = rel; - props["id"] = rel.id; - var memberIndex:uint = rel.findEntityMemberIndex(entity); - props["role"] = rel.getMember(memberIndex).role; - props["description"] = rel.getDescription(); - - relations.push(props); + for each( var memberIndex:int in rel.findEntityMemberIndexes(entity)) { + var props:Object = {}; + props["relation"] = rel; + props["id"] = rel.id; + props["index"] = memberIndex; + props["role"] = rel.getMember(memberIndex).role; + props["description"] = rel.getDescription(); + + relations.push(props); + } } relationsGrid.dataProvider = relations; } @@ -283,7 +286,8 @@ new RelationSelectPanel().init(selectedEntity); } - public function removeFromRelation():void { + public function removeFromRelation(id:Number, index:int):void { + Connection.getConnectionInstance().getRelation(id).removeMemberByIndex(index); } public function initFeatureBox():void { -- 2.36.1