String id=\
ObjectUuidPK pk = new ObjectUuidPK(BOSUuid.read(id));//建立逻辑键 c.getValue(pk); 或 : c.getCurrencyInfo(pk);
6. 界面之间传递参数
1. 收集父界面要传递给子界面的参数集 HashMap map = new HashMap(); map.put(\必须。被启动UI的父UI对象 map.put(\ map.put(\ map.put(\ map.put(\ IUIFactory uiFactory = null; uiFactory = UIFactory
.createUIFactory(\以模态对话框方式启动
IUIWindow uiWindow = uiFactory create(
\被启动对象的类名称 */
map); uiWindow.show();
2. 在子界面获取传递下来的数据
private void loadContext() {
int mode = ((Integer)this.getUIContext().get(\
AccountTableInfo accountTableInfo = (AccountTableInfo) this.getUIContext().get(\//cjp cu
CtrlUnitInfo cuInfo = (CtrlUnitInfo) this.getUIContext().get(\
AsstAccountInfo asstAccountInfo = (AsstAccountInfo) this.getUIContext().get(\
AuxAccountEditUI ui = (AuxAccountEditUI) this.getUIContext().get(\} 7. 给
Query传过滤条件
EntityViewInfo evi = new EntityViewInfo(); FilterInfo filterInfo = new FilterInfo(); //建立过滤条件 filterInfo.getFilterItems().add( new FilterItemInfo(\ CompareType.EQUALS)); filterInfo.getFilterItems().add( new FilterItemInfo(\ CompareType.EQUALS));
filterInfo.setMaskString(\evi.setFilter(filterInfo);
if (mainQuery == null) { mainQuery = new EntityViewInfo(); }
mainQuery.setFilter(filterInfo); //添加过滤条件 this.execQuery();
8. 接口方法的访问方式
3. 客户端访问
CurrencyInfo cur = new CurrencyInfo();
ICurrency c = CurrencyFactory.getRemoteInstance();//建立实体对象 c. getCurrencyCollection(); 4. 服务端访问
CurrencyInfo cur = new CurrencyInfo();
ICurrency c = CurrencyFactory. getLocalInstance (ctx);//建立实体对象 c. getCurrencyCollection();
9. 特别控件的初始化
1.使用枚举给ComboBox控件赋值 public void setReceiveType() {
this.kDComboBox2.removeAllItems(); List list = new List();
Iterator it = ReceiveType.iterator(); while (it.hasNext()) {
list.add(ReceiveType.getEnum(it.toString()).toString()); }
}
2.使用值对象集合给ComboBox控件赋值 // 获取结算方式列表
IAsstActTypeDefault iAsstActType = AsstActTypeDefaultFactory.getRemoteInstance(); AsstActTypeDefaultCollectioni asstActTypeColl = iAsstActType
.getAsstActTypeDefaultCollection(\ AsstActTypeDefaultInfo defaultVal = null; int count = asstActTypeColl.size();
Object[] typeValue = new Object[count]; for (int i = 0; i < count; i++) {
AsstActTypeDefaultInfo value = (AsstActTypeDefaultInfo) asstActTypeColl.get(i); if (value.isIsDefaultAccountPayable())
{
defaultVal = value; }
ObjectUuidPK pk = new ObjectUuidPK(BOSUuid .read(value.getAsstActType().getString(\
AsstActTypeInfo asstInfo = AsstActTypeFactory.getRemoteInstance().getAsstActTypeInfo(pk); //cbi[i] = new ComBoxInfo(asstInfo, asstInfo.getName(), true); String typeName = asstInfo.getName(); String typeId = asstInfo.getId().toString();
String typeQueryName = asstInfo.getDefaultQueryName(); String typeTableName = asstInfo.getRealtionDataObject(); int csType = 0; //asstActTypeInfo.getCsType().getValue();
asstActType = new AsstActTypeUtils(typeName, typeId, typeTableName, typeQueryName, csType);
typeValue[i] = (Object) asstActType;
}
///String strQueryName = \
this.kDComAccountCussentType.removeAllItems(); this.kDComAccountCussentType.addItems(typeValue); this.kDComAccountCussentType.setSelectedIndex(0);
10. F7赋值
ObjectUuidPK pk = new ObjectUuidPK(id); IObjectValue objVal = DynamicObjectFactory.getRemoteInstance().getValue(pk.getObjectTypei(), pk);
bizPrompt.setData(objVal);
private void setCompanyF7() {
//公司的F7的设置
OrgType[] CompanyType = { OrgType.Company };
//首先定义需要显示那些树,这里只显示财务树 //为F7控件指定PromptBox
this.bizPromptCompany.setEditFormat(\ this.bizPromptCompany.setDisplayFormat(\ this.bizPromptCompany.setEditable(true);
this.bizPromptCompany.setCommitFormat(\
OrgUnitTreePromptBox boxCompany = new OrgUnitTreePromptBox(this, CompanyType, null,
OrgSelect.OnlySelectCompanyEntity, false, false, false);
bizPromptCompany.setSelector(boxCompany); bizPromptCompany.setData(currentCompany); bizPromptCompany.setEnabled(false);
}
//设置币别
private void setCurrency() throws EASBizException, BOSException {
ICurrency iCurrency = null; CurrencyCollection con = null; try {
iCurrency = CurrencyFactory.getRemoteInstance(); con = iCurrency.getCurrencyCollection(true); }
catch (Exception e) {
// TODO 自动生成 catch 块
MsgBox.showError(this, EASResource.getString(resClassName, \ SysUtil.abort(); }
if (con != null) {
Object[] typeValue = new Object[con.size()]; int j = 0;
for (int i = 0; i < con.size(); i++) {
CurrencyInfo currencyInfo = (CurrencyInfo) con.get(i); String typeName = currencyInfo.getName(); String typeId = currencyInfo.getId().toString();
String typeQueryName = currencyInfo.getNumber();
asstActType = new AsstActTypeUtils(typeName, typeId, typeQueryName); if (asstActType != null) {
typeValue[i] = (Object) asstActType;
if(typeId.equalsIgnoreCase(((CurrencyInfo)currentCompany.getBaseCurrency()).getId().toString()))
{
j = i; } } }
this.bizPromptcurrency.removeAllItems();
this.bizPromptcurrency.addItems(typeValue); //默认值为当前公司的本位币
this.bizPromptcurrency.setSelectedIndex(j); } else {
MsgBox.showError(this, EASResource.getString(resClassName, \ SysUtil.abort(); } }
11. 设置单据分录单元格格式
// 设置单据分录格式
getDetailTable().getColumn(TB_RELABILL).setWidth(100); getDetailTable().getColumn(TB_ORGUNIT).setWidth(180); getDetailTable().getColumn(TB_BIZMAN).setWidth(100);
getDetailTable().getColumn(TB_PAYAMOUNT).setEditor(number_CellEditor); getDetailTable().getColumn(TB_PAYAMOUNT).getStyleAttributes().setNumberFormat(\[=]{#.00}f\
getDetailTable().getColumn(TB_PAYAMOUNT).getStyleAttributes().setHorizontalAlign(HorizontalAlignment.RIGHT);
12.设置单元格可编辑
for (int i = 0; i < kdtEntrys.getRowCount(); i++) {
kdtEntrys.getRow(i).getCell(\ kdtEntrys.getRow(i).getCell(\ }
//如果折扣金额为null则初始化为0
if (kdtEntrys.getRow(i).getCell(\ {
kdtEntrys.getRow(i).getCell(\ }
//汇总分录行金额
BigDecimal amount = new BigDecimal(\
for (int i = 0, n = kdtEntrys.getRowCount(); i < n; i++) {
amount = amount.add(UIRuleUtil.getBigDecimal(UIRuleUtil.getBigDecimalValue (kdtEntrys.getCell(i,TB_PAYAMOUNT).getValue()))); }
this.txtTotalAmounts.setText(null); this.txtTotalAmounts.setEnable(false);