<?xml version="1.0" encoding="utf-8"?>
<view:AddressBook xmlns:fx="http://ns.adobe.com/mxml/2009" 
				  xmlns:s="library://ns.adobe.com/flex/spark" 
				  xmlns:mx="library://ns.adobe.com/flex/mx"
				  xmlns:view="org.pyamf.examples.addressbook.*"
				  enabled="false">

	<view:layout>
		<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"
						  paddingBottom="30" paddingLeft="30"
						  paddingTop="30" paddingRight="30"/>
	</view:layout>
	
	<s:Panel width="100%" height="100%"
			  title="Flex + PyAMF + SQLAlchemy - Address Book Example">
		
		<s:layout>
			<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"
							  paddingBottom="30" paddingLeft="30"
							  paddingTop="30" paddingRight="30"/>
		</s:layout>
		
		<s:Form width="100%">
			<s:layout>
				<s:FormLayout gap="-13" horizontalAlign="left" />
			</s:layout>
			
			<s:FormItem label="Server:" width="100">
				<s:TextInput id="server" text="localhost"
							  toolTip="Hostname" />
			</s:FormItem>
			
			<s:FormItem label="Port:" width="100">
				<s:TextInput id="port" text="8000"
							  toolTip="Port number" />
			</s:FormItem>
		</s:Form>
		
		<mx:DataGrid
			id="userGrid" width="100%" height="100%"
			doubleClickEnabled="true" doubleClick="editUser()"
			dataProvider="{users}" allowMultipleSelection="true"
			toolTip="Double click on a user to edit their details">
			<mx:columns>
				<mx:DataGridColumn headerText="Key"
								   dataField="sa_key" />
				<mx:DataGridColumn headerText="First Name"
								   dataField="first_name" />
				<mx:DataGridColumn headerText="Last Name"
								   dataField="last_name" />
			</mx:columns>
		</mx:DataGrid>
		
		<s:controlBarContent>
			<s:Button
				label="Add"
				click="addUser()"
				toolTip="Add a new user" />
			<s:Button
				label="Reload"
				click="loadUsers()"
				toolTip="Reload users from server" />
			<s:Button
				label="Insert Default"
				click="insertDefaultData()"
				toolTip="Insert default data" />
			<s:Button
				label="Remove"
				click="removeUser()"
				toolTip="Remove selected users from server" />
		</s:controlBarContent>
		
	</s:Panel>

</view:AddressBook>