<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:business="net.shrefler.business.*"
    xmlns:controller="net.shrefler.controller.*"
    xmlns:view="net.shrefler.login.view.*"
    layout="absolute"
    creationComplete="initApp()" viewSourceURL="srcview/index.html">
    
    <mx:Script>
        <![CDATA[
            import flash.utils.describeType;

            import com.adobe.cairngorm.control.CairngormEventDispatcher;
            
            import net.shrefler.model.ModelLocator;
            import net.shrefler.events.GetEmployeesEvent;
            
            [Bindable]
            public var model : ModelLocator = ModelLocator.getInstance();

            public function initApp():void
            {
                // This is run one time when the application first loads
                getEmployees();
            }

            private function getEmployees():void
            {
                var gee:GetEmployeesEvent = new GetEmployeesEvent();
                CairngormEventDispatcher.getInstance().dispatchEvent(gee);
            }
        ]]>
    </mx:Script>
                    
    <!-- Service Locator and Controller as part of Cairngorm -->
    <business:Services id="dataServices" />
    <controller:Controller id="appController" />
    
    <mx:DataGrid id="employeeGrid" y="10" horizontalCenter="0" dataProvider="{model.employees}">
        <mx:columns>
            <mx:DataGridColumn headerText="First Name" dataField="firstName"/>
            <mx:DataGridColumn headerText="Last Name" dataField="lastName"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:TextArea y="172" text="{describeType(employeeGrid.selectedItem).toString()}" horizontalCenter="0.5" width="456" height="262"/>
    
</mx:Application>