/** 指定操作发生时,触发的事件 */ public void actionPerformed(String rowId, String actionName, String actionValue) { if (actionName.equals(Action.Allocate.name())) { allocate(rowId); } else if (actionName.equals(Action.Delete.name())) { delete(rowId); } else if (actionName.equals("edit")) { edit(rowId); } }
@Override public String[] getTableActionIds() { List<String> list = new ArrayList<String>(); LoginInfo login = getContext().find(LoginInfo.class); if (login.hasAuth(Auth.SubFunction_CustomerMange_BusPerson)) { list.add(Action.Allocate.name()); } list.add(Action.Delete.name()); return list.toArray(new String[0]); }
/** 行对像指定操作发生时,触发的事件 */ @Override public void actionPerformed(final String rowId, String actionName, String actionValue) { if (actionName.equals(Action.Delete.name())) { // 删除公告 confirm( "确认删除当前公告?", new Runnable() { public void run() { DeleteNoticeTask deleteNoticeTask = new DeleteNoticeTask(); deleteNoticeTask.setRECID(GUID.valueOf(rowId)); getContext().handle(deleteNoticeTask); hint("删除成功!"); table.render(); } }); } else if (ID_ACTION_EDIT.equals(actionName)) { // 编辑公告 WindowStyle style = new WindowStyle(JWT.CLOSE | JWT.MODAL); style.setSize(750, 500); FindNoticeInfoKey findNoticeInfoKey = new FindNoticeInfoKey(); findNoticeInfoKey.setRECID(GUID.valueOf(rowId)); NoticeInfo noticeInfo = getContext().get(NoticeInfo.class, findNoticeInfoKey); PageControllerInstance controllerInstance = new PageControllerInstance("addNoticePage", noticeInfo); MsgRequest request = new MsgRequest(controllerInstance, "编辑公告", style); // 回应 request.setResponseHandler( new ResponseHandler() { public void handle( Object returnValue, Object returnValue2, Object returnValue3, Object returnValue4) { hint("保存成功!在发布日,系统将自动发布该公告。"); table.render(); } }); getContext().bubbleMessage(request); } }
/** 获取可以对指定行对象进行删除操作 */ @Override protected String[] getElementActionIds(Object element) { return new String[] {Action.Delete.name()}; }
/** 获取可以对表格数据进行删除操作 */ @Override public String[] getTableActionIds() { return new String[] {Action.Delete.name()}; }