<?xml version="1.0" encoding="utf-8"?>
<mx:Module
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
width="100%" height="100%"
styleName="application"
verticalAlign="middle"
horizontalAlign="center"
xmlns:business="org.sqlanyware.sqlwclient.business.*"
xmlns:control="org.sqlanyware.sqlwclient.control.*"
xmlns:view="org.sqlanyware.sqlwclient.view.*"
xmlns:login="org.sqlanyware.sqlwclient.view.login.*"
initialize="onInitialize()"
xmlns:controls="org.sqlanyware.sqlwclient.controls.*">
<mx:Style source="/assets/stylesheet.css"/>
<mx:Script>
<![CDATA[
import org.sqlanyware.utils.DeferredInstanceFromFunctionWithoutCache;
import org.sqlanyware.sqlwclient.view.Workspace;
import org.sqlanyware.sqlwclient.controls.AddChildEx;
import mx.collections.ArrayCollection;
import org.sqlanyware.sqlwclient.model.ApplicationModelLocator;
private var zzz : ArrayCollection = new ArrayCollection();
[Bindable]
private var model : ApplicationModelLocator = null;
private function onInitialize() : void {
this.model = ApplicationModelLocator.getInstance();
}
private function getState( logonInfo : Object ) : String {
var result : String = "";
if ( null == logonInfo ) {
result = "stateNotLogged";
}
else {
result = "stateLogged";
}
return result;
}
private function onReset( event : Event ) : void {
this.dispatchEvent( new Event("done") );
}
private function createWorkspace() : Object {
var workspace : Workspace = new Workspace();
workspace.setStyle("showEffect", fadeIn );
workspace.setStyle("hideEffect", fadeOut );
workspace = new Workspace();
workspace.percentHeight = 100;
workspace.percentWidth = 100;
return workspace;
}
[Bindable]
private var workspaceFactory : IDeferredInstance =
new DeferredInstanceFromFunctionWithoutCache( createWorkspace );
]]>
</mx:Script>
<business:Services/>
<control:ApplicationController/>
<mx:Binding source="getState( model.logonInfo )" destination="currentState"/>
<mx:states>
<mx:State name="stateLogged">
<controls:AddChildEx
targetFactory="{workspaceFactory}"
/>
</mx:State>
<mx:State name="stateNotLogged">
<mx:AddChild>
<login:LoginPanel id="loginPanel"/>
</mx:AddChild>
</mx:State>
</mx:states>
<!-- Define Transition array with one Transition object.-->
<mx:Fade id="fadeOut" alphaFrom="1" alphaTo="0" duration="500"/>
<mx:Fade id="fadeIn" alphaFrom="0" alphaTo="1" duration="500"/>
<mx:transitions>
<!-- A transition for changing from any state to any state. -->
<mx:Transition fromState="stateNotLogged" toState="stateLogged">
<mx:Parallel>
<mx:Fade alphaFrom="1" alphaTo="0" duration="500" target="{loginPanel}"/>
</mx:Parallel>
</mx:Transition>
<mx:Transition fromState="stateLogged" toState="stateNotLogged">
<mx:Parallel>
<mx:Fade alphaFrom="0" alphaTo="1" duration="500" target="{loginPanel}"/>
</mx:Parallel>
</mx:Transition>
</mx:transitions>
</mx:Module>