<?xml version="1.0" encoding="utf-8"?>
<rcp:RCPModule xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:rcp="http://www.smartrcp.org"
creationComplete="init()"
xmlns:mx="library://ns.adobe.com/flex/halo" layout="horizontal" verticalGap="1"
width="396" height="318">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import cn.smartinvoke.smartrcp.gui.module.CObservable;
import mx.collections.ArrayCollection;
private var systemInfo:CObservable=null;
[Bindable]
private var globalInfo:ArrayCollection=new ArrayCollection();
[Binable]
private var memoryUsage:String="";
[Bindable]
private var cpuUsage:String="";
function init():void{
var info:String="本模块通过调用java扩展库实现多线程监听当前的内存与CPU使用状况";
smartrcpDemo.Instance.setInfo(info);
this.systemInfo=new CObservable();
this.systemInfo.create("cn.smartinvoke.smartrcp.demo.CSystemInfo");
this.systemInfo.addListener(function (param:Array):void{
this.labelMem.text=param[0] as String;
this.labelCPU.text=param[1] as String;
},this);
//获得系统信息
var propertys:Object=this.systemInfo.call("getInfo",null);
for(var propertyName:String in propertys){
globalInfo.addItem({name:propertyName,value:propertys[propertyName]});
}
}
]]>
</fx:Script>
<s:Panel width="100%" height="100%" dropShadowVisible="false" title="系统基本信息">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<mx:DataGrid x="41" y="17" width="100%" height="100%"
dataProvider="{globalInfo}">
<mx:columns>
<mx:DataGridColumn headerText="查看项目" dataField="name"/>
<mx:DataGridColumn headerText="当前值" dataField="value"/>
</mx:columns>
</mx:DataGrid>
</s:Panel>
<s:Panel id="panelState" width="100%" height="100%" dropShadowVisible="false"
title="系统当前信息">
<s:layout>
<s:BasicLayout/>
</s:layout>
<s:Label text="当前CPU使用状况" x="10" y="14" width="113" height="21"
fontWeight="normal"/>
<s:Label text="当前可用物理内存" x="10" y="76" width="113" height="21"
fontWeight="normal"/>
<s:Label x="22" y="109" id="labelMem" width="143" height="20" color="#1655E6"/>
<s:Label x="22" y="47" id="labelCPU" width="124" height="20" color="#166BEB"/>
</s:Panel>
</rcp:RCPModule>