1. 程式人生 > >NC高階UI工廠筆記

NC高階UI工廠筆記

1.控制按鈕是否可見
  @Override
  protected boolean isActionEnable() {
    return this.model.getUiState() == UIState.NOT_EDIT;
  }
2.顯示選擇模組AceOrgChangedHandler
 this.billfrom.getBillCardPanel().setBodyMultiSelect(true);
//判斷是否選中
 if(this.getBillform().getBillCardPanel().getBillModel().getRowState(i) ==BillModel.SELECTED);


3.設定模板的狀態
 model.setUiState(UIState.EDIT);


4.得到自動產生行號的程式碼
//此方法表體新增一行
this.getBillform().getBillCardPanel().getBodyPanel().addLine();
//得到新增的行號//pnlCard是BillCardPanel, sRowNOKey為行號欄位
String newrownumber=BillRowNoUtils.getAddLineRowNo(this.getBillform().getBillCardPanel(), ImaterialsBVO.NNUMBER);
//以下為BillRowNoUtils.getAddLineRowNo原始碼
   public static String getAddLineRowNo(BillCardPanel pnlCard, String sRowNOKey)
    {
        int lengthOfRow = pnlCard.getBillTable().getRowCount();
        if(lengthOfRow == 1)
            return "10";
        String rowno = (String)pnlCard.getBillModel().getValueAt(lengthOfRow - 2, sRowNOKey);
        if(rowno != null)
        {
            int irowno = Integer.parseInt(rowno);
            return String.valueOf(irowno += 10);
        } else
        {
            return "";
        }
    }


5.顯示提示資訊。
ShowStatusBarMsgUtil.showStatusBarMsg("補錄轉介紹", this.getModel().getContext());
6.彈框提示資訊。
 MessageDialog.showHintDlg(null, "錯誤", "商品項號不是唯一!");


7.獲取單據VO資料
// 獲取表頭hvo
ImaterialsHVO imhvo = (ImaterialsHVO) this.getBillform().getBillCardPanel().getBillData().getHeaderValueVO(ImaterialsHVO.class.getName());
//獲取表體資料
ImaterialsBVO[] imbvos=(ImaterialsBVO[]) this.getBillform().getBillCardPanel().getBillModel().getBodyValueVOs(ImaterialsBVO.class.getName());
8.得到某個欄位值
//得到表頭某個欄位的數值
this.getBillform().getBillCardPanel().getBillData().getHeadItem("isselect").getValue(); 
或者
this.getBillform().getBillCardPanel().getHeadItem("isselect").getValue();
//得到表體某個欄位的數值
this.getBillform().getBillCardPanel().getBillModel().getValueAt(i, "isselect");
9.列表自動帶出(編輯完帶出在編輯公式,列表上帶出在顯示公式)
materialname->getcolvalue(bd_material,name ,code , material) ;


10.編輯報錯提示
//停止編輯
this.billForm.getBillCardPanel().stopEditing();
//清除報錯
this.billForm.getBillCardPanel().getBillModel().clearCellShowWarning();
//新建
ChangeBillScorllPane changeScorll=null;
changeScorll=new ChangeBillScorllPane();
int scorll_Y=i*this.billForm.getBillCardPanel().getBillTable().getRowHeight();
changeScorll.changeBillScorllPane(getBillForm(), i, 1, 0, scorll_Y);