ComboBox Listener Problem

Hi All,
I have a Issue with getting the ComboBox value from the Listener. The Combo Box should return a IdiVend Object but is currently returning a String object. I have attached the code snippet. can you please guide on this

final BeanItemContainer bic = new BeanItemContainer(IdiVend.class);
List vendors = sdhService.getVendorList();
bic.addAll(vendors);
final Select vendor = new Select(“Vendor Selection”,bic);
vendor.setContainerDataSource(bic);
vendor.setImmediate(true);
vendor.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY);
vendor.setItemCaptionPropertyId(“vendNm”);
vendor.addListener(new ValueChangeListener() {

@Override
public void valueChange(ValueChangeEvent event) {
if(vendor.getValue() !=null){
IdiVend vendor = (IdiVend)event.getProperty().getValue(); //ClassCast Exception in this line

}

}
});

I have overrided the equals methods also for the IdiVend Object .

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IdiVend other = (IdiVend) obj;
if (idiVendId != other.idiVendId)
return false;
return true;
}

The problem is when i click on the dropdown I am not getting the IdiVend Object instead i am getting a String object which contains the toString() implementation.

Can you please let me know the exact root cause for the issue ?

Hi, I can’t immediately see a problem in your code. It should work. I extended the
BIC selection example
a bit and there doesn’t seem to be any problem.