/**
* 显示工程类型
* @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);
}