src/it/ht/rcs/console/operations/view/Breadcrumb.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Group 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:view="it.ht.rcs.console.operations.view.*"
width="100%"
creationComplete="init()">
<fx:Script>
<![CDATA[
import locale.R;
import mx.controls.Alert;
import mx.core.UIComponent;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
[Bindable]
public var section:OperationsSection;
[Embed('/img/NEW/breadcrumb.png')]
private static const arrow:Class;
private function onUpOneLevel(event:MouseEvent):void
{
if (section.breadcrumb.detail.visible == true)
{
section.evidenceView.toggleDetail();
section.breadcrumb.detail.visible=false;
return;
}
section.stateManager.setState(getUpState());
}
private function getUpState():String
{
switch (section.currentState)
{
case 'config':
return section.stateManager.selectedFactory ? 'singleTarget' : 'agentConfigList';
case 'singleAgent':
return 'singleTarget';
case 'singleTarget':
return 'singleOperation';
case 'singleOperation':
return 'allOperations';
case 'evidence':
case 'filesystem':
return section.stateManager.selectedAgent ? 'singleAgent' : 'singleTarget';
case 'info':
case 'agentConfigList':
case 'filetransfer':
case 'commands':
case 'ipaddresses':
return 'singleAgent';
}
return null;
}
private function onRoll(event:MouseEvent):void
{
up.filters=event.type == MouseEvent.ROLL_OVER ? [glow] : null;
}
private function init():void
{
addEventListener(MouseEvent.CLICK, onClick, true, 0, true); // needed! we use capture to check if the current view is dirty and prevent switch
}
private var lastClicked:UIComponent;
private function onClick(e:MouseEvent):void
{
if (e.bubbles)
if (section.currentState == 'config' && section.configView.getDirtyState())
{
lastClicked=e.target as UIComponent;
e.stopImmediatePropagation();
Alert.show(R.get('UNSAVED_CHANGES'), R.get('UNSAVED_CHANGES_TITLE'), Alert.OK | Alert.CANCEL, null, confirm);
}
}
private function confirm(event:CloseEvent):void
{
if (event.detail == Alert.OK)
lastClicked.dispatchEvent(new MouseEvent(MouseEvent.CLICK, false));
}
]]>
</fx:Script>
<fx:Declarations>
<s:GlowFilter id="glow"
color="0xffffff"
blurX="12"
blurY="12"
strength="3"/>
</fx:Declarations>
<s:Rect width="100%"
height="100%"
bottomLeftRadiusX="5"
bottomLeftRadiusY="-5"
bottomRightRadiusX="5"
bottomRightRadiusY="-5"
topLeftRadiusX="5"
topLeftRadiusY="5"
topRightRadiusX="5"
topRightRadiusY="5">
<s:fill>
<s:SolidColor color="#E3E6EC"/>
</s:fill>
</s:Rect>
<s:HGroup width="100%"
gap="7"
paddingBottom="4"
paddingLeft="6"
paddingTop="4"
verticalAlign="middle">
<s:Image id="up"
source="@Embed('/img/NEW/up.png')"
buttonMode="true"
click="onUpOneLevel(event)"
rollOver="onRoll(event)"
rollOut="onRoll(event)"
toolTip="{R.get('UP_ONE_LEVEL')}"
enabled="{section.currentState != 'allOperations' && section.currentState != 'allTargets' && section.currentState != 'allAgents'}"/>
<mx:LinkButton visible="{section.currentState != 'allTargets' && section.currentState != 'allAgents'}"
label="{R.get('ALL_OPERATIONS')}"
click="section.stateManager.setState('allOperations')" enabled="{section.currentState != 'allOperations'}"
includeInLayout="{section.currentState != 'allTargets' && section.currentState != 'allAgents'}"
paddingLeft="0"
paddingRight="0"/>
<mx:LinkButton visible="{section.currentState == 'allTargets'}"
label="{R.get('ALL_TARGETS')}" enabled="{section.currentState != 'allTargets'}"
includeInLayout="{section.currentState == 'allTargets'}"
paddingLeft="0"
paddingRight="0"/>
<mx:LinkButton visible="{section.currentState == 'allAgents'}"
label="{R.get('ALL_AGENTS')}"
includeInLayout="{section.currentState == 'allAgents'}" enabled="{section.currentState != 'allAgents'}"
paddingLeft="0"
paddingRight="0"/>
<s:HGroup visible="{section.stateManager.selectedOperation != null}"
gap="3"
includeInLayout="{section.stateManager.selectedOperation != null}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="6"/>
<mx:LinkButton label="{section.stateManager.selectedOperation.name}"
click="section.stateManager.setState('singleOperation')" enabled="{section.currentState != 'singleOperation'}"
paddingLeft="3"
paddingRight="0"
icon="@Embed('/img/NEW/operation_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.stateManager.selectedTarget != null}"
gap="3"
includeInLayout="{section.stateManager.selectedTarget != null}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{section.stateManager.selectedTarget.name}"
click="section.stateManager.setState('singleTarget')" enabled="{section.currentState != 'singleTarget'}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/target_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.stateManager.selectedAgent != null}"
gap="3"
includeInLayout="{section.stateManager.selectedAgent != null}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{section.stateManager.selectedAgent.name}"
click="section.stateManager.setState('singleAgent')" enabled="{section.currentState != 'singleAgent'}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/agent_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.stateManager.selectedFactory != null}"
gap="3"
includeInLayout="{section.stateManager.selectedFactory != null}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{section.stateManager.selectedFactory.name}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/factory_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'evidence'}"
gap="3"
includeInLayout="{section.currentState == 'evidence'}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('EVIDENCE')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/evidence_16.png')"
click="{if(section.breadcrumb.detail.visible==true) section.evidenceView.toggleDetail() ; section.breadcrumb.detail.visible=false }"/>
</s:HGroup>
<s:HGroup visible="false"
gap="3"
includeInLayout="false"
verticalAlign="middle"
id="detail">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('DETAILS')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/detail_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'info'}" enabled="{section.currentState != 'info'}"
gap="3"
includeInLayout="{section.currentState == 'info'}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('INFO')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/info_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'commands'}" enabled="{section.currentState != 'commands'}"
gap="3"
includeInLayout="{section.currentState == 'commands'}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('COMMANDS')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/commands_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'ipaddresses'}" enabled="{section.currentState != 'ipaddresses'}"
gap="3"
includeInLayout="{section.currentState == 'ipaddresses'}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('SYNC_HISTORY')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/ipaddresses_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'agentConfigList' || section.stateManager.selectedConfig != null}" enabled="{section.stateManager.selectedConfig != null}"
gap="3"
includeInLayout="{section.currentState == 'agentConfigList' || section.stateManager.selectedConfig != null}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('CONFIGURATIONS')}"
click="section.stateManager.setState('agentConfigList')"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/config_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.stateManager.selectedConfig != null}" enabled="{section.stateManager.selectedConfig == null}"
gap="3"
includeInLayout="{section.stateManager.selectedConfig != null}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('CONFIG')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/config_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'filetransfer'}"
gap="3"
includeInLayout="{section.currentState == 'filetransfer'}" enabled="{section.currentState != 'filetransfer'}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="{R.get('FILE_TRANSFER')}"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/filetransfer_16.png')"/>
</s:HGroup>
<s:HGroup visible="{section.currentState == 'filesystem'}" enabled="{section.currentState != 'filesystem'}"
gap="3"
includeInLayout="{section.currentState == 'filesystem'}"
verticalAlign="middle">
<s:BitmapImage source="{arrow}"/>
<s:Spacer width="5"/>
<mx:LinkButton label="Filesystem"
paddingLeft="2"
paddingRight="0"
icon="@Embed('/img/NEW/filesystem_16.png')"/>
</s:HGroup>
<s:Spacer width="100%"/>
<view:Shortcuts section="{section}"/>
</s:HGroup>
</s:Group>