hackedteam/rcs-console

View on GitHub
src/it/ht/rcs/console/operations/view/operations/OperationsView.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:operations="it.ht.rcs.console.operations.view.operations.*"
          xmlns:view="it.ht.rcs.console.operations.view.*"
          width="100%" height="100%" 
          addedToStage="onAddeToStage(event)" 
          removedFromStage="onRemovedFromStage(event)">

  <fx:Script>
    <![CDATA[
      import it.ht.rcs.console.operation.controller.OperationManager
      import it.ht.rcs.console.operations.view.OperationsSection;
      
      import locale.R;
      
      [Bindable]
      public var section:OperationsSection;
      
      private function onDoubleClick(event:MouseEvent):void
      {
        var item:* = event.currentTarget === list ? list.selectedItem : grid.selectedItem;
        if (item) section.stateManager.manageItemSelection(item);
      }
      
      private function onKeyUp(event:KeyboardEvent):void
      {
        if (event.keyCode == Keyboard.ENTER) {
          var item:* = event.currentTarget === list ? list.selectedItem : grid.selectedItem;
          if (item) section.stateManager.manageItemSelection(item);
        }
      }
      
      protected function onAddeToStage(event:Event):void
      {
        OperationManager.instance.listenPush();
        OperationManager.instance.refresh();
        
      }
      
      protected function onRemovedFromStage(event:Event):void
      {
        OperationManager.instance.unlistenPush();
      }
      
    ]]>
  </fx:Script>
  

  <operations:OperationsActionBar section="{section}" selectedObject="{list.selectedItem}" viewStack="{views}"/>
  
  <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}" >
      
      <s:HGroup width="100%" height="100%" gap="5">
        
        <view:BaseList id="list" dataProvider="{section.stateManager.view}" selectedItem="{grid.selectedItem}"
                       doubleClick="onDoubleClick(event)" keyUp="onKeyUp(event)" section="{this.section}"/>
        
        <operations:OperationsInfoPanel selectedItem="{list.selectedItem}"/>
        
      </s:HGroup>
      
    </s:NavigatorContent>
    <s:NavigatorContent label="{R.get('TABLE_VIEW')}" hideEffect="{fadeOut}"
                        icon="@Embed('/img/windows/list.png')" showEffect="{fadeIn}">
      
      
      <operations:OperationsGrid id="grid" dataProvider="{section.stateManager.tableView}" selectedItem="{list.selectedItem}"
                                 doubleClick="onDoubleClick(event)" keyUp="onKeyUp(event)"/>
      
      
    </s:NavigatorContent>
  </mx:ViewStack>
  
  
  <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>