1 <?xml version="1.0" encoding="utf-8"?>
2 <edit:RelationMemberEditor
3 xmlns:mx="http://www.adobe.com/2006/mxml"
4 xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
5 xmlns:flexlib="flexlib.controls.*"
8 toolTip="{fieldDescription}"
9 initialize="addRoutes()">
11 <mx:Label text="{fieldName}:"/>
12 <mx:VBox verticalGap="0" width="100%" id="routeIcons"/>
13 <mx:LinkButton label="Add to route" click="addToRelation()" />
16 import net.systemeD.halcyon.connection.*;
17 import net.systemeD.potlatch2.*;
18 import mx.managers.PopUpManager;
21 public function addRoutes(event:Event=null):void {
22 routeIcons.removeAllChildren();
23 addEventListener("relations_changed", addRoutes);
24 for each(var relation:Object in matchedRelations) {
25 var icon:RouteIcon = new RouteIcon();
26 icon.setRoute(relation, RouteEditorFactory(_factory).icon);
28 icon.addEventListener(MouseEvent.CLICK, routeClicked);
29 routeIcons.addChild(icon);
33 public function routeClicked(event:Event):void {
34 var relation:Object = RouteIcon(event.currentTarget).route;
35 var panel:RelationEditorPanel = RelationEditorPanel(
36 PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
37 panel.setRelation(relation["relation"]);
38 PopUpManager.centerPopUp(panel);
41 public function addToRelation():void {
42 new RelationSelectPanel().init(_entity, _factory.relationTags);
46 </edit:RelationMemberEditor>