Update bug when it has been closed, using the closure approach
authorAndy Allan <gravitystorm@gmail.com>
Tue, 23 Nov 2010 12:01:44 +0000 (12:01 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Tue, 23 Nov 2010 12:01:44 +0000 (12:01 +0000)
TODO.txt
net/systemeD/potlatch2/BugLayer.as

index 717e9b4..315d047 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -61,7 +61,6 @@ Potlatch 2: main outstanding issues
 == Bug Layer ==
 
 * sort out the z-ordering so they appear above polygons/lines in halcyon
-* finish the delete bug code
 * Add comments etc
 
 Requested enhancements
index 7233486..01e9d6c 100644 (file)
@@ -2,7 +2,8 @@ package net.systemeD.potlatch2 {
 
     import net.systemeD.halcyon.VectorLayer;
     import net.systemeD.halcyon.Map;
-    import net.systemeD.halcyon.connection.Marker;
+    import net.systemeD.halcyon.connection.*;
+    import net.systemeD.halcyon.connection.actions.*;
     import flash.net.*;
     import flash.events.*;
     import com.adobe.serialization.json.JSON;
@@ -36,12 +37,12 @@ package net.systemeD.potlatch2 {
             urlReq.data = '    '; // dear Adobe, this is nuts, kthxbye (you can't POST with an empty payload)
             var loader:URLLoader = new URLLoader();
             loader.load(urlReq);
-            loader.addEventListener(Event.COMPLETE, bugClosed);
+            loader.addEventListener(Event.COMPLETE, function(e:Event):void { bugClosed(e, m); } );
         }
 
-        private function bugClosed(event:Event):void {
-            trace("bug closed");
-            // remove it from the layer, redraw, fix selection etc.
+        private function bugClosed(event:Event, marker:Marker):void {
+            var action:UndoableEntityAction = new SetTagAction(marker, "status", status[int(BUG_STATUS_FIXED)]);
+            action.doAction(); // just do it, don't add to undo stack
         }
 
         public override function loadBbox(left:Number, right:Number,