添加一个功能Action

时间:2022-07-27 10:25:32

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

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

event要单独分开,继承KDEvent

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

2,

event和handler单独创建

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

handler继承AbstractWebEventHandler implements IActionEventHandler

 //event
package com.kingdee.eas.re.sales.inTransfer.event;
import com.kingdee.bos.eventbus.event.action.KDActionEvent;
public class CarryOverEvent extends KDActionEvent { } //handler
package com.kingdee.eas.re.sales.inTransfer.handler;
public class CarryOverEventHandler extends AbstractWebEventHandler implements IActionEventHandler {
public void onAction(KDActionEvent event) throws EASBizException,BOSException { }
}

添加一个功能Action