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