首页 > 代码库 > 添加一个功能Action

添加一个功能Action

1,只用一个handler类,所有都事件的处理器都在一个handler类

handler要创建以Action为名称的方法

event要单独分开,继承KDEvent

1 package com.kingdee.eas.re.sales.receiveGather.event;
2 import com.kingdee.bos.eventbus.KDEvent;
3 public class QueryGridEvent extends KDEvent {
4 @Override
5 protected void dispatch(IEventHandler handler) throws Exception {
6         ((Handler类名)handler).Action方法名(this);
7     }
8 }

2,

event和handler单独创建

event继承KDActionEvent 不需要写任何代码

handler继承AbstractWebEventHandler implements IActionEventHandler

 1 //event
 2 package com.kingdee.eas.re.sales.inTransfer.event;
 3 import com.kingdee.bos.eventbus.event.action.KDActionEvent;
 4 public class CarryOverEvent extends KDActionEvent {
 5     
 6 }
 7 
 8 
 9 
10 
11 //handler
12 package com.kingdee.eas.re.sales.inTransfer.handler;
13 public class CarryOverEventHandler extends AbstractWebEventHandler implements IActionEventHandler {
14 public void onAction(KDActionEvent event) throws EASBizException,BOSException {
15 
16     }
17 }    

 

 

技术分享

添加一个功能Action