src/it/ht/rcs/console/entities/view/EntityInfoPanel.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:users="it.ht.rcs.console.accounting.view.users.*"
xmlns:utils="it.ht.rcs.console.utils.*"
xmlns:maps="it.ht.rcs.console.maps.*"
width="325"
height="100%">
<fx:Script>
<![CDATA[
import it.ht.rcs.console.DB;
import it.ht.rcs.console.accounting.controller.SessionManager;
import it.ht.rcs.console.entities.controller.EntityManager;
import it.ht.rcs.console.entities.model.Entity;
import it.ht.rcs.console.entities.model.Link;
import it.ht.rcs.console.entities.model.LinkInfo;
import it.ht.rcs.console.monitor.controller.LicenseManager;
import it.ht.rcs.console.utils.TimeUtils;
import locale.R;
import mx.collections.ArrayCollection;
private var _selectedItem:*;
private var _selectedItems:Vector.<Object>;
[Embed(source="img/stub/mapSmall.png")]
[Bindable]
public var fakeMap:Class;
[Bindable]
public var programs:ArrayCollection;
[Bindable]
public function set selectedItem(value:*):void
{
_selectedItem=value;
if (!value is Entity)
{
programs=new ArrayCollection()
if(value.info)
{
var info:LinkInfo=value.info as LinkInfo;
if(info.adium) programs.addItem("adium");
if(info.bbm) programs.addItem("bbm");
if(info.facebook) programs.addItem("facebook");
if(info.gmail) programs.addItem("gmail");
if(info.gtalk) programs.addItem("gtalk");
if(info.line) programs.addItem("line");
if(info.mail) programs.addItem("mail");
if(info.money) programs.addItem("money");
if(info.msn) programs.addItem("msn");
if(info.phone) programs.addItem("phone");
if(info.skype) programs.addItem("skype");
if(info.telegram) programs.addItem("telegram");
if(info.twitter) programs.addItem("twitter");
if(info.url) programs.addItem("url");
if(info.viber) programs.addItem("viber");
if(info.wechat) programs.addItem("wechat");
if(info.whatsapp) programs.addItem("whatsapp");
if(info.yahoo) programs.addItem("yahoo");
}
//evidence=positions[0] as Evidence;
mapViewer.positions=new Vector.<Object>()
mapViewer.positions.push(_selectedItem)
mapViewer.update()
}
}
public function get selectedItem():*
{
return _selectedItem;
}
[Bindable]
public function set selectedItems(value:Vector.<Object>):void
{
_selectedItems=value;
if (value && _selectedItem)
{
mapViewer.positions=new Vector.<Object>()
mapViewer.positions.push(_selectedItem)
mapViewer.update()
}
}
public function get selectedItems():Vector.<Object>
{
return _selectedItems;
}
]]>
</fx:Script>
<s:Line left="0"
top="0"
bottom="0">
<s:stroke>
<s:SolidColorStroke color="#333333"/>
</s:stroke>
</s:Line>
<s:Rect left="6"
top="0"
width="100%"
height="30"
bottomLeftRadiusX="5"
bottomLeftRadiusY="5"
topLeftRadiusX="5"
topLeftRadiusY="5">
<s:fill>
<s:LinearGradient>
<s:entries>
<s:GradientEntry color="#E3E6EC"/>
<s:GradientEntry color="#ffffff"/>
</s:entries>
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Label left="15"
height="30"
color="#333333"
fontFamily="Myriad"
fontSize="18"
text="{R.get('DETAILS')}"
verticalAlign="middle"/>
<s:Group left="6"
top="35"
width="100%"
height="100%"
visible="{selectedItem != null && selectedItem is Entity}"
includeInLayout="{selectedItem != null && selectedItem is Entity}">
<s:Form visible="{selectedItem != null && selectedItems.length==1}"
width="100%">
<s:FormItem label="{R.get('NAME')}">
<s:RichEditableText editable="false"
text="{selectedItem.name}"
width="200"/>
</s:FormItem>
<s:FormItem label="{R.get('DESCRIPTION')}"
width="100%"
visible="{selectedItem.desc!=''}"
includeInLayout="{selectedItem.desc!=''}">
<s:RichEditableText editable="false"
text="{selectedItem.desc}"
width="200"/>
</s:FormItem>
<s:FormItem label="{R.get('LEVEL')}"
width="100%">
<s:RichEditableText editable="false"
text="{selectedItem.level}"
width="200"/>
</s:FormItem>
<s:Spacer height="20"/>
<s:FormItem label="Stand for"
width="100%"
visible="{selectedItem.type=='group'}"
includeInLayout="{selectedItem.type=='group'}">
<s:RichEditableText editable="false"
text="{selectedItem.stand_for}"
width="200"/>
</s:FormItem>
<s:Spacer height="20"
visible="{selectedItem.type=='group'}"
includeInLayout="{selectedItem.type=='group'}"/>
<s:FormItem label="{selectedItem.type=='target'?R.get('LAST_KNOWN_POSITION'): R.get('POSITION')}"
includeInLayout="{(selectedItem.type=='target' || selectedItem.type=='position') && selectedItem.position && LicenseManager.instance.profiling}"
visible="{(selectedItem.type=='target' || selectedItem.type=='position') && selectedItem.position && LicenseManager.instance.profiling}">
<s:Label text="Lat: {selectedItem.position.latitude}"/>
</s:FormItem>
<s:FormItem label=""
includeInLayout="{(selectedItem.type=='target' || selectedItem.type=='position') && selectedItem.position && LicenseManager.instance.profiling}"
visible="{(selectedItem.type=='target' || selectedItem.type=='position') && selectedItem.position && LicenseManager.instance.profiling}">
<s:Label text="Lng: {selectedItem.position.longitude}"/>
</s:FormItem>
<s:FormItem label=""
includeInLayout="{selectedItem.type=='target' && selectedItem.position && LicenseManager.instance.profiling}"
visible="{selectedItem.type=='target' && selectedItem.position && LicenseManager.instance.profiling}">
<s:Label text="{'('+TimeUtils.timestampFormatter(selectedItem.position_attr.time * 1000)+')'}"/>
</s:FormItem>
<!-- map -->
<s:Spacer height="20"/>
<s:BorderContainer width="300"
height="300"
borderAlpha="1"
borderColor="0x666666"
backgroundColor="0xCCCCCC"
backgroundAlpha="0.3"
id="mapBox"
includeInLayout="{(selectedItem.type=='target' || selectedItem.type=='position') && selectedItem.position && LicenseManager.instance.profiling}"
visible="{(selectedItem.type=='target' || selectedItem.type=='position') && selectedItem.position && LicenseManager.instance.profiling}">
<maps:MapViewer width="100%"
height="100%"
id="mapViewer"/>
<!-- trick to disbale map -->
<s:BorderContainer width="100%"
height="100%"
borderAlpha="0"
backgroundColor="0xFFFFFF"
backgroundAlpha="0.5"
visible="{!LicenseManager.instance.profiling}"
includeInLayout="{!LicenseManager.instance.profiling}"/>
<s:BitmapImage source="{fakeMap}"
width="100%"
height="100%"
visible="{!SessionManager.instance.hasConnection && DB.instance.demo}"
includeInLayout="{!SessionManager.instance.hasConnection && DB.instance.demo}"/>
</s:BorderContainer>
</s:Form>
</s:Group>
<s:Group left="6"
top="35"
width="100%"
height="100%"
visible="{selectedItem != null && selectedItem.versus!=null}"
includeInLayout="{selectedItem != null && selectedItem.versus!=null}">
<s:Form visible="{selectedItem != null && selectedItems.length==1}"
width="100%">
<s:FormItem label="{R.get('FROM')}">
<s:RichEditableText editable="false"
text="{selectedItem.versus=='out'? EntityManager.instance.getItem(selectedItem.source).name : EntityManager.instance.getItem(selectedItem.target).name}"
width="200"/>
</s:FormItem>
<s:FormItem label="{R.get('TO')}">
<s:RichEditableText editable="false"
text="{selectedItem.versus=='out'? EntityManager.instance.getItem(selectedItem.target).name : EntityManager.instance.getItem(selectedItem.source).name}"
width="200"/>
</s:FormItem>
<s:FormItem label="{R.get('RELEVANCE')}"
skinClass="it.ht.rcs.console.skins.EvidenceFormItemSkin"
textAlign="right">
<utils:TagImage value="{selectedItem.rel}"/>
</s:FormItem>
<s:FormItem label="{R.get('TYPE')}">
<s:RichEditableText editable="false"
text="{selectedItem.type}"
width="200"/>
</s:FormItem>
<s:FormItem label="{R.get('LEVEL')}">
<s:RichEditableText editable="false"
text="{selectedItem.level}"
width="200"/>
</s:FormItem>
<!-- <s:FormItem label="{R.get('VERSUS')}">
<s:RichEditableText editable="false"
text="{selectedItem.data.@versus}" width="200"/>
</s:FormItem>-->
<s:FormItem label="{R.get('PROGRAM')}" visible=" {!this.selectedItem.name && programs.length>0}">
<s:List id="programsList" width="200" minWidth="0" height="260" borderVisible="false"
dataProvider="{programs}" visible=" {!this.selectedItem.name}" enabled="false"
textAlign="left"/>
</s:FormItem>
</s:Form>
</s:Group>
</s:Group>