Make the dialog automatically fetch the traces. Still needs a guard against repeatedl...
authorAndy Allan <gravitystorm@gmail.com>
Mon, 11 Oct 2010 17:04:18 +0000 (17:04 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Mon, 11 Oct 2010 17:04:18 +0000 (17:04 +0000)
net/systemeD/halcyon/connection/Connection.as
net/systemeD/halcyon/connection/XMLConnection.as
net/systemeD/potlatch2/mygpx/MyGpxDialog.mxml

index 73e3982..93562e3 100755 (executable)
@@ -344,6 +344,10 @@ package net.systemeD.halcyon.connection {
             traces.push(t);
         }
 
+        protected function clearTraces():void {
+            traces = [];
+        }
+
         public function getTraces():Array {
             return traces;
         }
index 90bdc5e..0b2aff8 100644 (file)
@@ -329,10 +329,7 @@ package net.systemeD.halcyon.connection {
         }
 
         private function tracesLoadComplete(event:Event):void {
-            //for each result in XML file
-            //  create a trace object
-            //  store in connection.traces
-            //emit event
+            clearTraces();
             var files:XML = new XML(URLLoader(event.target).data);
             for each(var traceData:XML in files.gpx_file) {
               var t:Object = {};
index a9ee8fe..f0b0293 100644 (file)
@@ -27,6 +27,7 @@
         this.addEventListener(CloseEvent.CLOSE, myGpxDialog_close);
 
         map = Globals.vars.root;
+        fetchList();
     }
 
     private function myGpxDialog_close(evt:CloseEvent):void {
@@ -76,7 +77,6 @@
   </mx:Script>
 
   <mx:Text text="foo" id="results" />
-  <mx:Button label="fetch" click="fetchList()" />
   <mx:DataGrid dataProvider="{traces}" width="100%" height="100%" id="traceGrid">
     <mx:columns>
             <mx:DataGridColumn editable="false" dataField="id" headerText="id" width="45"/>
@@ -94,4 +94,7 @@
             </mx:DataGridColumn>
     </mx:columns>
   </mx:DataGrid>
+  <mx:ControlBar>
+    <mx:Button label="Refresh List" click="fetchList()" />
+  </mx:ControlBar>
 </mx:TitleWindow>
\ No newline at end of file