1.判断事件前后的值是否发生了改变:
protected boolean checkPrmtIsChange(DataChangeEvent arg0){ if(arg0.getNewValue() ==null&&arg0.getOldValue()!=null){ return true; } if(arg0.getNewValue() !=null&&arg0.getOldValue()==null){ return true; } if(arg0.getNewValue() !=null&&arg0.getOldValue()!=null){ IObjectValue newv = (IObjectValue) arg0.getNewValue(); IObjectValue oldv =(IObjectValue) arg0.getOldValue(); return !newv.get("id").equals(oldv.get("id")); } return false; }
2.常用事件监听器
java.awt.event.ItemListener for KDComboBox
com.kingdee.bos.ctrl.swing.event.SelectorListener for F7 //f7提示框弹出前
com.kingdee.bos.ctrl.swing.event.DataChangeListener for F7 //f7的值改变后
new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { try { if(e.getStateChange()==ItemEvent.DESELECTED ){ //remove listener .....//业务处理 //add listener } } catch (Exception exc) { handUIException(exc); } finally { } } };