Create a separate BugPanel, and move the panels into a subfolder - perhaps do this...
authorAndy Allan <gravitystorm@gmail.com>
Tue, 23 Nov 2010 14:51:10 +0000 (14:51 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Tue, 23 Nov 2010 14:51:10 +0000 (14:51 +0000)
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/panels/BugPanel.mxml [new file with mode: 0644]
net/systemeD/potlatch2/panels/MarkerPanel.mxml [moved from net/systemeD/potlatch2/MarkerPanel.mxml with 100% similarity]

index 0b1898a..46fbb23 100644 (file)
@@ -4,6 +4,7 @@
        xmlns:flexlib="flexlib.containers.*"
        xmlns:controls="net.systemeD.controls.*"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
+    xmlns:sidepanel="net.systemeD.potlatch2.panels.*"
        horizontalScrollPolicy="off"
     backgroundColor="white"
     initialize="loadFeatures()">
   </mx:VBox>
 
   <mx:VBox id="markerPanel" width="100%" height="100%" horizontalScrollPolicy="off" styleName="dndPanelVbox">
-    <potlatch2:MarkerPanel id="markerPanelContents" width="100%"/>
+    <sidepanel:MarkerPanel id="markerPanelContents" width="100%"/>
+  </mx:VBox>
+
+  <mx:VBox id="bugPanel" width="100%" height="100%" horizontalScrollPolicy="off" styleName="dndPanelVbox">
+    <sidepanel:BugPanel id="bugPanelContents" width="100%"/>
   </mx:VBox>
 
 </mx:ViewStack>
                        if (selectedEntity!=null) { selectedEntity.addEventListener(Connection.TAG_CHANGED, tagChanged); }
                        if (advancedID!=null) { setupAdvanced(firstSelected); }
                        if (firstSelected is Relation) { stack.addChild(membersVBox); }
-            if (selectedEntity is Marker) {
+            if (selectedEntity is Marker && layer is BugLayer) {
+              bugPanelContents.init(selectedEntity, layer);
+              sidebar.selectedChild = bugPanel;
+            } else if (selectedEntity is Marker) {
               markerPanelContents.init(selectedEntity, layer);
               sidebar.selectedChild = markerPanel;
             } else {
diff --git a/net/systemeD/potlatch2/panels/BugPanel.mxml b/net/systemeD/potlatch2/panels/BugPanel.mxml
new file mode 100644 (file)
index 0000000..a176256
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+    Bug Panel
+-->
+
+<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%">
+  <mx:Text id="markerPanelText" text="You have selected a BUG!!1!." width="100%" styleName="helpInfo" />
+  <mx:DataGrid editable="false" id="markerPanelDG" 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:HBox id="bugControl" horizontalAlign="right" width="100%" visible="false">
+    <mx:LinkButton label="Add Comment" enabled="false" />
+    <mx:LinkButton label="Close Bug" click="closeBug()" />
+  </mx:HBox>
+  <mx:Script><![CDATA[
+
+      import net.systemeD.halcyon.connection.*;
+      import net.systemeD.halcyon.VectorLayer;
+      import net.systemeD.potlatch2.BugLayer;
+      import mx.collections.*;
+
+      private var selectedEntity:Entity;
+      private var tagDataProvider:ArrayCollection;
+      private var layer:VectorLayer;
+
+      public function init(entity:Entity, layer:VectorLayer):void {
+            this.layer = layer;
+            if ( tagDataProvider == null ) {
+                tagDataProvider = new ArrayCollection();
+                markerPanelDG.dataProvider = tagDataProvider;
+            }
+
+            selectedEntity=entity;
+            updateTagDataProvider();
+            if (layer is BugLayer) {
+              bugControl.visible = true;
+            }
+      }
+
+      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); }
+      }
+
+      private function closeBug():void {
+            if (layer is BugLayer) {
+              BugLayer(layer).closeBug(selectedEntity as Marker);
+            }
+      }
+      ]]>
+  </mx:Script>
+</mx:VBox>
\ No newline at end of file