金蝶bos 自定义UI界面添加复选框控件,并且做业务处理

 /**

     * 显示工程类型

     * @author daihao

     * @throws BOSException

     */

    public void showType() throws BOSException{

    kDTable1.checkParsed();

    ShipRepairedTypeCollection typeCon = ShipRepairedTypeFactory.getRemoteInstance().getShipRepairedTypeCollection();

    if (typeCon != null && typeCon.size() != 0) {

     for (int i = 0; i < typeCon.size(); i++) {

     ShipRepairedTypeInfo info = typeCon.get(i);

     IRow row = kDTable1.addRow();

     row.getCell("id").setValue(info.getId().toString());

     row.getCell("project").setValue(info.getName());

     //要注意一行,给复选框默认设值

     row.getCell("CheckBox").setValue(false);

}

}

}

 

//复选框选中时触发的方法

 protected void checkBox_actionPerformed(ActionEvent e) throws Exception {

if(kDTable1.getRowCount()<=0)

{

return ;

}

boolean check = false;

KDCheckBox checkBox = (KDCheckBox) e.getSource();

if(checkBox.isSelected())

{

 check = true;

}

for (int i = 0; i < kDTable1.getRowCount(); i++) {

kDTable1.getCell(i, "CheckBox").setValue(check);

}

}

    

    //添加复选框

    @Override

    public void initLayout() {

    super.initLayout();

     kDTable1.checkParsed();

     IColumn col = null;

     col = kDTable1.addColumn(0);

    col.setKey("CheckBox");

    col.setWidth(30);

    col.getStyleAttributes().setLocked(false);

    IRow row = kDTable1.getHeadRow(0);

 //添加复选框 and 监听事件  应收审核

        final KDCheckBox fidCheck = new KDCheckBox();

        fidCheck.setName("fidCheck_CheckBox");

        fidCheck.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {

            try {

                checkBox_actionPerformed(e);

 } catch (Exception e1) {

 e1.printStackTrace();

 }

            }

        });

        KDTDefaultCellEditor fidEditor = new KDTDefaultCellEditor(fidCheck);

        row.getCell("CheckBox").setEditor(fidEditor);

    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值