hackedteam/rcs-console

View on GitHub
src/it/ht/rcs/console/accounting/view/groups/GroupView.mxml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>
<s:VGroup 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:groups="it.ht.rcs.console.accounting.view.groups.*"
          width="100%" height="100%" addedToStage="onAddedToStage()">
  
  <fx:Script>
    <![CDATA[
      import it.ht.rcs.console.accounting.controller.GroupManager;
      
      import locale.R;
      
      import mx.collections.ListCollectionView;
      
      [Bindable]
      public var dataProvider:ListCollectionView;
      
      private function onAddedToStage():void
      {
        dataProvider = GroupManager.instance.getView(null, searchFilterFunction);
      }
      
      private function searchFilterFunction(item:Object):Boolean
      {
        try {
          return item.name.toLowerCase().indexOf(actionBar.searchInput.text.toLowerCase()) != -1;
        } catch (e:Error) {}
        return true;
      }
    ]]>
  </fx:Script>
  
  <groups:GroupActionBar id="actionBar" selectedObject="{groupList.list.selectedItem}"
                         view="{dataProvider}" viewStack="{views}"/>
  
  <s:VGroup width="100%" height="100%" gap="20">

    <mx:ViewStack id="views" width="100%" height="100%" creationPolicy="all">
      
      <s:NavigatorContent label="{R.get('ICON_VIEW')}" hideEffect="{fadeOut}"
                          icon="@Embed('/img/windows/icon.png')" showEffect="{fadeIn}">
        <groups:GroupList id="groupList" dataProvider="{dataProvider}" linkWith="{groupTable.table}"/>
      </s:NavigatorContent>
      
      <s:NavigatorContent label="{R.get('TABLE_VIEW')}" hideEffect="{fadeOut}"
                          icon="@Embed('/img/windows/list.png')" showEffect="{fadeIn}">
        <groups:GroupTable id="groupTable" dataProvider="{dataProvider}" linkWith="{groupList.list}"/>
      </s:NavigatorContent>
      
    </mx:ViewStack>
    
    <s:HGroup width="100%" height="100%" gap="100" paddingBottom="20" paddingLeft="20"
              paddingRight="20">
      <groups:GroupUserTable group="{groupList.list.selectedItem}"/>
      <groups:GroupOperationTable group="{groupList.list.selectedItem}"/>
    </s:HGroup>
    
  </s:VGroup>
  
  <fx:Declarations>
    <s:Fade id="fadeIn" alphaFrom="0" alphaTo="1" duration="150"/>
    <s:Fade id="fadeOut" alphaFrom="1" alphaTo="0" duration="150"/>
  </fx:Declarations>
  
</s:VGroup>