点击按钮弹框,出现以下界面
1.按钮代码:
try{
if(billVO != null){
FuncletInitData initDataa = new FuncletInitData();
initDataa.setInitType(47);
initDataa.setInitData(billVO);
FuncRegisterVO funvo = WorkbenchEnvironment.getInstance()
.getFuncRegisterVO("Z1030303");//
if (null == funvo) {
// 应付未启用
throw new BusinessException("应付未启用");
}
FuncletWindowLauncher.openFuncNodeForceModalDialog(WorkbenchEnvironment.getInstance().getWorkbench(),
funvo, initDataa, null, true, new Dimension(1024, 768), true);
}
}catch(Exception e){
throw new BusinessException(e.getMessage());
}
2.需要打开节点的xml配置文件中,修改初始化监听
<!-- 打开节点监听 newadd-->
<bean id="InitDataListener" class="nc.ui.fdc_pr.h303113510.ace.handler.MyDefaultFuncNodeInitDataListener">
<property name="model" ref="bmModel"/>
<property name="context" ref="context"></property>
<property name="voClassName" value="nc.vo.fdc_pr.h303113510.AggRentPact"/>
<property name="billform" ref="billForm"></property>
<property name="defaultUIF2RefEditor">
<ref bean="defaultUIF2RefEditor" />
</property>
</bean>
<!-- 导入编辑器 -->
<bean id="defaultUIF2RefEditor" class="nc.itf.fdc.pub.DefaultUIF2RefEditor">
<property name="addAction" ref="addAction" />
<property name="billcardPanelEditor" ref="billForm" />
<property name="appModel" ref="bmModel" />
</bean>
3.节点初始化监听类
package nc.ui.fdc_pr.h303113510.ace.handler;
import nc.funcnode.ui.FuncletInitData;
import nc.itf.fdc.pub.DefaultUIF2RefEditor;
import nc.ui.pubapp.uif2app.model.DefaultFuncNodeInitDataListener;
import nc.ui.pubapp.uif2app.view.ShowUpableBillForm;
import nc.vo.fdc_pr.h303113510.AggRentPact;
import nc.vo.fdc_pr.h303202005.AggRevfare;
/**
*
* @author:
* @ClassName: MyDefaultFuncNodeInitDataListener
* @Description: 节点打开初始化数据
* @date: 2016年12月18日
*/
public class MyDefaultFuncNodeInitDataListener extends DefaultFuncNodeInitDataListener {
ShowUpableBillForm billform;
private DefaultUIF2RefEditor defaultUIF2RefEditor = null;
public void initData(FuncletInitData data) {
if (null == data) {
this.getModel().initModel(null);
return;
}
//用参数中传过来的数据初始化AppModel,可能会转换成VO或VO数组,根据业务确定
AggRentPact initData =(AggRentPact) data.getInitData();
//调用添加按钮
getDefaultUIF2RefEditor().addNew();
//初始化数据
getDefaultUIF2RefEditor().setValue(initData);
}
public ShowUpableBillForm getBillform() {
return billform;
}
public void setBillform(ShowUpableBillForm billform) {
this.billform = billform;
}
public DefaultUIF2RefEditor getDefaultUIF2RefEditor() {
return defaultUIF2RefEditor;
}
public void setDefaultUIF2RefEditor(DefaultUIF2RefEditor defaultUIF2RefEditor) {
this.defaultUIF2RefEditor = defaultUIF2RefEditor;
}
}
4.导入编辑器
package nc.itf.fdc.pub;
import nc.ui.pub.bill.BillData;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.editor.IBillCardPanelEditor;
import nc.ui.uif2.model.AbstractUIAppModel;
import nc.vo.pub.AggregatedValueObject;
public class DefaultUIF2RefEditor {
private NCAction addAction = null;
private Exception ex; //保存过程中通过拦截器将异常抛出
private IBillCardPanelEditor billcardPanelEditor = null;
private AbstractUIAppModel appModel = null;
protected NCAction createAddAction()
{
return null;
}
protected NCAction createSaveAction()
{
return null;
}
protected NCAction createCancelAction()
{
return null;
}
protected IBillCardPanelEditor createBillCardPanelEditor()
{
return null;
}
protected AbstractUIAppModel createAppModel()
{
return null;
}
/**
* 新增操作
*
* @see nc.itf.trade.excelimport.IImportableEditor#addNew()
*/
public void addNew() {
try {
getAddAction().actionPerformed(null);
} catch (Exception e) {
nc.bs.logging.Logger.error(e.getMessage());
}
}
/**
* 设值操作
*
* 标准的操作步骤如下:
* 1,转型VO为ExtendedAggregatedValueObject
* 2,根据转换规则处理VO的相关属性值
* 3,将处理后的VO值设置到界面上
*/
public void setValue(Object obj) {
if(getBillcardPanelEditor() != null)
{
BillData bd = getBillcardPanelEditor().getBillCardPanel().getBillData();
bd.setBillValueVO((AggregatedValueObject)obj);
}
}
/**
* 返回AddAction对象
*/
public NCAction getAddAction() {
if(addAction == null)
addAction = createAddAction();
return this.addAction;
}
public void setAddAction(NCAction addAction) {
this.addAction = addAction;
}
public IBillCardPanelEditor getBillcardPanelEditor() {
if(billcardPanelEditor == null)
billcardPanelEditor = createBillCardPanelEditor();
return billcardPanelEditor;
}
public void setBillcardPanelEditor(IBillCardPanelEditor billcardPanelEditor) {
this.billcardPanelEditor = billcardPanelEditor;
}
public AbstractUIAppModel getAppModel() {
if(this.appModel == null)
appModel = createAppModel();
return appModel;
}
public void setAppModel(AbstractUIAppModel model) {
this.appModel = model;
}
public int getExportCount() {
return 1;
}
public Exception getEx() {
return ex;
}
public void setEx(Exception ex) {
this.ex = ex;
}
}