src/it/ht/rcs/console/accounting/view/AccountingSection.mxml
<?xml version="1.0" encoding="utf-8"?>
<main:Section 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:main="it.ht.rcs.console.main.*"
xmlns:groups="it.ht.rcs.console.accounting.view.groups.*"
xmlns:oldusers="it.ht.rcs.console.accounting.view.oldusers.*"
xmlns:users="it.ht.rcs.console.accounting.view.users.*"
addedToStage="onAddedToStage()" removedFromStage="onRemovedFromStage()">
<main:layout>
<s:VerticalLayout paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5"/>
</main:layout>
<fx:Script>
<![CDATA[
import it.ht.rcs.console.accounting.controller.GroupManager;
import it.ht.rcs.console.accounting.controller.OperationManager;
import it.ht.rcs.console.accounting.controller.UserManager;
import it.ht.rcs.console.history.HistoryItem;
import it.ht.rcs.console.history.HistoryManager;
import locale.R;
import mx.events.IndexChangedEvent;
private function onAddedToStage():void
{
UserManager.instance.listenRefresh();
UserManager.instance.refresh();
UserManager.instance.listenPush()
GroupManager.instance.listenRefresh();
GroupManager.instance.refresh();
GroupManager.instance.listenPush()
OperationManager.instance.listenRefresh();
OperationManager.instance.refresh();
subSections.addEventListener(IndexChangedEvent.CHANGE, onNavigation);
HistoryManager.instance.addEventListener("change", onHistory)
}
private function onRemovedFromStage():void
{
UserManager.instance.unlistenRefresh();
UserManager.instance.unlistenPush()
GroupManager.instance.unlistenRefresh();
GroupManager.instance.unlistenPush()
OperationManager.instance.unlistenRefresh();
subSections.removeEventListener(IndexChangedEvent.CHANGE, onNavigation);
HistoryManager.instance.removeEventListener("change", onHistory)
}
private function onHistory(e:Event):void
{
trace("ON HISTORY")
if(HistoryManager.instance.currentItem.section=="Accounting")
{
subSections.removeEventListener(IndexChangedEvent.CHANGE, onNavigation);
subSections.selectedIndex=HistoryManager.instance.currentItem.subSection;
this.callLater(subSections.addEventListener,[IndexChangedEvent.CHANGE, onNavigation]);
}
}
private function onNavigation(e:Event):void
{
trace("ACCOUNTING SECTION SUBMENU NAVIGATION")
var item:HistoryItem=new HistoryItem();
item.section="Accounting";
item.subSection=subSections.selectedIndex;
HistoryManager.instance.addItem(item);
}
]]>
</fx:Script>
<mx:ViewStack id="subSections" width="100%" height="100%" >
<s:NavigatorContent label="{R.get('USERS')}">
<users:UserView/>
</s:NavigatorContent>
<s:NavigatorContent label="{R.get('GROUPS')}">
<groups:GroupView/>
</s:NavigatorContent>
</mx:ViewStack>
</main:Section>