I tried to set the Item Renderer with my own implementation but it does not
seem to call the toString method:
OrderHandler handler = psfServer.getOrderHandler();
GenericDao dao = new GenericDao(handler.getEntityManager(),
handler.getUserTransaction());
ListButton listButton = new ListButton();
ArrayList listData = new ArrayList();
listData.add(null);
for(Object o : dao.getAll(f.getType())) {
listData.add(o);
}
String key = f.getName();
listButton.setListData(listData);
listButton.setSelectedItemKey(key);
listButton.setItemRenderer(new GetNameItemRenderer());
tableViewRowEditor.getCellEditors().put(key, listButton);
displayedFields.put(f.getName(), f);
psfServer.returnOrderHandler(handler);
public class GetNameItemRenderer extends ListViewItemRenderer {
@Override
public String toString(Object item) {
String name = null;
try {
name = (String) item.getClass().getMethod("getName", new
Class[]{String.class}).invoke(item, null);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return null;
}
}
This message and its attachments may contain legally privileged or confidential
information. It is for the intended addressee(s) only.
If you are not the intended recipient you must not disclose or use the
information contained in it. If you have received this email in error please
notify us immediately by return email and delete the document.
Any views expressed in this message are those of the individual sender, except
where the sender specifies and with authority, states them to be the views of
the Company.
Uecomm accepts no liability for any damage caused by this email or its
attachments due to viruses, interference, interception, corruption or
unauthorised access.
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by NetIQ MailMarshal
#####################################################################################