nc 自定义dialog

来源:互联网 发布:ansys仿真软件价格 编辑:程序博客网 时间:2024/05/16 23:33
package nc.ui.so.m30.billui.action.link;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import nc.ui.pub.beans.UIButton;
import nc.ui.pub.beans.UIDialog;
import nc.ui.pub.beans.UIPanel;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillData;
import nc.ui.pub.bill.BillItem;

public class GPSMessageDialog extends UIDialog{
    
    public static void main(String[] args) {
        BillItem[]    bodyItems1 = new BillItem[11];
        for(int i = 0;i<bodyItems1.length;i++){
            bodyItems1[i] = new BillItem();
            bodyItems1[i].setName("测试"+i);
            bodyItems1[i].setKey("test"+i);
            bodyItems1[i].setShow(true);
            bodyItems1[i].setRefType("");
            bodyItems1[i].setEdit(false);
            bodyItems1[i].setLoadFormula(null);
            bodyItems1[i].setWidth(159);
        }
        GPSMessageDialog td=new GPSMessageDialog();
        td.setBodyItems(bodyItems1);
        td.showModal();
    }

    public GPSMessageDialog(){
        this.setName("出库车辆GPS信息");
        this.setTitle("出库车辆GPS信息");
        this.setSize(500, 500);
        this.setContentPane(getPanel());
    }
    private BillCardPanel cardPanel = null;
    private BillItem[] bodyItems = null;
    private UIPanel panel = null;
    private UIPanel btnPanel=null;
    public BillCardPanel getCardPanel() {
        if(cardPanel == null){
            cardPanel = new BillCardPanel();
            cardPanel.setName("cardPanel");
            BillData data = new BillData();
            data.setBodyItems(getBodyItems());
            cardPanel.setBillData(data);
            cardPanel.setBodyMenuShow(false);
            cardPanel.setEnabled(false);
            cardPanel.addLine();
        }
        return cardPanel;
    }
    public void setCardPanel(BillCardPanel cardPanel) {
        this.cardPanel = cardPanel;
    }
    public BillItem[] getBodyItems() {
        if(bodyItems == null){
            bodyItems = new BillItem[11];
            for(int i = 0;i<bodyItems.length;i++){
                bodyItems[i] = new BillItem();
                bodyItems[i].setName("测试"+(i+1));
                bodyItems[i].setKey("test"+i);
                bodyItems[i].setShow(true);
                bodyItems[i].setRefType("");
                bodyItems[i].setEdit(false);
                bodyItems[i].setLoadFormula(null);
                bodyItems[i].setWidth(159);
            }
        }
        return bodyItems;
    }
    public void setBodyItems(BillItem[] bodyItems) {
        this.bodyItems = bodyItems;
    }
    public UIPanel getPanel() {
        if(panel == null){
            panel = new UIPanel();
            panel.setName("panel");
            panel.setLayout(new BorderLayout());
            panel.add(getCardPanel(),BorderLayout.CENTER);    
            panel.add(getBtnPanel(),BorderLayout.SOUTH);
        }
        return panel;
    }
    public void setPanel(UIPanel panel) {
        this.panel = panel;
    }

    public UIPanel getBtnPanel() {
        if(btnPanel == null){
            btnPanel = new UIPanel();
            btnPanel.setName("btnPanel");
            UIButton btn=new UIButton("确定");
            btn.addActionListener(new ActionListener() {
                
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeOK();
                }
            });
            FlowLayout fl=new FlowLayout(FlowLayout.RIGHT);
            btnPanel.setLayout(fl);
            btnPanel.add(btn);
        }
        return btnPanel;
    }

    public void setBtnPanel(UIPanel btnPanel) {
        this.btnPanel = btnPanel;
    }
    
}

0 0
原创粉丝点击