Merge branch 'master' of github.com:systemed/potlatch2
[potlatch2.git] / net / systemeD / potlatch2 / panels / MarkerPanel.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4     Marker Panel
5 -->
6
7 <mx:VBox
8     xmlns:fx="http://ns.adobe.com/mxml/2009"
9     xmlns:mx="library://ns.adobe.com/flex/mx"
10     height="100%">
11   <mx:Text id="markerPanelText" text="You have selected a marker." width="100%" styleName="helpInfo" />
12   <mx:DataGrid editable="false" id="markerPanelDG" width="100%" height="50%">
13     <mx:columns>
14       <mx:DataGridColumn editable="false" dataField="key" headerText="key" />
15       <mx:DataGridColumn editable="false" dataField="value" headerText="value" />
16     </mx:columns>
17   </mx:DataGrid>
18   <fx:Script><![CDATA[
19
20       import net.systemeD.halcyon.connection.*;
21       import net.systemeD.halcyon.MapPaint;
22       import mx.collections.*;
23
24       private var selectedEntity:Entity;
25       private var tagDataProvider:ArrayCollection;
26       private var layer:MapPaint;
27
28       public function init(entity:Entity, layer:MapPaint):void {
29             this.layer = layer;
30             if ( tagDataProvider == null ) {
31                 tagDataProvider = new ArrayCollection();
32                 markerPanelDG.dataProvider = tagDataProvider;
33             }
34
35             selectedEntity=entity;
36             updateTagDataProvider();
37       }
38
39       private function updateTagDataProvider():void {
40             tagDataProvider.removeAll();
41             if (selectedEntity==null) { return; }
42             var tags:Array = selectedEntity.getTagArray();
43             tags.sortOn("key");
44             for each(var tag:Tag in tags) { tagDataProvider.addItem(tag); }
45       }
46       ]]>
47   </fx:Script>
48 </mx:VBox>