4.3典型的UI Coding

2020-04-18 00:11

典型的UI Coding

1. 列表界面常用代码

tblMain 作为框架为list列表界面中的kdTable绑定的变量,通过它可以访问到列表上的每一行、每一列,可以做数据检查,控制,格式化,行合并等操作

1.1) 初始化用户自己定义的查询对话框,如果采用的是系统通用对话框则不需要实

现下面的方法

protected CommonQueryDialog initCommonQueryDialog() { dialog = super.initCommonQueryDialog(); try { dialog.addUserPanel(getUserPanel()); dialog.setShowFilter(true); dialog.setShowSorter(true); dialog.setHeight(380); dialog.setWidth(500); dialog.setTitle(‘客户自定义过滤框’); } catch (Exception e) { handUIException(e); } return dialog; } protected CustomerQueryPanel getUserPanel() throws Exception { if (this.userPanel == null) this.userPanel = new PurOrderQueryUI(); userPanel.onLoad(); return this.userPanel; }

1.2) 设置列表界面的默认过滤条件,可用来过滤列表数据, 也可以直接设置

mainQuery的值实现过滤 protected EntityViewInfo getInitDefaultSolution() { EntityViewInfo ev = new EntityViewInfo(); OtherBillQueryUI queryUI = null; try { queryUI = new PurOrderQueryUI(); queryUI.onLoad(); } catch (Exception e) { handUIException(e); }

ev.setFilter(queryUI.getFilterInfo()); return ev; }

1.3) 设置是否在调入列表界面之前先出过滤框

protected boolean initDefaultFilter()

{ return true; }

1.4) 客户端对审核的操作

public void actionAuditing_actionPerformed(ActionEvent e) throws Exception

{ //检查单据状态 if (!checkStatus(tblMain, BillStatusEnum.SUBMITED)) {

MsgBox.showInfo(this,

Day4Resource.getStrResource(\

SysUtil.abort(); } IPurOrder purorder = (IPurOrder) getBizInterface(); String[] billIdlist = getSelectedListId(); //常用的弹出对话框方法 int i = MsgBox.showConfirm2(this, \ if (i == MsgBox.OK) { //审核操作 purOrder.audit(new ObjectStringPK(bill)); //完成其他业务逻控制 // 刷新列表界面 actionRefresh_actionPerformed(null); } }

1.5) 关联生成

public void actionCreateTo_actionPerformed(ActionEvent e) throws Exception { checkSelected(); // 未审核单据不能关联生成 if (!checkStatus(tblMain, BillStatusEnum.AUDITED)) { MsgBox.showInfo(this, \ SysUtil.abort(); } //有系统调用配置好的‘botp’规则

super.actionCreateTo_actionPerformed(e); }

1.6) 动态调用UI界面,并在UI之间传递变量

private void makePurOrderUI(PurOrderInfo srcBillInfo)

throws EASBizException, UIException,

BOSException, Exception { String destBillEditUIClassName = “com.kingdee….PurOrderEditUI”; Map map = new UIContext(this); map.put(\ map.put(UIContext.OWNER, this); map.put(\ IUIWindow uiWindow = null ;

// UIFactoryName.MODEL 为弹出模式

uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).

create(destBillEditUIClassName, map, null,

OprtState.ADDNEW); //可对创建的ui进行操作

//((CoreBillEditUI).uiWindow.getUIObject()).

//setMakeRelations(btpResult.getBOTRelationCollection());

//开始展现UI

uiWindow.show();

}

1.7) 关于编码规则

// 是否存在编码规则 protected boolean isCodeRuleEnable(IObjectValue objValue)

throws EASBizException, BOSException {

String companyId = OrgInnerUtils.getCurCompany(); ICodingRuleManager codeRuleMgr = null;

codeRuleMgr = CodingRuleManagerFactory.getRemoteInstance();

return codeRuleMgr.isExist(objValue, companyId); } // 得到自动编码 protected String getAutoCode(IObjectValue objValue)

throws EASBizException, BOSException {

String companyId = OrgInnerUtils.getCurCompany();

ICodingRuleManager codeRuleMgr = null;

}

1.8) 如何得到当前选中行的id

// 得到当前选中行的id public String[] getSelectedListId() { checkSelected(); // SelectManager 是kdtable中行管理类 ArrayList blocks = tblMain.getSelectManager().getBlocks(); ArrayList idList = new ArrayList(); Iterator iter = blocks.iterator(); while (iter.hasNext()) { KDTSelectBlock block = (KDTSelectBlock) iter.next(); int top = block.getTop(); int bottom = block.getBottom(); for (int rowIndex = top; rowIndex <= bottom; rowIndex++)

{

ICell cell = tblMain.getRow(rowIndex).

getCell(getKeyFieldName());

if (!idList.contains(cell.getValue())) { idList.add(cell.getValue()); } } } String[] listId = null; if (idList != null && idList.size() > 0) { Iterator iterat = idList.iterator(); listId = new String[idList.size()]; int index = 0; while (iterat.hasNext()) { listId[index] = (String) iterat.next(); index++; } } return listId;

codeRuleMgr = CodingRuleManagerFactory.getRemoteInstance();

if (codeRuleMgr.isUseIntermitNumber(objValue, companyId)) { return codeRuleMgr.readNumber(objValue, companyId); } else { return codeRuleMgr.getNumber(objValue, companyId); }

}

1.9) 关于数字精度的设置

private void changeShowData(int fistRow, int lastRow)

throws EASBizException, BOSException { for (int i = fistRow; i <= lastRow; i++)

{

IRow row = tblMain.getRow(i); // 根据币别设置精度 ICell cell = row.getCell(“columnName”); //假定精度为2 int precision = 2; if (cell != null && cell.getValue() != null) { try { precision = Integer.parseInt(cell.getValue().toString()); } catch (Exception e) { precision = 2; } } // 当该行的币别精度不能于原币精度时才更改精度 if (precision != basePrecision) { for (int j = 0; j

tblMain.getColumn(\ \

tblMain.getColumn(\ \

tblMain.getColumn(\ HorizontalAlignment.RIGHT);

tblMain.getColumn(\ .setNumberFormat(\

tblMain.getColumn(\ .setHorizontalAlign(HorizontalAlignment.RIGHT); } } } }


4.3典型的UI Coding.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:查账-广州市2012年度企业所得税汇算清缴纳税申报鉴证报告 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: