要配查询模板
package nc.ui.cjkcmg.cjyxdk.action;
import nc.bs.framework.common.NCLocator;
import nc.itf.cjkcmg.ICjyxdkMaintain;
import nc.ui.pubapp.uif2app.query2.action.DefaultQueryAction;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
public class QueryAction extends DefaultQueryAction{
/**
* 点击查询按钮,弹出打卡档案查询模板
*/
private static final long serialVersionUID = 1310679326706972915L;
@Override
protected void executeQuery(IQueryScheme queryScheme) {
// TODO 自动生成的方法存根
try {
getDataManager().initModelByQueryScheme(queryScheme);
} catch (Exception e) {
// TODO 自动生成的 catch 块
ExceptionUtils.wrappBusinessException("查询异常:"+e.getMessage());
}
}
//要修改哪个单子调哪个单子的接口
private ICjyxdkMaintain service;
private ICjyxdkMaintain getService(){
if (service == null) {
service = NCLocator.getInstance().lookup(ICjyxdkMaintain.class);
}
return service;
}
}
<bean id="queryTemplateContainer" class="nc.ui.uif2.editor.QueryTemplateContainer">
<property name="context" ref="context">property>
<property name="nodeKey" value="qt">property>
bean>
<bean id="queryAction" class="nc.ui.cjkcmg.cjyxdk.action.QueryAction">
<property name="model"><ref bean="batchModel" />property>
<property name="templateContainer"><ref bean="queryTemplateContainer" />property>
<property name="nodeKey" value="qt"/>
bean>
package nc.ui.cjkcmg.cjyxdk.action;
import java.awt.event.ActionEvent;
import nc.bs.framework.common.NCLocator;
import nc.itf.cjkcmg.ICjyxdkMaintain;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pub.beans.UIRefPane;
import nc.ui.pubapp.uif2app.model.BatchBillTableModel;
import nc.ui.pubapp.uif2app.model.BatchModelDataManager;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.editor.BatchBillTable;
import nc.uif2.annoations.MethodType;
import nc.uif2.annoations.ModelMethod;
import nc.uif2.annoations.ModelType;
import nc.vo.bd.meta.BatchOperateVO;
import nc.vo.cjkcmg.cjyxdk.Cjyxdk;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDate;
import nc.vo.wgbfb.utils.NullValueUtils;
public class DkAction extends NCAction{
/**
* 新增打卡按钮,点击打卡按钮,自动生成一条打卡记录
*/
private static final long serialVersionUID = 1L;
private BatchBillTableModel model;
private BatchBillTable editor;
private BatchModelDataManager dataManager ;
public DkAction() {
// TODO 自动生成的构造函数存根
setCode("dkAction");
setBtnName("打卡");
}
@Override
public void doAction(ActionEvent e) throws BusinessException {
try{
//直接弹一个(客户)参照
UIRefPane refPane = new UIRefPane("客户档案");
//显示参照
refPane.showModel();
//获取选中参照的数据
String[] unit = (String[]) refPane.getValueObj();
if(unit == null) {
return;
}
//客户
String pk_customer = refPane.getRefPK();
//打卡人
String userId = getModel().getContext().getPk_loginUser();
//新建一个打卡vo
Cjyxdk dkvo = new Cjyxdk();
//集团
dkvo.setPk_group("0001A1100000000003UJ");
//组织
dkvo.setPk_org("GLOBLE00000000000000");
//客户
dkvo.setCustomer(pk_customer);
//打卡时间
dkvo.setDksj(new UFDate());
//打卡人
dkvo.setDkr(userId);
//打卡年度
dkvo.setDknd(NullValueUtils.getNullStringValue(new UFDate()).substring(0, 4));
//档案新增方法
BatchOperateVO batchVO = new BatchOperateVO();
batchVO.setAddObjs(new Cjyxdk[]{dkvo});
getService().batchSave(batchVO);
//刷新打卡档案
getDataManager().refresh();
//弹框提示打卡成功
MessageDialog.showHintDlg(null, "提示", "打卡成功");
}catch(Exception e2){
throw new BusinessException("打卡失败:" + e2.getMessage());
}
}
//要修改哪个单子调哪个单子的接口
private ICjyxdkMaintain service;
private ICjyxdkMaintain getService(){
if (service == null) {
service = NCLocator.getInstance().lookup(ICjyxdkMaintain.class);
}
return service;
}
public BatchBillTableModel getModel() {
return model;
}
@ModelMethod(modelType=ModelType.AbstractUIAppModel, methodType=MethodType.SETTER)
public void setModel(BatchBillTableModel model) {
this.model = model;
this.model.addAppEventListener(this);
}
public BatchBillTable getEditor() {
return editor;
}
public void setEditor(BatchBillTable editor) {
this.editor = editor;
}
public BatchModelDataManager getDataManager() {
return dataManager;
}
public void setDataManager(BatchModelDataManager dataManager) {
this.dataManager = dataManager;
}
}
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="context" class="nc.vo.uif2.LoginContext">bean>
<bean id="batchModelModelService" class="nc.ui.cjkcmg.cjyxdk.model.ListModelService">
bean>
<bean id="BOAdapterFactory" class="nc.vo.bd.meta.GeneralBDObjectAdapterFactory">
<property name="mode" value="MD"/>
bean>
<bean id="batchModel" class="nc.ui.pubapp.uif2app.model.BatchBillTableModel">
<property name="context"><ref bean="context"/>property>
<property name="service"><ref bean="batchModelModelService" />property>
<property name="businessObjectAdapterFactory"><ref bean="BOAdapterFactory"/>property>
bean>
<bean id="batchModelModelDataManager" class="nc.ui.cjkcmg.cjyxdk.model.ListModelDataManager">
<property name="model"><ref bean="batchModel"/>property>
<property name="paginationModel" ref="paginationModel" />
<property name="delegator" ref="paginationDelegator" />
bean>
<bean id="templateContainer" class="nc.ui.pubapp.uif2app.view.TemplateContainer" init-method="load">
<property name="context" ref="context"/>
<property name="nodeKeies">
<list>
<value>btvalue>
list>
property>
bean>
<bean id="viewa" class="nc.ui.pubapp.uif2app.view.OrgPanel" init-method="initUI">
<property name="model"><ref bean="batchModel" />property>
<property name="dataManager" ref="batchModelModelDataManager" />
bean>
<bean id="batchBillTable" class="nc.ui.cjkcmg.cjyxdk.ace.view.ListEditor" init-method="initUI">
<property name="model"><ref bean="batchModel" />property>
<property name="nodekey" value="bt" />
bean>
<bean id="container" class="nc.ui.uif2.TangramContainer" init-method="initUI">
<property name="tangramLayoutRoot">
<bean class="nc.ui.uif2.tangramlayout.node.VSNode">
<property name="up">
<bean class="nc.ui.uif2.tangramlayout.node.CNode">
<property name="component">
<ref bean="viewa" />
property>
bean>
property>
<property name="down">
<bean class="nc.ui.uif2.tangramlayout.node.CNode">
<property name="component">
<ref bean="listContainerWithPaginationBar" />
property>
bean>
property>
<property name="dividerLocation" value="74.0f" />
<property name="name" value="" />
bean>
property>
<property name="actions">
<list>
<ref bean="queryAction" />
<ref bean="dkAction" />
list>
property>
<property name="editActions">
<list>
<ref bean="batchSaveAction" />
<ref bean="batchCancelAction" />
<ref bean="batchAddLineActiona" />
<ref bean="batchDelLineActiona" />
list>
property>
<property name="model" ref="batchModel" />
bean>
<bean id="InitDataListener" class="nc.ui.pubapp.uif2app.model.DefaultFuncNodeInitDataListener">
<property name="model" ref="batchModel"/>
<property name="context" ref="context">property>
<property name="voClassName" value="nc.vo.cjkcmg.cjyxdk.Cjyxdk"/>
bean>
<bean id="batchModelEventMediator" class="nc.ui.pubapp.uif2app.model.AppEventHandlerMediator">
<property name="model" ref="batchModel" />
<property name="handlerGroup">
<list>
<bean class="nc.ui.pubapp.uif2app.event.EventHandlerGroup">
<property name="event" value="nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent"/>
<property name="handler">
<bean class="nc.ui.cjkcmg.cjyxdk.ace.handler.CjyxdkBeforeEditHandler"/>
property>
bean>
<bean class="nc.ui.pubapp.uif2app.event.EventHandlerGroup">
<property name="event" value="nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent"/>
<property name="handler">
<bean class="nc.ui.cjkcmg.cjyxdk.ace.handler.CjyxdkAfterEditHandler"/>
property>
bean>
list>
property>
bean>
<bean id="batchEditAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchEditAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchRefreshAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchRefreshAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="modelManager"><ref bean="batchModelModelDataManager"/>property>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchAddLineAction" class="nc.ui.cjkcmg.cjyxdk.action.CjyxdkAddLineAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="voClassName" value="nc.vo.cjkcmg.cjyxdk.Cjyxdk" />
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchDelLineAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchDelLineAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="batchBillTable"><ref bean="batchBillTable"/>property>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="queryTemplateContainer" class="nc.ui.uif2.editor.QueryTemplateContainer">
<property name="context" ref="context">property>
<property name="nodeKey" value="qt">property>
bean>
<bean id="queryAction" class="nc.ui.cjkcmg.cjyxdk.action.QueryAction">
<property name="model"><ref bean="batchModel" />property>
<property name="templateContainer"><ref bean="queryTemplateContainer" />property>
<property name="nodeKey" value="qt"/>
<property name="dataManager"><ref bean="batchModelModelDataManager" />property>
bean>
<bean id="dkAction" class="nc.ui.cjkcmg.cjyxdk.action.DkAction">
<property name="model" ref="batchModel" />
<property name="editor" ref="batchBillTable" />
<property name="dataManager" ref ="batchModelModelDataManager"/>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchSaveAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchSaveAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="editor"><ref bean="batchBillTable"/>property>
<property name="validationService"><ref bean="batchBillTableValidateService" />property>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchCancelAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchCancelAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="editor"><ref bean="batchBillTable"/>property>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchAddLineActiona" class="nc.ui.cjkcmg.cjyxdk.action.CjyxdkAddLineActiona">
<property name="model"><ref bean="batchModel"/>property>
<property name="voClassName" value="nc.vo.cjkcmg.cjyxdk.Cjyxdk" />
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="batchDelLineActiona" class="nc.ui.pubapp.uif2app.actions.batch.BatchDelLineAction">
<property name="model"><ref bean="batchModel"/>property>
<property name="batchBillTable"><ref bean="batchBillTable"/>property>
<property name="exceptionHandler"><ref bean="exceptionHandler" />property>
bean>
<bean id="exceptionHandler" class="nc.ui.uif2.DefaultExceptionHanler">
<constructor-arg><ref bean="container"/>constructor-arg>
<property name="context"><ref bean="context" />property>
bean>
<bean id="batchBillTableValidateService" class="nc.ui.uif2.model.DefaultBatchValidationService">
<property name="editor"><ref bean="batchBillTable" />property>
bean>
<bean id="paginationDelegator" class="nc.ui.bd.pub.BillBatchPaginationDelegator">
<property name="paginationModel" ref="paginationModel" />
<property name="billModel" ref="batchModel" />
<property name="editor" ref="batchBillTable" />
bean>
<bean id="paginationModel" class="nc.ui.uif2.components.pagination.PaginationModel"
init-method="init">
<property name="paginationQueryService" ref="batchModelModelService" />
<property name="pageSize" value="500" />
bean>
<bean id="paginationBar" class="nc.ui.uif2.components.pagination.PaginationBar"
init-method="registeCallbak">
<property name="paginationModel" ref="paginationModel" />
<property name="context" ref="context" />
bean>
<bean name="listContainerWithPaginationBar" class="nc.ui.cjkcmg.cjyxdk.ace.view.ListSplitPanel">
<property name="component1" ref="batchBillTable" />
<property name="component2" ref="paginationBar" />
<property name="divideLocation" value="30" />
<property name="model" ref="batchModel" />
bean>
beans>