<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" currentState="Login" creationComplete="onInit()" viewSourceURL="srcview/index.html">
<mx:Script source="adminClient.as"/>
    <mx:states>
        <mx:State name="Login" id="state_1">
            <mx:AddChild position="lastChild">
                <mx:ComboBox x="97" y="144" id="Login_ServerID"></mx:ComboBox>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:TextInput x="97" y="174" id="Login_URL" text="rtmp://localhost/control"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:TextInput x="97" y="204" id="Login_UserName" text="admin"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:TextInput x="97" y="234" displayAsPassword="true" id="Login_Password"/>
            </mx:AddChild>
            
            <mx:AddChild position="lastChild">
                <mx:Text x="19" y="176" text="URL" id="text1"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Text x="19" y="206" text="UserName"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Text x="19" y="236" text="Password"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Button x="185" y="294" label="Connect" id="Login_LoginBtn" click="onSignIn()"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:CheckBox x="97" y="264" label="Remember Settings" id="Login_RememberSettingsBox"/>
            </mx:AddChild>
            <mx:AddChild relativeTo="{text1}" position="before">
                <mx:TextInput x="97" y="114" displayAsPassword="false" id="Login_ServiceName" text="telephony_control"/>
            </mx:AddChild>
            <mx:AddChild relativeTo="{Login_LoginBtn}" position="before">
                <mx:Text x="19" y="116" text="serviceName"/>
            </mx:AddChild>
            <mx:SetProperty name="width" value="663"/>
            <mx:SetProperty name="height" value="530"/>
            <mx:AddChild position="lastChild">
                <mx:TextArea x="97" y="344" height="78" backgroundColor="#B7AEAE" backgroundAlpha="0.0" alpha="0.0" id="login_error_box" fontFamily="Arial" color="#FA1717"/>
            </mx:AddChild>
            <mx:SetStyle name="backgroundGradientAlphas" value="[0.0, 0.0]"/>
        </mx:State>
            <mx:State name="Server_Status" id="state_2">
            <mx:AddChild position="lastChild">
                <mx:ComboBox x="515" y="10" width="91" editable="false" enabled="true" change="onRefreshRateChange()" dataProvider="{refreshRate_data}" id="refreshCombo_serverTab"></mx:ComboBox>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Text x="429" y="12" text="Refresh Rate"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Button x="26" y="81" label="Restart Server" width="119"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Button x="643" y="10" label="SignOut" click="onSignout()"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Button x="10" y="10" label="Server Status" width="119" click="goToServerStatusTab()"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Button x="156" y="10" label="Call legs" width="113" click="goToCallLegsTab()"/>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:Button x="297" y="10" label="Console" width="103" click="goToConsoleTab()"/>
            </mx:AddChild>
            <mx:SetProperty name="width" value="727"/>
            <mx:AddChild position="lastChild">
                <mx:DataGrid x="51" width="555" editable="true" enabled="true" top="138" height="323" 
                     resizableColumns="true" variableRowHeight="true" wordWrap="true" dataProvider="{serverStatusData}">
                </mx:DataGrid>
            </mx:AddChild>
        </mx:State>
            <mx:State name="Call Legs" id="state_3">
                    <mx:AddChild position="lastChild">
                            <mx:DataGrid x="10" width="704" editable="true" enabled="true" top="60" height="431" 
                                 dataProvider= "{callLegsData}"  resizableColumns="true" variableRowHeight="true" wordWrap="true">
                            </mx:DataGrid>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="643" y="10" label="SignOut" click="onSignout()"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="10" y="10" label="Server Status" width="119" click="goToServerStatusTab()"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="156" y="10" label="Call legs" width="113" click="goToCallLegsTab()"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="297" y="10" label="Console" width="103" click="goToConsoleTab()"/>
                    </mx:AddChild>
                    <mx:SetProperty name="width" value="726"/>
                    <mx:SetProperty name="height" value="541"/>
            </mx:State>
            <mx:State name="Console">
                    <mx:AddChild position="lastChild">
                            <mx:TextArea x="49" y="40" width="609" height="426" color="#AFB8B4" backgroundColor="#100101" id="console_box" wordWrap="true" editable="false" enabled="true" cachePolicy="auto"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:TextInput x="49" y="465" width="609" id="command_box" editable="true" enabled="true" />
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="643" y="10" label="SignOut" click="onSignout()"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="10" y="10" label="Server Status" width="119" click="goToServerStatusTab()"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="156" y="10" label="Call legs" width="113" click="goToCallLegsTab()"/>
                    </mx:AddChild>
                    <mx:AddChild position="lastChild">
                            <mx:Button x="297" y="10" label="Console" width="103" click="goToConsoleTab()"/>
                    </mx:AddChild>
                    <mx:SetProperty name="width" value="743"/>
                    <mx:SetProperty name="height" value="505"/>
            </mx:State>
    </mx:states>
    
</mx:WindowedApplication>