/**
* 重写附件action
* add by dhy at 20131217
*/
@Override
public void actionAttachment_actionPerformed(ActionEvent arg0) throws Exception
{
super.actionAttachment_actionPerformed(arg0);
fillAttachmentList();
}
/**
* 查看附件
* add by dhy at 20131217
*/
@Override
public void actionViewAttachment_actionPerformed(ActionEvent e) throws Exception
{
super.actionViewAttachment_actionPerformed(e);
String attachId = null;
if(cmbAttachment.getSelectedItem() != null && (cmbAttachment.getSelectedItem() instanceof AttachmentInfo))
{
attachId = ((AttachmentInfo)cmbAttachment.getSelectedItem()).getId().toString();
AttachmentClientManager acm = AttachmentManagerFactory.getClientManager();
acm.viewAttachment(attachId);
}
}
/**
* 添加附件到下拉框
* add by dhy at 20131217
*/
public void fillAttachmentList()
{
cmbAttachment.removeAllItems();
String boId = null;
if(editData.getId() == null)
return;
boId = editData.getId().toString();
boolean isHasAttachment = false;
if(boId != null)
{
SelectorItemCollection sic = new SelectorItemCollection();
sic.add(new SelectorItemInfo("id"));
sic.add(new SelectorItemInfo("attachment.id"));
sic.add(new SelectorItemInfo("attachment.name"));
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("boID", boId));
EntityViewInfo evi = new EntityViewInfo();
evi.setFilter(filter);
evi.setSelector(sic);
BoAttchAssoCollection cols = null;
try
{
cols = BoAttchAssoFactory.getRemoteInstance().getBoAttchAssoCollection(evi);
}
catch(BOSException e)
{
e.printStackTrace();
}
if(cols != null && cols.size() > 0)
{
AttachmentInfo attachment;
for(Iterator it = cols.iterator(); it.hasNext(); cmbAttachment.addItem(attachment))
attachment = ((BoAttchAssoInfo)it.next()).getAttachment();
isHasAttachment = true;
} else
{
isHasAttachment = false;
}
}
btnViewAttachment.setEnabled(isHasAttachment);
}