Sparkify "Add new vector layer" form
authorRichard Fairhurst <richard@systemeD.net>
Sun, 25 Mar 2012 11:33:37 +0000 (12:33 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Sun, 25 Mar 2012 11:33:37 +0000 (12:33 +0100)
net/systemeD/potlatch2/dialogs/VectorSourceDialog.mxml

index 5f49e1042bf228653404cb851e4605f5549ad78c..fd049dafa70273b4517556c01528b99335be592a 100644 (file)
@@ -2,9 +2,10 @@
 <mx:TitleWindow
         xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:mx="library://ns.adobe.com/flex/mx"
+               xmlns:s="library://ns.adobe.com/flex/spark"
         layout="vertical" showCloseButton="true"
         horizontalAlign="center" title="Load vector file"
-        width="500" height="450" verticalGap="0">
+        width="600" height="450" verticalGap="0">
 
        <mx:DataGrid editable="true" width="100%" height="100%" id="dataGrid" 
                dataProvider="{vectorLayers}" itemEditEnd="dataEdited(event)">
                <mx:LinkButton label="Delete" click="removeLayer()" enabled="{dataGrid.selectedItem != null &amp;&amp; dataGrid.selectedItem.isBackground}"/>
        </mx:HBox>
 
-       <mx:VBox width="100%" paddingTop="10">
-               <mx:HRule width="100%" />
-               <!-- ** FIXME: this looks horrid - make into a nicely laid out form -->
-               <mx:Label text="Add new vector layer" fontSize="12" fontWeight="bold" />
-               <mx:HBox>
-                       <mx:RadioButtonGroup id="filetype" />
-                       <mx:RadioButton width="100%" groupName="filetype" value="gpx" id="gpx" label="GPX" selected="true" />
-                       <mx:RadioButton width="100%" groupName="filetype" value="kml" id="kml" label="KML" />
-                       <mx:RadioButton width="100%" groupName="filetype" value="osm" id="osm" label="OSM" />
-                       <mx:RadioButton width="100%" groupName="filetype" value="shp" id="shp" label="Shapefile" />
-               </mx:HBox>
-               <mx:HBox>
-                       <mx:Label text="Shapefile projection:" />
-                       <mx:ComboBox id="projection"> 
-                               <mx:ArrayCollection>
-                                       <fx:Object label="Lat/long" data="" />
+       <fx:Declarations>
+               <s:RadioButtonGroup id="filetype" />
+       </fx:Declarations>
+       <s:Form id="addlayer" width="100%">
+               <s:FormHeading label="Add new vector layer" />
+
+               <s:FormItem label="File type:">
+                       <s:HGroup>
+                               <s:RadioButton groupName="filetype" value="gpx" id="gpx" label="GPX" selected="true" />
+                               <s:RadioButton groupName="filetype" value="kml" id="kml" label="KML" />
+                               <s:RadioButton groupName="filetype" value="osm" id="osm" label="OSM" />
+                               <s:RadioButton groupName="filetype" value="shp" id="shp" label="Shapefile" />
+                       </s:HGroup>
+                       <s:helpContent><s:Label text="Type of data to load"/></s:helpContent>
+               </s:FormItem>
+
+               <s:FormItem label="Projection:">
+                       <s:DropDownList id="projection" selectedIndex="0" width="200"> 
+                               <s:ArrayCollection>
+                                       <fx:Object label="Lat/long (EPSG:4326)" data="" />
                                        <fx:Object label="Ordnance Survey GB" data="EPSG:27700" />
                                        <fx:Object label="NAD83" data="EPSG:4269" />
-                               </mx:ArrayCollection>
-                       </mx:ComboBox>
-                       <mx:CheckBox width="100%" label="Simplify paths" id="simplify" />
-               </mx:HBox>
-               <mx:HBox>
-                       <mx:Text text="URL:"/>
-                       <mx:TextInput width="100%" id="src" text="" change="selectByExtension()" />
-                       <mx:Button label="Load" click="loadFiles(src.text, filetype.selectedValue.toString(), simplify.selected, projection.selectedItem.data);" enabled="{src.text == '' ? false : true}"/>
-               </mx:HBox>
-               <mx:HBox>
-                       <mx:Text text="Tag transform:"/>
-                       <mx:TextInput width="100%" id="transformsrc" text="{CSSTransform.getInstance().url}"/>
-                       <mx:Button label="Load" click="loadTransform(transformsrc.text);" enabled="{transformsrc.text == '' ? false : true}"/>
-                       <mx:Button label="Clear" click="clearTransform();" enabled="{transformsrc.text == '' ? false : true}"/>
-               </mx:HBox>
-       </mx:VBox>
+                               </s:ArrayCollection>
+                       </s:DropDownList>
+                       <s:helpContent><s:Label text="Shapefiles only"/></s:helpContent>
+               </s:FormItem>
+
+               <s:FormItem label="Simplify:">
+                       <s:CheckBox label="Enabled" id="simplify" />
+                       <s:helpContent><s:Label text="Reduce points in paths"/></s:helpContent>
+               </s:FormItem>
+
+        <s:FormItem label="File:">
+                       <s:HGroup>
+                   <s:TextInput id="src" text="" change="selectByExtension()" />
+                               <s:Button label="Fetch" click="loadFiles(src.text, filetype.selectedValue.toString(), simplify.selected, projection.selectedItem.data);" enabled="{src.text == '' ? false : true}"/>
+                       </s:HGroup>
+            <s:helpContent><s:Label text="URL of file to load" /></s:helpContent>
+        </s:FormItem>
+
+        <s:FormItem label="Tag transform:">
+                       <s:HGroup>
+                               <s:TextInput id="transformsrc" text="{CSSTransform.getInstance().url}"/>
+                               <s:Button label="Fetch" click="loadTransform(transformsrc.text);" enabled="{transformsrc.text == '' ? false : true}"/>
+                               <s:Button label="Clear" click="clearTransform();"                 enabled="{transformsrc.text == '' ? false : true}"/>
+                       </s:HGroup>
+            <s:helpContent><s:Label text="MapCSS transformation file" /></s:helpContent>
+        </s:FormItem>
+
+       </s:Form>
 
   <fx:Script><![CDATA[