分類:
ERP開發(fā)
2013-04-10 09:55
158人閱讀
收藏
舉報(bào)
本示例在用友NC57環(huán)境下調(diào)試通過
最近在做基于NC的二次開發(fā),這種封閉的系統(tǒng)文檔很少,一個(gè)簡單的例子都不能找到幫助。
本示例的目的是為了讓后來者少走我走過的彎路
- package nc.ui.ic.generaltc;
-
- import nc.ui.pub.ButtonObject;
- import nc.ui.pub.ClientEnvironment;
- import nc.ui.pub.ToftPanel;
- import nc.ui.pub.beans.UIPanel;
- import nc.ui.pub.bill.BillCardPanel;
- import nc.ui.pub.bill.BillEditEvent;
- import nc.ui.pub.bill.BillEditListener;
- import nc.ui.pub.bill.BillItem;
- import nc.ui.pub.bill.BillListPanel;
- import nc.ui.scm.pub.query.SCMQueryConditionDlg;
- import javax.swing.JComboBox;
- import javax.swing.JLabel;
- import javax.swing.JTextField;
- import java.awt.Dimension;
-
-
-
-
-
-
-
-
-
-
- public class ClientUI extends ToftPanel implements BillEditListener {
-
-
- private BillCardPanel cpBill = null;
-
-
- private ClientEnvironment ce = getClientEnvironment();
-
-
- protected ButtonObject bnQuery = new ButtonObject("查詢", "查詢", 1, "查詢");
- protected ButtonObject bnAdd = new ButtonObject("增加", "增加", 2, "增加");
- protected ButtonObject bnModify = new ButtonObject("修改", "修改", 3, "修改");
- protected ButtonObject bnDelete = new ButtonObject("刪除", "刪除", 4, "刪除");
- protected ButtonObject bnSave = new ButtonObject("保存", "保存", 5, "保存");
- protected ButtonObject bnCancel = new ButtonObject("取消", "取消", 6, "取消");
- protected ButtonObject bnPrint = new ButtonObject("打印", "打印", 7, "打印");
- protected ButtonObject bnAudit = new ButtonObject("審核", "審核", 9, "審核");
- protected ButtonObject bnUnAudit = new ButtonObject("棄審", "棄審", 10, "棄審");
- protected ButtonObject bnClose = new ButtonObject("關(guān)閉", "關(guān)閉", 11, "關(guān)閉");
- protected ButtonObject bnOpen = new ButtonObject("打開", "打開", 12, "打開");
-
- protected ButtonObject[] bgMain = { bnQuery, bnAdd, bnModify, bnDelete,
- bnSave, bnCancel, bnPrint, bnAudit, bnUnAudit, bnClose, bnOpen };
-
-
- private int iStatus = 0;
- private int INIT = 0;
- private int NEW = 1;
- private int UPDATED = 2;
- private int DELETED = 3;
- private int SAVED = 4;
-
- private nc.vo.scm.pub.session.ClientLink m_cl=null;
- protected UIPanel conditionpanel = null;
-
- public ClientUI() {
- super();
- initialize();
- }
-
-
-
-
- public void bodyRowChange(BillEditEvent arg0) {
-
-
- }
-
- public void afterEdit(BillEditEvent arg0) {
- }
-
-
-
-
-
-
-
-
-
-
- private void initialize() {
- try {
- setName("TcUI");
- m_cl = new nc.vo.scm.pub.session.ClientLink(ClientEnvironment.getInstance());
-
- iStatus = INIT;
- setBnStatus(iStatus);
-
-
- setButtons(bgMain);
- add(getBillCardPanel());
-
- } catch (Exception e) {
- nc.vo.scm.pub.SCMEnv.out(e.getMessage());
- JLabel msg = new JLabel(e.getMessage());
- msg.setHorizontalAlignment(JLabel.CENTER);
- add(msg);
- }
- }
-
-
-
-
-
-
-
-
-
-
- private BillCardPanel getBillCardPanel() {
- if (cpBill == null) {
- try {
- cpBill = new BillCardPanel();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- cpBill.loadTemplet("40081001", null, ce.getUser().getPrimaryKey(), ce.getCorporation().getPk_corp());
-
- cpBill.setBodyMenuShow(false);
-
- cpBill.addEditListener(this);
-
- } catch (java.lang.Throwable ivjExc) {
- }
- }
- return cpBill;
- }
-
-
-
-
-
-
-
-
-
- protected UIPanel getConditionPanel() {
- if (conditionpanel == null) {
- conditionpanel = new UIPanel();
- conditionpanel.setName("UIPanel");
- conditionpanel.setLayout(new java.awt.GridLayout(2, 6, 0, 1));
- conditionpanel.setMaximumSize(new Dimension(550, 40));
- conditionpanel.setPreferredSize(new Dimension(550, 40));
- conditionpanel.setMinimumSize(new Dimension(550, 1));
- }
- return conditionpanel;
- }
-
- @Override
- public String getTitle() {
-
- return null;
- }
-
- @Override
- public void onButtonClicked(ButtonObject arg0) {
-
-
- }
-
-
-
-
-
-
-
-
-
-
-
- public void setBnStatus(int status) {
-
- if (status == INIT || status == DELETED || status == SAVED) {
- bnQuery.setEnabled(true);
- bnAdd.setEnabled(true);
- bnModify.setEnabled(true);
- bnSave.setEnabled(false);
- bnCancel.setEnabled(false);
- bnDelete.setEnabled(true);
-
- }
-
- else if (status == NEW || status == UPDATED) {
- bnQuery.setEnabled(false);
- bnAdd.setEnabled(false);
- bnSave.setEnabled(true);
- bnCancel.setEnabled(true);
- bnDelete.setEnabled(false);
- bnModify.setEnabled(false);
- }
-
- updateButtons();
- }
- }
圖1:單據(jù)類型管理界面
|