add a feature selector to the simple view
[potlatch2.git] / net / systemeD / halcyon / CategorySelector.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:VBox
3         xmlns:mx="http://www.adobe.com/2006/mxml" 
4         xmlns:halcyon="net.systemeD.halcyon.*">
5
6   <mx:HBox horizontalGap="0"> 
7   <mx:ToggleButtonBar height="100%" dataProvider="{categoryStack}" direction="vertical"/>
8   <mx:ViewStack id="categoryStack" width="100%" height="100%">
9       <mx:Repeater id="catRep" dataProvider="{MapFeatures.getInstance().categories}">
10           <mx:VBox label="{catRep.currentItem.name}">
11           <mx:TileList dataProvider="{catRep.currentItem.features}"
12                        width="100%" height="100%" change="itemSelected(event);">
13               <mx:itemRenderer>
14                   <mx:Component>
15                       <mx:VBox width="100" height="75"
16                           horizontalScrollPolicy="off" verticalScrollPolicy="off"
17                           horizontalAlign="center" verticalGap="0">
18                           <mx:Image source="{data.image}" height="100%" verticalAlign="middle"/>
19                           <mx:Text text="{data.name}"/>
20                       </mx:VBox>
21                   </mx:Component>
22               </mx:itemRenderer>
23           </mx:TileList>
24           </mx:VBox>
25       </mx:Repeater>
26   </mx:ViewStack>
27   </mx:HBox>
28   
29   <mx:Label id="hoverInfo" text="Hover Info goes here"/>
30   
31   <mx:Script><![CDATA[
32       import net.systemeD.halcyon.connection.*;
33       import net.systemeD.halcyon.mapfeatures.*;
34
35       import mx.controls.*;
36       
37       private var _selectedType:Feature;
38       
39       [Bindable(event="selectedType")]
40       public function get selectedType():Feature {
41           return _selectedType;
42       }
43       
44       private function itemSelected(event:Event):void {
45           _selectedType = Feature(TileList(event.currentTarget).selectedItem);
46           dispatchEvent(new Event("selectedType"));
47       }
48   ]]></mx:Script>
49 </mx:VBox>
50