Add a panel for background features - based on the marker panel
authorAndy Allan <andy@gravitystorm.co.uk>
Fri, 3 Jun 2011 12:47:36 +0000 (13:47 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Fri, 3 Jun 2011 12:47:36 +0000 (13:47 +0100)
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/panels/BackgroundPanel.mxml [new file with mode: 0644]

index 5da5c22535b3a873c0f41c10f450d78be705a9f8..d477a57d3a8dcf373ade8f9098632bfd4ed28f49 100644 (file)
     <sidepanel:BugPanel id="bugPanelContents" width="100%"/>
   </mx:VBox>
 
+  <!-- Background layer selection -->
+
+  <mx:VBox id="backgroundPanel" width="100%" height="100%" horizontalScrollPolicy="off" styleName="dndPanelVbox">
+    <sidepanel:BackgroundPanel id="backgroundPanelContents" width="100%"/>
+  </mx:VBox>
+
 </mx:ViewStack>
 
   <mx:Script><![CDATA[
       import net.systemeD.halcyon.connection.*;
       import net.systemeD.halcyon.MapPaint;
       import net.systemeD.potlatch2.mapfeatures.*;
+      import net.systemeD.potlatch2.utils.*;
 
       import mx.collections.*;
       import mx.containers.*;
             } else if (selectedEntity is Marker) {
               markerPanelContents.init(selectedEntity, layer);
               sidebar.selectedChild = markerPanel;
+            } else if (connection is SnapshotConnection) {
+              backgroundPanelContents.init(selectedEntity, layer);
+              sidebar.selectedChild = backgroundPanel;
             } else {
               refreshFeatureIcon();
               initialiseEditors();
diff --git a/net/systemeD/potlatch2/panels/BackgroundPanel.mxml b/net/systemeD/potlatch2/panels/BackgroundPanel.mxml
new file mode 100644 (file)
index 0000000..cd60f01
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Background Panel
+-->
+
+<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%">
+  <mx:Text id="backgroundPanelText" text="You have selected a Background Feature." width="100%" styleName="helpInfo" />
+  <mx:DataGrid editable="false" id="backgroundPanelDG" width="100%" height="50%">
+    <mx:columns>
+      <mx:DataGridColumn editable="false" dataField="key" headerText="key" />
+      <mx:DataGridColumn editable="false" dataField="value" headerText="value" />
+    </mx:columns>
+  </mx:DataGrid>
+  <mx:Script><![CDATA[
+
+      import net.systemeD.halcyon.connection.*;
+      import net.systemeD.halcyon.MapPaint;
+      import mx.collections.*;
+
+      private var selectedEntity:Entity;
+      private var tagDataProvider:ArrayCollection;
+      private var layer:MapPaint;
+
+      public function init(entity:Entity, layer:MapPaint):void {
+            this.layer = layer;
+            if ( tagDataProvider == null ) {
+                tagDataProvider = new ArrayCollection();
+                backgroundPanelDG.dataProvider = tagDataProvider;
+            }
+
+            selectedEntity=entity;
+            updateTagDataProvider();
+      }
+
+      private function updateTagDataProvider():void {
+            tagDataProvider.removeAll();
+            if (selectedEntity==null) { return; }
+            var tags:Array = selectedEntity.getTagArray();
+            tags.sortOn("key");
+            for each(var tag:Tag in tags) { tagDataProvider.addItem(tag); }
+      }
+
+      ]]>
+  </mx:Script>
+</mx:VBox>
\ No newline at end of file