金蝶BOS开发中Edit编辑界面和List叙事薄界面需要写的代码

来源:互联网 发布:ubuntu 记事本软件 编辑:程序博客网 时间:2024/05/02 00:44

EditUI中的代码

[java] view plaincopy
  1. public class MyBillEditUI extends AbstractMyBillEditUI  
  2. {  
  3.     public MyBillEditUI() throws Exception  
  4.     {  
  5.         super();  
  6.     }  
  7.     //把数据对象加载到当前UI界面相应的控件  
  8.     public void loadFields()  
  9.     {  
  10.         super.loadFields();  
  11.     }  
  12.     //同步当前UI业务数据到数据对象  
  13.     public void storeFields()  
  14.     {  
  15.         super.storeFields();  
  16.           
  17.     }  
  18.     //进行某些控件或数据设置  
  19.     public void onLoad() throws Exception {  
  20.         IColumn column = this.kdtEntries.getColumn(1);  
  21.         column.getStyleAttributes().setLocked(true);  
  22.      super.onLoad();  
  23.         this.actionSubmit.addService( new ForewarnService() ) ;  
  24.         this.actionSubmit.addService( new WorkFlowService() ) ;  
  25.         this.actionSubmit.setBindWorkFlow( true ) ;  
  26.    }  
  27. //创建新的数据对象,并设置初始值  
  28. protected IObjectValue createNewData() {  
  29.     MyBillInfo result = new MyBillInfo();  
  30.     result.set*(value);  
  31.     result.getEntries();  
  32.     return result;  
  33. }   
  34. //创建分录数据对象,并设置初始值  
  35. protected IObjectValue createNewDetailData(KDTable table) {  
  36.      return new MyBillEntryInfo();  
  37. }  
  38. //获取分录table  
  39. protected KDTable getDetailTable() {  
  40.     return kdtEntries;  
  41. }  
  42. //获取业务接口  
  43. protected ICoreBase getBizInterface() throws Exception {  
  44.    return MyBillFactory.getRemoteInstance();  
  45. }  
  46. //检验数据的合法性,并抛出异常  
  47. protected void verifyInput(ActionEvent e) throws Exception {  
  48.     if (this.getDataObject()==null){ throw new Exception();}  
  49. }  
  50. //设置某些字段==null    
  51. protected void setFieldsNull(AbstractObjectValue newData) {  
  52.        newData.set**(null);  
  53. }    
  54. //保存数据  
  55. public IObjectPK runSave() throws Exception {  
  56.    //设置editData的某些值  
  57.    super.runSave();  
  58. }  
  59. //同runSave  
  60. public IObjectPK runSubmit() throws Exception  
  61.     {  
  62.    …  
  63.    super.runSubmit();  
  64. }  
  65. //修改后是提交或暂存 true为暂存 false为提交  
  66.  protected boolean isModifySave()  
  67.  {  
  68.       return false;  
  69.  }  

ListUI中的代码

[html] view plaincopy
  1.    public class MyBillListUI extends AbstractMyBillListUI  
  2. {  
  3.     public MyBillListUI() throws Exception{  
  4.         super();  
  5.         this.setUITitle("单据测试");  
  6.     }  
  7.      
  8.  /**  
  9.   *把数据对象加载到当前UI界面相应的控件,针对序事薄没有用处        
  10. */  
  11.     public void loadFields(){  
  12.         super.loadFields();  
  13. }  
  14. /**  
  15.     *同步当前UI业务数据到数据对象,针对序事薄没有用处      
  16. */  
  17.      public void storeFields(){  
  18.         super.storeFields();  
  19.      }  
  20. /**  
  21.      *提供序事薄需要打开的编辑界面UI的类名  
  22. */  
  23.     protected String getEditUIName() {  
  24.            return MyBillEditUI.class.getName();  
  25.      }  
  26. /**  
  27.      *返回当前业务的远程或本地业务接口  
  28. */  
  29.      protected ICoreBase getBizInterface() throws Exception {  
  30.            return MyBillFactory.getRemoteInstance();  
  31.      }  
  32. /**  
  33.      *由开发人员提供当前table的主键字  
  34. */  
  35. protected String getKeyFieldName() {  
  36.        return "id";  
  37. }  
  38. /**  
  39.      *如果业务需要融合某些列,需要提供这些列的key(即融合单据头)  
  40. */  
  41.  public String[] getMergeColumnKeys(){  
  42.         String[] mergeColumn = new String[2];  
  43.         mergeColumn[0] = new String("id");  
  44.       mergeColumn[1] = new String("number");  
  45.       return mergeColumn;  
  46.  }  
  47. /**  
  48.      *要在状态栏显示当前的单据条数,需要业务返回计算单据条数的字段  
  49. */  
  50. protected String[] getCountQueryFields(){  
  51.         return new String[] {“id“};  
  52.      }  
  53. /**  
  54.      *可以指定当前窗口的打开模式,默认情况下不用指定  
  55.      * UIFactoryName.MODEL,UIFactoryName.NEWWIN,UIFactoryName.NEWTAB  
  56. */  
  57.  protected String getEditUIModal(){  
  58.          return UIFactoryName.MODEL;  
  59.      }  
  60.  /**  
  61.      *是否需要进行表格排序,业务可以覆盖返回false,屏蔽点击单据头排序动作  
  62. */  
  63.   protected boolean isOrderForClickTableHead(){  
  64.          return true;  
  65.      }  
  66. /**  
  67.      *返回不需要排序的表列数组,默认返回null  
  68. */  
  69. protected String[] getNotOrderColumns(){  
  70.         return null;  
  71.       }  
  72. /**  
  73.      *可以在父类的onload后做一些自己的事情  
  74. */  
  75. public void onLoad() throws Exception {  
  76.         super.onLoad();  
  77.       //如设置滚动条隐藏  
  78.      //this.getMainTable().setScrollStateVertical(KDTStyleConstants.SCROLL_STATE_HIDE);  
  79.      }  
  80. /**  
  81.      *允许构造传递给EditUI的UIContext,继承类实现  
  82. */  
  83.   
  84.    
  85.  protected void prepareUIContext(UIContext uiContext, ActionEvent e){  
  86.       super.prepareUIContext(uiContext,e);  
  87.       //传递自己的上下文参数或其他值  
  88.       uiContext.put(key,value);  
  89. }  
  90. /**  
  91.    *关闭窗口  
  92. */  
  93. public boolean destroyWindow() {  
  94.      super.destoryWindow();  
  95.      //做自己的一下销毁动作  
  96.    }  
  97. }  

EditeUI 类是客户端编辑界面对应的类


ListUI 类是客户端叙事簿界面对应的类