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"/>
12 <mx:DataGridColumn editable="false" headerText="Key" width="70">
16 selectedItem="{FunctionKeyManager.instance().getKeyFor(outerDocument.title,data.name)}"
17 dataProvider="{FunctionKeyManager.fkeysCollection}"
18 change="FunctionKeyManager.instance().setKeyFromFString(selectedItem as String,outerDocument.title,data.name)" />
25 <mx:HBox horizontalAlign="right" width="100%">
26 <mx:LinkButton label="Delete" click="removeSource()" enabled="{dataGrid.selectedItem != null? true : false}"/>
27 <mx:LinkButton label="Add" click="addNewSource()"/>
34 - editable source tag for each layer
35 - editable bbox for each layer
36 - ability to use this dialogue to select as well as edit
37 - automatically select imagery once you've edited it (i.e. itemEditEnd)
38 - edits should stick around, either in SharedObjects or OSM preferences
41 import mx.managers.PopUpManager;
42 import mx.events.CloseEvent;
43 import mx.core.Application;
44 import mx.collections.ArrayCollection;
45 import mx.controls.List;
46 import net.systemeD.potlatch2.FunctionKeyManager;
48 public var dataCollection:ArrayCollection;
49 private var menu:List;
51 public function init(title:String, menu:List, source:Array):void {
54 dataCollection=new ArrayCollection(source);
55 PopUpManager.addPopUp(this, Application(Application.application), true);
56 PopUpManager.centerPopUp(this);
57 this.addEventListener(CloseEvent.CLOSE, backgroundDialog_close);
58 dataGrid.dataProvider=dataCollection;
61 private function backgroundDialog_close(evt:CloseEvent):void {
62 PopUpManager.removePopUp(this);
63 if (menu) { menu.invalidateList(); }
66 private function addNewSource():void {
67 dataCollection.addItemAt( {name:'(new name)',url:'(new URL)'} , dataCollection.length);
68 dataGrid.validateNow();
69 dataGrid.verticalScrollPosition=dataGrid.maxVerticalScrollPosition;
70 dataGrid.editedItemPosition = {rowIndex: dataCollection.length-1, columnIndex: 0};
72 private function removeSource():void {
73 dataCollection.removeItemAt(dataGrid.selectedIndex);