src/it/ht/rcs/console/accounting/view/users/renderers/PermissionsTreeItemRenderer.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:MXTreeItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init()">
<fx:Script>
<![CDATA[
import it.ht.rcs.console.accounting.view.users.PrivsPreferencePanel;
import it.ht.rcs.console.accounting.view.users.PrivsTree;
import it.ht.rcs.console.events.TreeEvent;
import it.ht.rcs.console.monitor.controller.LicenseManager;
private function init():void
{
if(data)
{
if(data.@id=="ADMIN_USERS")
{
selectedCh.enabled=(this.owner as PrivsTree).user._id!=Console.currentSession.user._id;
}
if(data.@id=="VIEW_DELETE")
{
selectedCh.enabled=LicenseManager.instance.deletion;
}
}
}
private function onClick():void
{
data.@selected=selectedCh.selected?"1":"0";
if(treeListData.hasChildren)
{
owner.dispatchEvent(new TreeEvent("itemChange", data));
}
else
{
owner.dispatchEvent(new TreeEvent("childItemChange", data));
}
}
]]>
</fx:Script>
<s:states>
<s:State name="normal" />
<s:State name="hovered" />
<s:State name="selected" />
</s:states>
<s:HGroup left="0" right="0" top="0" bottom="0" verticalAlign="middle">
<s:Rect id="indentationSpacer" width="{treeListData.indent}" percentHeight="100" alpha="0">
<s:fill>
<s:SolidColor color="0xFFFFFF" />
</s:fill>
</s:Rect>
<s:Group id="disclosureGroup">
<s:BitmapImage source="{treeListData.disclosureIcon}" visible="{treeListData.hasChildren}" />
</s:Group>
<s:BitmapImage source="{treeListData.icon}" />
<s:CheckBox id="selectedCh" selected="{data.@selected=='1'}" click="onClick()"/>
<s:Label id="labelField" text="{treeListData.label}" paddingTop="2" fontWeight="{treeListData.hasChildren?'bold':'normal'}"/>
</s:HGroup>
</s:MXTreeItemRenderer>