1 <?xml version="1.0" encoding="utf-8"?>
3 xmlns:mx="http://www.adobe.com/2006/mxml"
4 xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
5 toolTip="{fieldDescription}"
6 direction="horizontal" styleName="titledEditor">
8 <mx:Label text="{fieldName}:"/>
9 <edit:ChoiceComboBox id="inputBox" dataProvider="{choices}" selectedItem="{selectFromTag}"
10 dropdownFactory="mx.controls.TileList"
11 change="value = inputBox.selectedItem.value"
12 itemRenderer="net.systemeD.potlatch2.mapfeatures.editors.RestrictionRenderer"
13 dropdownWidth="250" rowCount="4"
15 </edit:ChoiceComboBox>
18 import mx.collections.*;
20 import net.systemeD.potlatch2.mapfeatures.Feature;
22 private var _choices:ArrayCollection = null;
23 private var _unknownChoice:SpeedChoice = null;
25 [Bindable(event="factory_set")]
26 protected function get choices():ArrayCollection {
27 if ( _choices == null ) {
28 _choices = new ArrayCollection();
29 for each(var sp:String in
30 ["5mph", "10mph", "15mph", "20mph", "30mph", "40mph", "50mph", "60mph","70mph",
31 "10", "20", "50", "60", "90", "100", "110", "130"])
32 _choices.addItem(new SpeedChoice(sp));
33 _choices.addItem(new SpeedChoice(null));
38 [Bindable(event="tag_changed")]
39 protected function get selectFromTag():Object {
40 if ( _entity == null )
41 return new SpeedChoice(null);
43 var tagValue:String = value;
44 for each(var choice:SpeedChoice in choices) {
45 if ( choice.isTagMatch(tagValue) )
49 // set up the unknown choice
50 if ( _unknownChoice == null ) {
51 _unknownChoice = new SpeedChoice(tagValue);
52 _choices.addItem(_unknownChoice);
54 _unknownChoice.value = tagValue;
56 return _unknownChoice;
59 private function createUnsetChoice():Choice {
60 var choice:Choice = new Choice();
62 choice.description = "Field not set";
63 choice.label = "<i>Unset</i>";
68 </edit:SingleTagEditor>