4,328
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600" initialize="init()"
implements="cn.cty.moduleInterface.IModuleInterface">
<fx:Script>
<![CDATA[
import cn.cty.Util.RcpFlexUtil;
import cn.cty.Util.Util;
import cn.cty.moduleInterface.IModuleInterface;
import mx.collections.ArrayCollection;
import mx.events.ModuleEvent;
import cn.cty.module.PersonListModule;
import mx.core.IFlexModuleFactory;
import spark.modules.Module;
// 父窗口的引用,由moduleLoaderReadyHandler方法赋值
private var callBackObj:IModuleInterface = null;
// 回传页面的信息集合,用于GridData显示
/**
* 初始化方法
* */
private function init():void{
// 初始化加载person列表
var ros:String = "http://127.0.0.1:8080/FormTest/flex/cn/cty/module/PersonListModule.swf";
Util.loadModule(ros,module_Loader);
}
/**
* 加载person详细信息
* */
private function loadPersonFullMessage():void{
}
/**
* 继承的方法
* */
public function setCallbackObj(obj:IModuleInterface):void{
this.callBackObj = obj;
}
/**
* moduleLoader容器的加载事件
* */
private function moduleLoaderReadyHandler(event:ModuleEvent):void{
var iChild:IModuleInterface = module_Loader.child as IModuleInterface;
if(module_Loader.child != null){
// 当前窗口为父对象,将其传递给子窗口的set方法
iChild.setCallbackObj(this);
}
}
]]>
</fx:Script>
<!-- 模块加载容器 -->
<s:ModuleLoader id="module_Loader" width="100%" height="100%"
creationComplete="module_Loader.applicationDomain = ApplicationDomain.currentDomain"
ready="moduleLoaderReadyHandler(event)">
</s:ModuleLoader>
</s:Application>
<?xml version="1.0" encoding="utf-8"?>
<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
creationComplete="loadData()"
implements="cn.cty.moduleInterface.IModuleInterface"
>
<!-- 载入person列表的module -->
<fx:Script>
<![CDATA[
import cn.cty.moduleInterface.IModuleInterface;
import mx.collections.ArrayCollection;
import cn.cty.Util.Util;
import cn.cty.Util.RcpFlexUtil;
import spark.modules.Module;
[Bindable]
private var _personList:ArrayCollection = null;
private var _callbackObj:Object = null;
//父窗口引用 调用父窗口的方法 属性等
public function setCallbackObj(obj:IModuleInterface):void{
_callbackObj = obj;
}
/**
* 初始化加载数据方法
* */
private function loadData():void{
var _action:String = "http://127.0.0.1:8080/FormTest/personAction.action";
currentState = "loading";
// 初始化时加载所有后台数据
RcpFlexUtil.sendRcp(_action, "getPersonList", loadPersonList);
}
/**
* 将后台数据置于被绑定的集合中
* */
private function loadPersonList(_json:String):void{
var _obj:Object = Util.string2json(_json);
_personList = new ArrayCollection(_obj.records as Array);
currentState='reader'; //加载完成后,重置当前页面状态,坑爹的girddata不会自己切换
}
/**
* 点击查看详情按钮,显示该person的详细信息
* */
private function loadPersonFullMessage():void{
}
]]>
</fx:Script>
<mx:ViewStack width="100%" height="100%">
<s:NavigatorContent width="100%" height="100%" label="个人身份信息">
<s:Group width="100%" height="100%">
<s:Panel title.loading="加载ing" title.reader="加载完毕..." width="100%" height="100%">
<s:VGroup width="100%" height="100%">
<!-- 生成表格-->
<s:DataGrid id="personList" width="100%" height="100%" dataProvider="{_personList}" verticalScrollPolicy="on">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="userName" editable="false" headerText="用户账户" />
<s:GridColumn dataField="telephone" editable="false" headerText="电话号码"/>
<s:GridColumn dataField="address" headerText="居住地址"/>
<s:GridColumn dataField="notes" editable="true" headerText="备注信息"/>
<s:GridColumn width="250" headerText="执行操作">
<s:itemRenderer>
<fx:Component><!-- 用于定义内联项目呈现器和页面其他部分的分界线 -->
<s:GridItemRenderer>
<s:HGroup verticalAlign="middle" horizontalAlign="center">
<!-- 每一行的操作按钮 -->
<mx:LinkButton width="100" label="详细信息"
fontWeight="normal"
textDecoration="underline"
toolTip="查看更为的详细信息"/>
<s:Label text="\"/>
<mx:LinkButton width="100" label="删除信息"
fontWeight="normal"
textDecoration="underline"
toolTip="删除此信息,不可恢复,请注意!"/>
</s:HGroup>
</s:GridItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
</s:VGroup>
</s:Panel>
</s:Group>
</s:NavigatorContent>
</mx:ViewStack>
<s:states>
<s:State name="loading"></s:State>
<s:State name="reader"></s:State>
</s:states>
</s:Module>