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="addTurnRestrictions()">
11 <mx:Label text="{fieldName}:"/>
12 <mx:VBox verticalGap="0" width="100%" id="turnRestrictionIcons"/>
13 <mx:LinkButton label="Add new turn restriction" click="addNewTurnRestriction()" />
16 import net.systemeD.halcyon.connection.*;
17 import net.systemeD.potlatch2.*;
20 /* ** FIXME: some of this is common with RouteEditor.mxml. We can probably refactor */
22 public function addTurnRestrictions(event:Event=null):void {
23 turnRestrictionIcons.removeAllChildren();
24 addEventListener("relations_changed", addTurnRestrictions);
25 for each(var relation:Object in matchedRelations) {
26 var icon:TurnRestrictionIcon = new TurnRestrictionIcon();
27 icon.setTurnRestriction(relation);
28 turnRestrictionIcons.addChild(icon);
32 public function addNewTurnRestriction():void {
33 var relation:Relation = _entity.connection.createRelation(
34 { type: 'restriction' },
35 [ new RelationMember(_entity, 'via') ],
36 MainUndoStack.getGlobalStack().addAction);
37 addTurnRestrictions();
41 </edit:RelationMemberEditor>