flex 前后台类的传递
来源:互联网 发布:积分商城数据分析 编辑:程序博客网 时间:2024/05/22 01:51
前台的as 类:最重要的是要加com.system.domain.FlowType以便前台的类和后台的类对应。
- package
- {
- /**
- * 描述:
- * 创建时间:2012-12-26 上午10:09:29
- */
- [ Bindable]
- [ RemoteClass( alias= "com.system.domain.FlowType")]
- public class FlowType
- {
- public function FlowType()
- {
- }
- private var _pkId:int;
- private var _flowId:int;
- private var _typeId:int;
- public function get typeId():int
- {
- return _typeId;
- }
- public function set typeId(value:int):void
- {
- _typeId = value;
- }
- public function get flowId():int
- {
- return _flowId;
- }
- public function set flowId(value:int):void
- {
- _flowId = value;
- }
- public function get pkId():int
- {
- return _pkId;
- }
- public function set pkId(value:int):void
- {
- _pkId = value;
- }
- }
- }
package{/** * 描述: * 创建时间:2012-12-26 上午10:09:29 */[ Bindable][ RemoteClass( alias= "com.system.domain.FlowType")]public class FlowType{public function FlowType(){}private var _pkId:int;private var _flowId:int;private var _typeId:int;public function get typeId():int{return _typeId;}public function set typeId(value:int):void{_typeId = value;}public function get flowId():int{return _flowId;}public function set flowId(value:int):void{_flowId = value;}public function get pkId():int{return _pkId;}public function set pkId(value:int):void{_pkId = value;}}}
前台的代码:
- <?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"
- creationComplete="application1_creationCompleteHandler(event)"
- minWidth="955" minHeight="600">
- <s:layout>
- <s:BasicLayout/>
- </s:layout>
- <fx:Declarations>
- <mx:RemoteObject id="workflowRO" destination="workflowActionDest" fault="faultHandler(event)"/>
- </fx:Declarations>
- <fx:Script>
- <![CDATA[
- import mx.collections.ArrayCollection;
- import mx.controls.Alert;
- import mx.events.FlexEvent;
- import mx.rpc.events.FaultEvent;
- import mx.rpc.events.ResultEvent;
- [ Bindable]
- public var flowtypelist:ArrayCollection;
- private function faultHandler(event:FaultEvent):void {
- Alert.show(event.toString(), 'FaultHandlerError' );
- }
- protected function application1_creationCompleteHandler(event:FlexEvent):void
- {
- workflowRO.addEventListener(ResultEvent.RESULT,findflowTypereturn);
- workflowRO.findFlowTypes();
- }
- private function findflowTypereturn(event:ResultEvent):void
- {
- workflowRO.removeEventListener(ResultEvent.RESULT,findflowTypereturn);
- flowtypelist=event.result as ArrayCollection ;
- trace(flowtypelist.getItemAt(0));
- var ft:FlowType=flowtypelist.getItemAt(0) as FlowType;
- trace(ft.flowId);
- }
- protected function button1_clickHandler(event:MouseEvent):void
- {
- var ft:FlowType= dg.selectedItem as FlowType;
- Alert.show(ft.flowId.toString());
- ft.flowId=1000;
- workflowRO.addEventListener(ResultEvent.RESULT,chargereturn);
- workflowRO.saveFlowTypes(ft);
- }
- private function chargereturn(event:ResultEvent):void
- {
- workflowRO.removeEventListener(ResultEvent.RESULT,chargereturn);
- }
- ]]>
- </fx:Script>
- <s:VGroup>
- <s:Button label="添加" click="button1_clickHandler(event)"/>
- <mx:DataGrid id="dg" width="500" height="600" dataProvider="{flowtypelist}">
- <mx:columns>
- <mx:DataGridColumn dataField="flowId" headerText="flowId"/>
- <mx:DataGridColumn dataField="pkId" width="100" headerText="pkId"/>
- <mx:DataGridColumn dataField="typeId" headerText="typeId"/>
- </mx:columns>
- </mx:DataGrid>
- </s:VGroup>
- </s:Application>
<?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" creationComplete="application1_creationCompleteHandler(event)" minWidth="955" minHeight="600"><s:layout><s:BasicLayout/></s:layout><fx:Declarations><mx:RemoteObject id="workflowRO" destination="workflowActionDest" fault="faultHandler(event)"/></fx:Declarations><fx:Script><![CDATA[import mx.collections.ArrayCollection;import mx.controls.Alert;import mx.events.FlexEvent;import mx.rpc.events.FaultEvent;import mx.rpc.events.ResultEvent;[ Bindable]public var flowtypelist:ArrayCollection;private function faultHandler(event:FaultEvent):void {Alert.show(event.toString(), 'FaultHandlerError' );}protected function application1_creationCompleteHandler(event:FlexEvent):void{workflowRO.addEventListener(ResultEvent.RESULT,findflowTypereturn);workflowRO.findFlowTypes();}private function findflowTypereturn(event:ResultEvent):void{workflowRO.removeEventListener(ResultEvent.RESULT,findflowTypereturn);flowtypelist=event.result as ArrayCollection ;trace(flowtypelist.getItemAt(0));var ft:FlowType=flowtypelist.getItemAt(0) as FlowType;trace(ft.flowId);}protected function button1_clickHandler(event:MouseEvent):void{var ft:FlowType= dg.selectedItem as FlowType;Alert.show(ft.flowId.toString());ft.flowId=1000;workflowRO.addEventListener(ResultEvent.RESULT,chargereturn);workflowRO.saveFlowTypes(ft);}private function chargereturn(event:ResultEvent):void{workflowRO.removeEventListener(ResultEvent.RESULT,chargereturn);}]]></fx:Script><s:VGroup><s:Button label="添加" click="button1_clickHandler(event)"/><mx:DataGrid id="dg" width="500" height="600" dataProvider="{flowtypelist}"><mx:columns><mx:DataGridColumn dataField="flowId" headerText="flowId"/><mx:DataGridColumn dataField="pkId" width="100" headerText="pkId"/><mx:DataGridColumn dataField="typeId" headerText="typeId"/></mx:columns></mx:DataGrid></s:VGroup></s:Application>
后台对应的类:
- ackage com.system.domain;
- import java.io.Serializable;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.Id;
- import javax.persistence.Table;
- @Entity
- @Table (name = "flow_type")
- public class FlowTypeimplements Serializable {
- private Integer pkId;
- private Integer flowId;
- private Integer typeId;
- // empty Constructor
- public FlowType(){
- super();
- }
- // full Constructor
- public FlowType(Integer pkId , Integer flowId , Integer typeId){
- super();
- this.pkId = pkId;
- this.flowId = flowId;
- this.typeId = typeId;
- }
- // auto Constructor
- public FlowType(Integer flowId , Integer typeId){
- super();
- this.flowId = flowId;
- this.typeId = typeId;
- }
- @Id
- @GeneratedValue
- @Column(name = "pk_id")
- public Integer getPkId() {
- return pkId ;
- }
- public void setPkId( Integer pkId ) {
- this.pkId = pkId;
- }
- @Column(name = "flow_id")
- public Integer getFlowId() {
- return flowId ;
- }
- public void setFlowId( Integer flowId ) {
- this.flowId = flowId;
- }
- @Column(name = "type_id")
- public Integer getTypeId() {
- return typeId ;
- }
- public void setTypeId( Integer typeId ) {
- this.typeId = typeId;
- }
- flex 前后台类的传递
- json的前后台传递
- 前后台传递参数
- flex 前后台加密方法
- 0019-前后台数据传递
- jsp 前后台值传递
- Django前后台数据传递
- 隐藏变量的使用-前后台参数的传递控制。
- Action跳转时,前后台参数传递的方法
- EL实现List<Map>的前后台数值传递
- MVC4的一些前后台数据传递方法
- MVC特性---轻松实现前后台数据的传递
- JSP页面数据的前后台简单传递
- spring集成flex实现前后台通信
- Jquery 查询数据库记录进行显示在FlexiGrid 以及前后台的值传递、对象传递
- 前后台参数传递(&,%处理)
- Struts2前后台参数传递总结
- 2015061605 - 网站前后台数据传递方法
- 开源 免费 java CMS - FreeCMS-功能说明-栏目管理
- java jsp servlet fileupload上传图片时获取上传图片尺寸(宽高)的代码
- 开发中文乱码问题
- windows中通过虚拟机搭建iphone开发环境
- TC脚本开发-窗口句柄的捕捉方法总结
- flex 前后台类的传递
- 技术人员成功向技术销售转型
- Spads 出品字符串高效提取数值方法 Shane 末日圣诞奉献
- Hibernate映射的基本操作 Java类型、Hibernate映射类型以及SQL类型之间的对应关系
- Eclipse快捷键小结
- PreparedStatement使用注意
- java 读取中文文本代码
- Objective-C对象之类对象和元类对象(一)
- Java @Override报错