pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roger Whitcomb <RogerandB...@rbwhitcomb.com>
Subject Re: TableView Objects with nested Objects
Date Fri, 24 May 2013 01:02:01 GMT
Renderers get their "render" method called. In that method, cast the data object to your type
and call the "getName" method of your data object. 

I'm not at my computer right now, but there are several tutorials and demos that use custom
renderers that you can look at. 

~Roger Whitcomb

Sent from my iPhone

On May 23, 2013, at 5:52 PM, "Separovic, Jason" <jseparovic@uecomm.com.au> wrote:

> 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

Mime
View raw message