Create a separate BugPanel, and move the panels into a subfolder - perhaps do this...
[potlatch2.git] / net / systemeD / potlatch2 / panels / BugPanel.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4     Bug 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 BUG!!1!." width="100%" styleName="helpInfo" />
9   <mx:DataGrid editable="false" id="markerPanelDG" width="100%" height="50%">
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:HBox id="bugControl" horizontalAlign="right" width="100%" visible="false">
16     <mx:LinkButton label="Add Comment" enabled="false" />
17     <mx:LinkButton label="Close Bug" click="closeBug()" />
18   </mx:HBox>
19   <mx:Script><![CDATA[
20
21       import net.systemeD.halcyon.connection.*;
22       import net.systemeD.halcyon.VectorLayer;
23       import net.systemeD.potlatch2.BugLayer;
24       import mx.collections.*;
25
26       private var selectedEntity:Entity;
27       private var tagDataProvider:ArrayCollection;
28       private var layer:VectorLayer;
29
30       public function init(entity:Entity, layer:VectorLayer):void {
31             this.layer = layer;
32             if ( tagDataProvider == null ) {
33                 tagDataProvider = new ArrayCollection();
34                 markerPanelDG.dataProvider = tagDataProvider;
35             }
36
37             selectedEntity=entity;
38             updateTagDataProvider();
39             if (layer is BugLayer) {
40               bugControl.visible = true;
41             }
42       }
43
44       private function updateTagDataProvider():void {
45             tagDataProvider.removeAll();
46             if (selectedEntity==null) { return; }
47             var tags:Array = selectedEntity.getTagArray();
48             tags.sortOn("key");
49             for each(var tag:Tag in tags) { tagDataProvider.addItem(tag); }
50       }
51
52       private function closeBug():void {
53             if (layer is BugLayer) {
54               BugLayer(layer).closeBug(selectedEntity as Marker);
55             }
56       }
57       ]]>
58   </mx:Script>
59 </mx:VBox>