//表头字段监听
this.pkBizDate.addDataChangeListener(new DataChangeListener(){
@Override
public void dataChanged(DataChangeEvent e) {
// TODO Auto-generated method stub
}
});
/*
* 显示全部按钮添加监听事件
* 按钮监听
*/
this.btnShowAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
beforeActionPerformed(e);
try {
btnShowAll_actionPerformed(e);
} catch (Exception exc) {
handUIException(exc);
} finally {
afterActionPerformed(e);
}
}
private void btnShowAll_actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
kdtEntries.getStyleAttributes().setHided(false);
}
});
//分录监听
this.kdtEntrys.addKDTEditListener(new KDTEditListener(){
@Override
public void editCanceled(KDTEditEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void editStarted(KDTEditEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void editStarting(KDTEditEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void editStopped(KDTEditEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void editStopping(KDTEditEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void editValueChanged(KDTEditEvent arg0) {
// TODO Auto-generated method stub
}
});
按钮监听
kDButton1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent paramMouseEvent) {
}});
分录的某个字段改变添加监听
//给转栏分录添加监听事件
this.kdtTransEntry.addKDTEditListener(new KDTEditAdapter(){
public void editStarted(KDTEditEvent e) {
kdtTransEntry_editStarted(e);
}
@Override
public void editStopped(KDTEditEvent e) {
kdtTransEntry_editStoped(e);
}});
}
种蛋上孵单孵化箱,孵化厅列复制监听事件
kdtEggEntry.addKDTEditListener(new KDTEditAdapter(){
public void editStarted(KDTEditEvent e) {
kdteditStarted(e);
}
public void editStopped(KDTEditEvent e) {
if(“incubator”.equalsIgnoreCase(kdtEggEntry.getColumn(e.getColIndex()).getKey())){
if(e.getValue()!=null){
IncubatorInfo info = (IncubatorInfo) e.getValue();
try {
HatchHouseInfo hinfo = HatchHouseFactory.getRemoteInstance().getHatchHouseInfo(new ObjectUuidPK(info.getHatchHouse().getId().toString()));
if(hinfo!=null)
{dtEggEntry.getCell(e.getRowIndex(), “hatchHouse”).setValue(hinfo);}
//列复制
if(e.getRowIndex() == 0){
for(int i=0;i<kdtEggEntry.getRowCount();i++){
kdtEggEntry.getCell(i, “incubator”).setValue(info);
kdtEggEntry.getCell(i, “hatchHouse”).setValue(hinfo);
}
}
} catch (EASBizException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (BOSException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
}
字段绑定action
在XXEditUI.ui界面双击某个控件,进去之后设置方法,enter,保存(打开别的单据这张就自动保存了)
删除监听事件
/**
* 删除监听事件
*/
private void removeAllListener() {
KDTEditListener[] kdtListner = kdtEggEntry.getListeners(KDTEditListener.class);
for(int i = 0; kdtListner.length > 0 && i<kdtListner.length; i++)
kdtEggEntry.removeKDTEditListener(kdtListner[i]);
}
种蛋上孵单分录添加监听事件
//派车信息添加监听事件
kdtEntry.addKDTEditListener(new KDTEditAdapter(){ //备注:此处不一样
public void editStopped(KDTEditEvent e) {
// TODO Auto-generated method stub
//派车信息分录添加监听事件,实时计算"本车只数"合计数
if(“chickenQty”.equalsIgnoreCase(kdtEntry.getColumn(e.getColIndex()).getKey())){
chickenQtyAll(e);
}
}
});
//棚前过磅信息添加监听事件
kdtWeigntEntry.addKDTEditListener(new KDTEditAdapter(){
public void editStopped(KDTEditEvent arg0) {
// TODO Auto-generated method stub
//字段改变添加监听事件
if(kdtWeigntEntry.getCell(arg0.getRowIndex(),"houseWeight").getValue() != null
&& kdtWeigntEntry.getCell(arg0.getRowIndex(),"houseSkinWeight").getValue() != null){
weightEntryChange(arg0);
}
UITools.apendFootRow(kdtWeigntEntry, new String[]{"houseWeight","houseSkinWeight","houseNetWeight"});
}
});
//屠宰信息添加监听事件
kdtButcherEntry.addKDTEditListener(new KDTEditAdapter(){
public void editStopped(KDTEditEvent e) {
// TODO Auto-generated method stub
if("carcassQty".equalsIgnoreCase(kdtButcherEntry.getColumn(e.getColIndex()).getKey())
|| "carcassWeight".equalsIgnoreCase(kdtButcherEntry.getColumn(e.getColIndex()).getKey())
|| "reducedWeight".equalsIgnoreCase(kdtButcherEntry.getColumn(e.getColIndex()).getKey())){
UITools.apendFootRow(kdtButcherEntry, new String[]{"carcassQty","carcassWeight","reducedWeight"});
}
}
});
固定下拉列表添加监听事件
seedSourceType.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e) {
// TODO Auto-generated method stub
if(seedSourceType.getSelectedItem().equals(SeedSourceType.innerCollect)){
prmtpurSupplier.setValue(null);
prmtpurSupplier.setEnabled(false);
}else{
prmtpurSupplier.setEnabled(true);
prmtsourceHatchArea.setRequired(false);
prmtsourceHatchArea.setEnabled(false);
prmtsourceHatchArea.setValue(null);
}
}});
新增行,插入行添加监听事件
kdtEntrys_detailPanel.addAddListener(new DetailPanelBackListener(){
@Override
public void beforeEvent(DetailPanelEvent e) throws Exception {
// TODO Auto-generated method stub
super.beforeEvent(e);
DrugReceiveBillEntryInfo entry=(DrugReceiveBillEntryInfo)e.getObjectValue();
entry.setWarehouse(wareHouseInfo);
}
});
kdtEntrys_detailPanel.addInsertListener(new DetailPanelBackListener(){
@Override
public void beforeEvent(DetailPanelEvent e) throws Exception {
// TODO Auto-generated method stub
super.beforeEvent(e);
DrugReceiveBillEntryInfo entry=(DrugReceiveBillEntryInfo)e.getObjectValue();
entry.setWarehouse(wareHouseInfo);
}
});
凭证的记账类型添加监听事件
this.cbxVoucherType.addItemListener(new ItemListener(){
@Override
public void itemStateChanged(ItemEvent e) {
//如果是第一,前一,后一,最后事件,就不走该方法
if(isFirst && isPre && isNext && isLast){
setBillNum();
}
}
});
kDTextField1监听
kDTextField1.addFocusListener(new FocusListener(){
@Override
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
}
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
BigDecimal longQty = BigDecimal.ZERO;
for(int i = 0,size = tbList.getRowCount();i<size;i++){
if(tbList.getCell(i, "cage").getValue() != null){
longQty = longQty.add(UIRuleUtil.getBigDecimal(tbList.getCell(i, "cage").getValue()));
}
}
//总笼数
BigDecimal allLongQty = BigDecimal.ZERO;
if(UIRuleUtil.isNotNull(kDTextField1.getText())){
allLongQty = UIRuleUtil.getBigDecimal(kDTextField1.getText());
}
//设置剩余笼数
kDTextField2.setText(UIRuleUtil.getString(allLongQty.subtract(longQty)));
}
});