首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

Flex 新平添一个功能的流程

2012-11-09 
Flex 新添加一个功能的流程新添加一个功能的流程?首先从后台开始(1) 在dao层的实现类中?? public Paginati

Flex 新添加一个功能的流程

新添加一个功能的流程

?

首先从后台开始

(1) 在dao层的实现类中

?? public Pagination<PmgRole> findPosiRole(Long positionId, String isType, Pagination<PmgRole> pagination) throws DataAccessFailureException

??? {

?????? StringBuffer hql = new StringBuffer();

??????

?????? hql.append("select role.* from PmgRole role where role.roleId in (select p_a.id.roleId from OmPartyRole where 1=1 ")

?????? .append("and p_a.id.partyId = '")

?????? .append(positionId)

?????? .append("' ")

?????? .append("and p_a.id.partyType = '")

?????? .append(isType)

?????? .append("'");

??????

?????? return this.listPagination(hql, null, pagination);

??? }

?

?

(2)在dao层的接口中

/**

??? ?* 查询岗位继承职务、机构的角色

??? ?* @param omPostion

??? ?* @param isType

??? ?* @param pagination

??? ?* @return

??? ?* @throws DataAccessFailureException

??? ?*/

??? public Pagination<PmgRole> findPosiRole(Long positionId, String isType, Pagination<PmgRole> pagination)

?????????? throws DataAccessFailureException;

?

?

(3)在sevice层中

?

public Pagination<PmgRole> findPosiRole(Integer positionId, String isType, Pagination<PmgRole> pagination) throws ServiceException

??? {

?????? Long partyId = null;

?????? OmPosition omPostion = omPostionDao.get(positionId);

??????

?????? if(!UtilHelper.isEmpty(isType)){

?????????? if(SystemConstant.ORGAN.equals(isType)){

????????????? partyId = omPostion.getOrgId();

?????????? }else if(SystemConstant.DUTY.equals(isType)){

????????????? partyId = omPostion.getDutyId();

?????????? }

?????? }

??????

?????? return pmgRoleDao.findPosiRole(partyId, isType, pagination);

??? }

?

(4)在fa?ade层的实现类中

?? public Pagination<PmgRole> findPosiRole(Integer positionId, String isType, Pagination<PmgRole> pagination) throws ServiceException

??? {

?????? return pmgRoleService.findPosiRole(positionId, isType, pagination);

??? }

?

(5)在fa?ade接口中的处理

?

public Pagination<PmgRole> findPosiRole(Integer positionId, String isType, Pagination<PmgRole> pagination)

?????????? throws ServiceException;

?

?

其次在前台的处理

(1)在delegate层

??? public function findPosiRole(partyId:Number, isType:String, pagination:Pagination):AsyncToken

?????? {

?????????? return remoteObject.findPosiRole(partyId, isType, pagination);

?????? }

?

(2)在Command层

?

新添加一个类

package com.ly.lymc.front.command.pmg

{

??? import com.ly.lymc.front.components.pagination.IPagination;

??? import com.ly.lymc.front.components.pagination.Pagination;

??? import com.ly.lymc.front.delegate.pmg.PmgRoleDelegate;

???

??? import mx.rpc.AsyncToken;

???

??? public class PosiExtendRoleCommand implements IPagination

??? {

?????? public function PosiExtendRoleCommand()

?????? {

?????? }

??????

?????? private var _omId:Number;

?????? private var _isType:String;

??????

?????? public function putParams(_omId:Number, _isType:String):void

?????? {

?????????? this._omId = _omId;

?????????? this._isType = _isType;

?????? }

??????

?????? public function execute(pagination:Pagination):AsyncToken

?????? {

?????????? var token:AsyncToken = PmgRoleDelegate.getInstance().findPosiRole(_omId, _isType, pagination);

?????????? return token;

?????? }

??? }

}

?

(3)在你要作用的地方添加一个方法

例如:

private function extendRole(obj:String):void

?????????? {

????????????? var tWin:ExtendRoleList = new ExtendRoleList();

????????????? tWin.posiid = this.posiId.text;

????????????? tWin.isType = obj;

????????????? PopUpManagerHelper.addPopUp(tWin, true);

????????????? PopUpManagerHelper.centerPopUp(tWin);

?????????? }

?

?

?

(4)最后就页面的处理

?

<?xml version="1.0" encoding="utf-8"?>

<ly:SimpleTitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"

????????????????? ? xmlns:s="library://ns.adobe.com/flex/spark"

????????????????? ? xmlns:ly="com.ly.lymc.front.components.*"

????????????????? ? xmlns:grids="com.ly.lymc.front.components.grids.*"

????????????????? ? xmlns:xy="com.ly.lymc.front.components.pagination.xml.*"

????????????????? ? xmlns:mx="library://ns.adobe.com/flex/mx" width="500" height="400" title="岗位继承角色列表"

??? ????????????? ? creationComplete="doInit()">

??? <fx:Declarations>

?????? <!-- Place non-visual elements (e.g., services, value objects) here -->

??? </fx:Declarations>

??? <fx:Script>

?????? <![CDATA[

?????????? import com.ly.lymc.front.cache.ApplicationCache;

?????????? import com.ly.lymc.front.cache.DicDetailCache;

?????????? import com.ly.lymc.front.command.pmg.PmgRoleCommand;

?????????? import com.ly.lymc.front.command.pmg.PmgUserRoleCommand;

?????????? import com.ly.lymc.front.command.pmg.PosiExtendRoleCommand;

?????????? import com.ly.lymc.front.command.pmg.UserRolePageCommand;

?????????? import com.ly.lymc.front.constant.Constant;

?????????? import com.ly.lymc.front.constant.DicConstant;

?????????? import com.ly.lymc.front.pagination.pmg.RolePaginationImpl;

?????????? import com.ly.lymc.front.tools.UtilHelper;

??????????

?????????? import mx.controls.Alert;

?????????? import mx.events.FlexEvent;

?????????? import mx.events.ItemClickEvent;

?????????? import mx.managers.PopUpManager;

?????????? import mx.modules.ModuleLoader;

??????????

?????????? private var _mLoader:ModuleLoader;

??????????

?????????? public var

热点排行