BOS開發(fā)EditUI實戰(zhàn)_第1頁
BOS開發(fā)EditUI實戰(zhàn)_第2頁
BOS開發(fā)EditUI實戰(zhàn)_第3頁
BOS開發(fā)EditUI實戰(zhàn)_第4頁
BOS開發(fā)EditUI實戰(zhàn)_第5頁
已閱讀5頁,還剩7頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、EditUI刷新單據在EditUI類里面刷新單據數據:/* * 重新刷新數據 * */ public void refreshSelf()  try  ObjectUuidPK pk = new ObjectUuidPK(editData.getId(); IObjectValue objValue = getValue(pk); setDataObject(objValue); loadFields(); getUIContext().put("ID", pk); 

2、;getUIContext().put("InitDataObject", objValue);  catch (Exception e)  handUIException(e);  eas bos editUI 刷新方法 幫助類/* * 刷新editUI 使用反射技術調用收保護方法 * param ui 單據editUi的對象 * param id 單據的id eidtData.getId() */public static void refreshEditUI(EditUI ui,BOSUuid id)try ObjectUuid

3、PK pk = new ObjectUuidPK(id);/使用反射技術訪問受保護的方法 /* * 使用反射技術獲取父類的方法 * 1、先獲取自己的字節(jié)碼對象: Class clazz=ui.getClass(); * 2、獲取父類的字節(jié)碼對象: =clazz.getSuperclass(); */Method m=null;Class clazz=ui.getClass();while(true)try m=clazz.getDeclaredMethod("getValue", new ClassIObjectPK.class); break; catch (NoSuch

4、MethodException e) clazz=clazz.getSuperclass();m.setAccessible(true);IObjectValue objValue=(IObjectValue) m.invoke(ui, new Objectpk);ui.setDataObject(objValue);ui.loadFields();ui.getUIContext().put("ID", pk);ui.getUIContext().put("InitDataObject", objValue); catch (Exception e) u

5、i.handUIException(e); 分錄刪除按鈕刪除多條記錄的方法private void replaceKdtRangeRemoveMethod() throws Exception DetailPanel detailPanel = TrainClientUtil.getTableDetailPanel(kdtEntrys);if (detailPanel != null) KDWorkButton removeButton = detailPanel.getRemoveLinesButton();ActionListener listeners = removeButt

6、on.getActionListeners();if (listeners != null && listeners.length > 0) for (int j = 0; j < listeners.length; j+)removeButton.removeActionListener(listenersj);removeButton.addActionListener(new ActionListener() public void actionPerformed(ActionEvent arg0) if (kdtEntrys = null)return;if

7、 (kdtEntrys.getSelectManager().size() = 0| isTableColumnSelected(kdtEntrys)return;int selectRowsIndex = TrainHelper.getSelectedRows(kdtEntrys); Arrays.sort(selectRowsIndex); for(int i = selectRowsIndex.length - 1; i >= 0; i-) TrainUtils.removeRow(kdtEntrys, selectRowsIndexi); if (selectRowsIndex.

8、length > 0) int selectedColumnIndexs = TrainHelper.getSelectedColumns(kdtEntrys);Arrays.sort(selectRowsIndex);if (kdtEntrys.getRowCount() > 0) Arrays.sort(selectedColumnIndexs);int columnIndex = 0;if (selectedColumnIndexs.length > 0)columnIndex = selectedColumnIndexs0;kdtEntrys.getSelectMan

9、ager().select(selectRowsIndex0, columnIndex););通過BOSType找EditUI/* 112 */     IMetaDataLoader loader = MetaDataLoaderFactory.getRemoteMetaDataLoader();/* 113 */     EntityObjectInfo tempObj = loader.getEntity(new BOSObjectType(BOSTypeString);如何在代碼中對由框架自動生成的單據分錄

10、三個小按鈕設置狀態(tài)?對于由框架繼承新增的編輯UI(EditUI),在運行期會自動增加三個按鈕:新增行、插入行、刪除行,如下圖:對于上圖的業(yè)務處理,只有在當“是否總計項”為選中時,三個按鈕才應該是可用的,但這三個按鈕是運行期程序產生的,所以對其處理就得在其相應的容器中來找并設置,具體代碼如下:  KDPanel controlPanel = (KDPanel)this.kdtSumExpress.getParent().getParent().getComponent(0);  for(int i = 0; i < controlPanel.getC

11、omponentCount(); i+)   controlPanel.getComponent(i).setEnabled(chkisSumItem.isSelected();  其中kdtSumExpress為上圖中的表格。再提及一點,controlPanel的parent為。單據多分錄中如何對某個頁簽中分錄行數據增加做前處理和后處理?對于單據單分錄,如果我們想對某行數據在增加時或刪除時做處理,直接用框架提供的事件即可,但對于多分錄目前框架無法直接處理,需要我們自己在代碼中來處理,具體例子如下:/* * output packag

12、e name */package jectmgr.client;./* * output class name */public class PrjEstimateEditUI extends AbstractPrjEstimateEditUI implements IDetailPanelListener  private static final Logger logger = CoreUIObject.getLogger(PrjEstimateEditUI.class); 

13、;. /*  * output class constructor  */ public PrjEstimateEditUI() throws Exception   super();  protected void initListener()   super.initListener();  Container pnlPlaceCirc = kdtPlaceCircs.getParent().getParent();  if (pnlPlaceCirc

14、 instanceof DetailPanel)    DetailPanel detailPanel = (DetailPanel) pnlPlaceCirc;   detailPanel.addAddListener(this);   detailPanel.addInsertListener(this);    cmbxMakeMethod.addItemListener(new ItemListener()    public

15、void itemStateChanged(ItemEvent e)     if (e.getStateChange() = ItemEvent.SELECTED)      boolean enabled = e.getItem() = RentCalcMethodEnum.pressAndEngineFixedRent;     txtNomMonthRate.setEnabled(enabled);    &

16、#160;    );  public void beforeEvent(DetailPanelEvent e) throws Exception   PrjEstimatePlaceCircInfo prjEstimatePlaceCirc = (PrjEstimatePlaceCircInfo) e.getObjectValue();  prjEstimatePlaceCirc.setCurrency(currency);  prjEstimatePlaceCirc.se

17、tCreator(SysContext.getSysContext().getCurrentUserInfo().getPerson();  prjEstimatePlaceCirc.setCreateTime(new Date();  public void afterEvent(DetailPanelEvent e) throws Exception   / TODO 自動生成方法存根 如何給單據分錄上增加核算項目的F7(代碼示例)。用BIM在單據上先增加核算項目的列,注意如果BIM中選擇不到核算項目的業(yè)務單元,還需要先

18、手工在BIM中先引入一個,然后發(fā)布,在實現類中增加如下代碼(須根據自己的實際修改控件名和自定義核算項目類別編碼): public static void initHZPrmt(KDTable kdtEntry,CoreUIObject editUI) throws BOSException   final KDBizPromptBox kdtEntry_PromptBox = new KDBizPromptBox();  kdtEntry.checkParsed();  kdtEntry_PromptBox.setVisib

19、le(true);  kdtEntry_PromptBox.setEditable(true);  setHZ(kdtEntry_PromptBox, editUI);  kdtEntry_PromptBox.setDisplayFormat("$number$");  kdtEntry_PromptBox.setEditFormat("$number$");  kdtEntry_PromptBox.setCommitFormat("$numbe

20、r$");  KDTDefaultCellEditor kdtEntry_CellEditor = new KDTDefaultCellEditor(    kdtEntry_PromptBox);  kdtEntry.getColumn("cargo").setEditor(kdtEntry_CellEditor);  ObjectValueRender kdtEntry_OVR = new ObjectValueRender();  kdtE

21、ntry_OVR.setFormat(new BizDataFormat("$name$");  kdtEntry.getColumn("cargo").setRenderer(kdtEntry_OVR);  public static void setHZ(KDBizPromptBox bizPromptBox, CoreUIObject ui)throws BOSException   IGeneralAsstActTypeGroup iGeneralAsstGroup = GeneralA

22、sstActTypeGroupFactory    .getRemoteInstance();  GeneralAsstActTypeGroupCollection gc = iGeneralAsstGroup    .getGeneralAsstActTypeGroupCollection("select * where number='01'");  if (gc.size() > 0)    GLf

23、7Utils.assignSelector(bizPromptBox, gc.get(0), "", true, false,null, ui, true);   bizPromptBox.setQueryInfo("com.kingdee.eas.basedata.master.auxacct.app.F7GeneralAsstActTypeQuery");   如何讓表頭的字段在單據提交后還能進行修改?  一般情況下,單據提交后,是不允許修改的。但是也存在一些特殊的情況,需要在工作

24、流中,對單據中的某些字段進行修改,此時,一般是通過在自定義的擴展類中,重寫onLoad()方法,然后在方法中調用控件的setEnabled()、setEditable()、setReadOnly()方法(這三個方法不一定需要全部調用,根據具體情況而定),如下代碼:Overridepublic void onLoad() throws Exception super.onLoad();/單據未生成憑證之前,"收款類型"為可編輯、“往來戶”也可編輯boolean hasFV = this.editD

25、ata.isFiVouchered();if(!hasFV)/收款類型f7RecBillType.setEnabled(true);f7RecBillType.setEditable(true);f7RecBillType.setReadOnly(false);/往來戶prmtPayer.setEnabled(true);prmtPayer.setEditable(true);prmtPayer.setReadOnly(false);EAS 分錄表頭合并EAS 開發(fā)中,有時需要對分錄或序時簿界面表的表頭做合并處理,方法如下:Java代碼  kdtEntrys.addHead

26、Row(0);  kdtEntrys.getHeadRow(0).getCell(1).setValue("物料編碼");  kdtEntrys.getHeadRow(0).getCell(2).setValue("詳細信息和數量");  kdtEntrys.getHeadRow(0).getCell(3).setValue("詳細信息和數量");  kdtEntrys.getHeadMergeManager().mergeBlock(0, 2,

27、 0, 3);  關于bos 分錄添加附件的相關知識點今天研究eas標準產品,發(fā)現人力資源模塊的培訓課程TrainCoursEditUI 和采購合同PurContractEdituI發(fā)現兩個的分錄一個可以添加分錄、一個沒有添加分錄的選項。經過仔細研究后發(fā)現TrainCoursEditUI是直接基礎EditUI的,而對于PurContractEdituI是有繼承coreBillBase的。所以對于這個差異,問題應該是在coreBillBase的EditUI的代碼方法。如果需要禁止分錄添加附件的方法,可以覆蓋方法showSubAttacheMent 其代碼是

28、:Override    public KDMenuItem getAttachMenuItem(KDTable table)         return null;        Override    protected void showSubAttacheMent(AttachmentUIContextInfo info)         

29、0;   給表體(分錄、條目)設置默認值(全)一,如果需要設置的默認值是個固定的值,解決方法:打開BIM(業(yè)務建模視圖)->打開業(yè)務單元->在大綱視圖(如果看不到這個視圖可以:窗口->顯示視圖->其他->常規(guī)->大綱)中點開分錄,選擇要設置默認值的字段右擊屬性,在“默認值”中屬性中設置值      二,如果需要在代碼里面動態(tài)設置默認值,解決方法:1. 添加條目按鈕(分錄面板的三個按鈕之一):/點擊添加分錄按鈕后 設置默認值         

30、   kdtEntrys_detailPanel.addAddListener(new com.kingdee.eas.framework.client.multiDetail.IDetailPanelListener()                         public void beforeEvent(com.kingdee.eas.framework.client.multiDetail.DetailPanelEvent event) throws

31、 Exception                                 IObjectValue vo = event.getObjectValue();                                /設置默認值    

32、0;                           vo.put("matid", "MT0001");                                vo.put("matmc","變形金剛"); 

33、;                                               public void afterEvent(com.kingdee.eas.framework.client.multiDetail.DetailPanelEvent event) throws Exception        

34、                                );/添加條目按鈕 的點擊事件            this.kdtEntrys_detailPanel.getAddNewLineButton().addActionListener(new ActionListener()             &

35、#160;           public void actionPerformed(ActionEvent e)                                 / TODO Auto-generated method stub                    &

36、#160;           MsgBox.showInfo("添加分錄按鈕的點擊事件!");                                                );2. 插入條目按鈕(分錄面板的三個按鈕之一):/點擊插入分錄按鈕后 設置默認值

37、60;               kdtEntrys_detailPanel.addInsertListener(new com.kingdee.eas.framework.client.multiDetail.IDetailPanelListener()                         public void beforeEvent(com.kingdee.eas.framework.c

38、lient.multiDetail.DetailPanelEvent event) throws Exception                                 IObjectValue vo = event.getObjectValue();                        

39、0;       /設置默認值                                vo.put("matid", "MT0002");                               

40、vo.put("matmc","生鐵");                                                public void afterEvent(com.kingdee.eas.framework.client.multiDetail.DetailPanelEvent event) throws Exception             

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論