From f5548ef1d2348de2cc447720f89fee58e3b73c75 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Mon, 14 Jun 2010 18:03:13 +0000 Subject: [PATCH] update route editors when entity joins a relation --- TODO.txt | 1 - .../mapfeatures/editors/RelationMemberEditor.as | 5 +++-- .../mapfeatures/editors/RouteEditor.mxml | 16 ++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/TODO.txt b/TODO.txt index 8ca909d1..b7d598d6 100644 --- a/TODO.txt +++ b/TODO.txt @@ -29,7 +29,6 @@ Potlatch 2: main outstanding issues == Tag editing == ** Doesn't always update selected tab when you select a new entity -** Doesn't update selected tab when you change the relations on an entity * Dynamic reloading of stylesheet/map_features, so that you don't need to reload the full page when editing them * If a select name is too long then, the select menu seems to give a horizontal scrollbar instead of the name of the item e.g. cuisine#Coffee Shop * If you have both inputSets names and buildingAddress, and name= key is filled in then the basic tab will get both, surely only name should be shown and building name should be ignored e.g. cafes. [Actually this was an issue of addr: being missing from one of them, however this may still be a problem for other overlapping inputSets] diff --git a/net/systemeD/potlatch2/mapfeatures/editors/RelationMemberEditor.as b/net/systemeD/potlatch2/mapfeatures/editors/RelationMemberEditor.as index 8d371fb9..f002cc20 100644 --- a/net/systemeD/potlatch2/mapfeatures/editors/RelationMemberEditor.as +++ b/net/systemeD/potlatch2/mapfeatures/editors/RelationMemberEditor.as @@ -62,11 +62,12 @@ package net.systemeD.potlatch2.mapfeatures.editors { public function set entity(entity:Entity):void { _entity = entity; - // TODO: we need to listen for add/removal and relation tag changes + entity.addEventListener(Connection.ADDED_TO_RELATION, relationsChanged); + entity.addEventListener(Connection.REMOVED_FROM_RELATION, relationsChanged); dispatchEvent(new Event("relations_changed")); } - private function relationsChanged(event:TagEvent):void { + protected function relationsChanged(event:Event):void { dispatchEvent(new Event("relations_changed")); } diff --git a/net/systemeD/potlatch2/mapfeatures/editors/RouteEditor.mxml b/net/systemeD/potlatch2/mapfeatures/editors/RouteEditor.mxml index 6ab87fc3..22071dc8 100644 --- a/net/systemeD/potlatch2/mapfeatures/editors/RouteEditor.mxml +++ b/net/systemeD/potlatch2/mapfeatures/editors/RouteEditor.mxml @@ -18,7 +18,9 @@ import mx.managers.PopUpManager; import mx.core.*; - public function addRoutes():void { + public function addRoutes(event:Event=null):void { + routeIcons.removeAllChildren(); + addEventListener("routes_changed", addRoutes); for each(var relation:Object in matchedRelations) { var icon:RouteIcon = new RouteIcon(); icon.setRoute(relation, RouteEditorFactory(_factory).icon); @@ -30,17 +32,19 @@ public function routeClicked(event:Event):void { var relation:Object = RouteIcon(event.currentTarget).route; - trace(relation+" is clicked"); var panel:RelationEditorPanel = RelationEditorPanel( PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true)); panel.setRelation(relation["relation"]); PopUpManager.centerPopUp(panel); } - public function addToRelation():void { - new RelationSelectPanel().init(_entity, _factory.relationTags); - } - + public function addToRelation():void { + new RelationSelectPanel().init(_entity, _factory.relationTags); + } + + override protected function relationsChanged(event:Event):void { + dispatchEvent(new Event("routes_changed")); + } ]]> -- 2.37.0