Hi Roger,

Thanks for the response. I was just missing the setSelectedItemKey bit as per 
the tutorial.
So my nested object is now binding correctly thanks.

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);
       tableViewRowEditor.getCellEditors().put(key, listButton);

I'm just trying to figure out how to use a different representation of the 
object instead of the default toString() method. Is the ItemRenderer 
responsible for what is displayed in the button?
Do I create my own renderer if I what to use the getName() object method 
instead of the toString() method?

Cheers,

Jason





From: Roger L. Whitcomb [mailto:[email protected]]
Sent: Friday, 24 May 2013 5:21 AM
To: [email protected]
Subject: RE: TableView Objects with nested Objects

Hi Jason,
                In a short word, yes, the row editors rely on data binding.  
For instance, the TableViewRowEditor.beginEdit method has this code:
        // Get the data being edited
        List<?> tableData = tableViewArgument.getTableData();
        Object tableRow = tableData.get(rowIndexArgument);

        // Load the row data into the editor components
        tablePane.load(tableRow);

                And likewise the endEdit method does this:
            // Update the row data
            List<Object> tableData = (List<Object>)tableView.getTableData();
            Object tableRow = tableData.get(rowIndex);
            tablePane.store(tableRow);

                The standard Pivot Data Binding tutorial is quite helpful:  
http://pivot.apache.org/tutorials/data-binding.html
                Basically your data can be a POJO using bean methods to get and 
set the data, and your column names must match the bean property names.

                If you need more help, just ask - we've been through this 
before.

Thanks,
~Roger Whitcomb

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
#####################################################################################

Reply via email to