1 <?xml version="1.0" encoding="utf-8"?>
3 xmlns:mx="http://www.adobe.com/2006/mxml"
4 layout="vertical" showCloseButton="true"
5 horizontalAlign="center" title="Background imagery"
6 width="500" height="300" verticalGap="0">
8 <mx:DataGrid editable="true" width="100%" height="100%" id="imageryGrid">
10 <mx:DataGridColumn editable="true" dataField="label" headerText="Name"/>
11 <mx:DataGridColumn editable="true" dataField="data" headerText="URL"/>
15 <mx:HBox horizontalAlign="right" width="100%">
16 <mx:LinkButton label="Delete" click="removeSource()" enabled="{imageryGrid.selectedItem != null? true : false}"/>
17 <mx:LinkButton label="Add" click="addNewSource()"/>
24 - editable hotkeys for each layer
25 - editable source tag for each layer
26 - editable bbox for each layer
27 - ability to use this dialogue to select as well as edit
28 - automatically select imagery once you've edited it (i.e. itemEditEnd)
29 - save/load imagery sets into OSM preferences
32 import mx.managers.PopUpManager;
33 import mx.events.CloseEvent;
34 import mx.core.Application;
35 import mx.collections.ArrayCollection;
36 import mx.controls.List;
38 public var imageryCollection:ArrayCollection = new ArrayCollection(Application.application.theController.imagery);
39 private var menu:List;
41 public function init(menu:List):void {
43 PopUpManager.addPopUp(this, Application(Application.application), true);
44 PopUpManager.centerPopUp(this);
45 this.addEventListener(CloseEvent.CLOSE, backgroundDialog_close);
46 imageryGrid.dataProvider=imageryCollection;
49 private function backgroundDialog_close(evt:CloseEvent):void {
50 PopUpManager.removePopUp(this);
51 if (menu) { menu.invalidateList(); }
54 private function addNewSource():void {
55 imageryCollection.addItemAt( {label:'(new name)',data:'(new URL)'} , imageryCollection.length);
56 imageryGrid.validateNow();
57 imageryGrid.verticalScrollPosition=imageryGrid.maxVerticalScrollPosition;
58 imageryGrid.editedItemPosition = {rowIndex: imageryCollection.length-1, columnIndex: 0};
60 private function removeSource():void {
61 imageryCollection.removeItemAt(imageryGrid.selectedIndex);