//删除按钮事件
private void removeButtonListener(com.kingdee.bos.ctrl.extindControls.KDBizPrimptBox promptBox){
Conponent[] com=promptBox.getComponents();
for(int i=0,n=com.length;i<n;i++){
if(com[i] instanceof javax.swingJButton){
ActionListener[] actions((javax.swing.JButton)(com[i]).getActionListeners();
for(int j=0,m=actions.length;j<m;j++){
if(actions[j] instanceof ActionListener){
((javax.swing.JButton)com[i]).removeActionListener(actions[j]);
}
}
}
}
}
//获取f7右边的小按钮
private javax.swing.JBtton getJButtonbyF7(com.kingdee.bos.ctrl.eatenControls.KDBizPromptBox promptBox){
Conponent[] com=promptBox.getComponents();
for(int i=0,n=com.length;i<n;i++){
if(com[i] instanceof javax.swingJButton){
return (javax.swing.JButton)com[i];
}
}
throw NullPointerException("找不到");
}
//给F7小按钮添加事件
getJButtonbyF7(promptButton).addActionListener(new ActionListener(){
public void actionPerfouned(){
try{
if(editData.getId()==null){
if(OprtState.ADDNEW.equals(getOprtState())){
editData.setId(BOSUuid.create(editData.getBOSType()));
}else{
return;
}
}
actionAttachment_actionPerforned(e);
StringBuffer attName=getAttachmentNames(editData.getId().toString());
}catch(Exception e){
//获取附件名称发生异常
}
}
});
private StringBuffer getAttachmentNames(String boid) throws Exception{
if(boid==null||boid.trim().equals(""){
throw new NullPointerException("boid不能为空");
}
StringBuffer attNames=new StringBuffer();
SelectorItemCollection sic=new SelectorItemCollection();
sic.add(new SelectorItemInfo("id"));
sic.add(new SelectorItemInfo("attachment.name"));
sic.add(new SelectorItemInfo("attachment.id"));
EntityViewInfo view=new EntityViewInfo();
FilterInfo filter=new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("boId",boid));
view.setFilter(filter);
BoAttchAssoCollection boAttchColl=BoAttchAssoFactory.getRemoteInstance().getBottchAssoCollection(view);
if(boAttchColl!=null&&boAttchColl.size>0){
for(int i=,n=boAttchColl.size();i<n;i++){
if(i!=0){
attNames.append(",");
}
attNames.append(boAttchColl.get(i).getAttAchment().getName());
}
}
return attNames;
}