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"
6 width="500" height="300" verticalGap="0">
8 <mx:DataGrid editable="true" width="100%" height="100%" id="dataGrid">
10 <mx:DataGridColumn editable="true" dataField="name" headerText="Name"/>
11 <mx:DataGridColumn editable="true" dataField="url" headerText="URL"/>
15 <mx:HBox horizontalAlign="right" width="100%">
16 <mx:LinkButton label="Delete" click="removeSource()" enabled="{dataGrid.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 - edits should stick around, either in SharedObjects or 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 dataCollection:ArrayCollection;
39 private var menu:List;
41 public function init(title:String, menu:List, source:Array):void {
44 dataCollection=new ArrayCollection(source);
45 PopUpManager.addPopUp(this, Application(Application.application), true);
46 PopUpManager.centerPopUp(this);
47 this.addEventListener(CloseEvent.CLOSE, backgroundDialog_close);
48 dataGrid.dataProvider=dataCollection;
51 private function backgroundDialog_close(evt:CloseEvent):void {
52 PopUpManager.removePopUp(this);
53 if (menu) { menu.invalidateList(); }
56 private function addNewSource():void {
57 dataCollection.addItemAt( {name:'(new name)',url:'(new URL)'} , dataCollection.length);
58 dataGrid.validateNow();
59 dataGrid.verticalScrollPosition=dataGrid.maxVerticalScrollPosition;
60 dataGrid.editedItemPosition = {rowIndex: dataCollection.length-1, columnIndex: 0};
62 private function removeSource():void {
63 dataCollection.removeItemAt(dataGrid.selectedIndex);