Integrating search functionality from AntTheLimey
[potlatch2.git] / net / systemeD / potlatch2 / StyleSelector.mxml
index b2e5609..d839ad7 100644 (file)
@@ -4,25 +4,20 @@
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
-       <mx:List width="100%" height="100%" id="mapStyle" change="updateMapStyle();"> 
-           <!-- This should be pulled in from an XML file rather than sitting in the source -->
-           <mx:dataProvider>
-               <mx:Object label="Potlatch" data="potlatch.css" />
-               <mx:Object label="Wireframe" data="wireframe.css" />
-           </mx:dataProvider>
-       </mx:List>
+       <mx:List width="100%" height="100%" id="mapStyle" 
+               labelField="name"
+               change="Application.application.styleButton.close(); Stylesheets.instance().setStylesheet(mapStyle.selectedItem.name, mapStyle.selectedItem.url);"
+               dataProvider="{Stylesheets.instance().getCollection()}"
+               rowCount="{Stylesheets.instance().getCollection().length}" />
+
+       <mx:Button label="Edit..." click="Application.application.styleButton.close(); new BackgroundDialog().init('Map style',mapStyle,Stylesheets.instance());" />
 
        <mx:Script><![CDATA[
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
-
-               private function updateMapStyle():void {
-            var theMap:Map = Globals.vars.root;
-                       var style:String=mapStyle.selectedItem.data;
-                       theMap.setStyle(style);
-               }
-
+               import net.systemeD.potlatch2.collections.Stylesheets;
+               import mx.core.*;
     ]]></mx:Script>    
 </mx:VBox>