分类:
ERP开发
2013-04-10 09:55
158人阅读
收藏
举报
本示例在用友NC57环境下调试通过
最近在做基于NC的二次开发,这种封闭的系统文档很少,一个简单的例子都不能找到帮助。
本示例的目的是为了让后来者少走我走过的弯路
- 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("关闭", "关闭", 11, "关闭");
- 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:单据类型管理界面
|