OK, thanks. I think any of the solutions you describe would be appropriate 
(either a wrapper bean or a JSON-capable custom renderer).

Note that it is the responsibility of the renderer to respect the various list 
styles; see the renderStyles() method for an example:

http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java

G

On Aug 31, 2010, at 10:27 AM, A. J. wrote:

> Yep,
> 
> I have a list of Beans that have references to other beans :
> e.g. (fictive example)
> 
> class SomeBean {
>     private FirstObject firstObject;
>     private Integer someIntValue;
>     private SecondObj secondObj;
> 
>     public FirstObject getFirstObject() { return this.firstObject; } 
>     public Integer getSomeIntValue() { return this.someIntValue; } 
>     public SecondObject getSecondObject() { return this.secondObject; } 
> }
> 
> I just have a java.util.List<SomeBean> put in a TableView through a 
> ListAdapter and want to display columns such as :
> 
> <TableView.Column name="firstObject.name" />
> <TableView.Column name="someIntValue" />
> <TableView.Column name="secondObj.otherProperty" />
> 
> today, this is not possible.
> I tried using a cell renderer that in turn uses JSON expressions; it works 
> but I have to attach the cell renderer to each and every column and for some 
> reason colors in the label do not respect selection color in the list (label 
> are still back even when an item is selected);
> 
> So, I ended up modifying the Bean to expose a getter method for each column 
> displayed. 
> 
> e.g.
> class SomeBean {
>     private FirstObject firstObject;
>     private Integer someIntValue;
>     private SecondObj secondObj;
> 
>     public FirstObject getFirstObject() { return this.firstObject; } 
>     public Integer getSomeIntValue() { return this.someIntValue; } 
>     public SecondObject getSecondObject() { return this.secondObject; } 
> 
>     // getter for column 'name'
>     public String getName() { return firstObject != null ? 
> firstObject.getName() : null; }
>     // getter for column 'otherProperty'
>     public String getOtherProperty() { return secondObject != null ? 
> secondObject.getOtherProperty() : null; }
> }
> 
> It works but this is not very flexible (every time I want a new column, I 
> have to create a new getter) ...
>  
> 
> On Tue, Aug 31, 2010 at 3:53 PM, Greg Brown <[email protected]> wrote:
> After thinking about this a bit, I'm not entirely sure that this would be a 
> good idea (at least, not for the default renderers/editors). Could you 
> describe the use case in a little more detail?
> 
> On Aug 31, 2010, at 8:57 AM, Greg Brown wrote:
> 
> > Good question. It isn't currently supported by the default renderer, but 
> > there's no reason it shouldn't be (and it would actually clean up the code 
> > a bit). If you write your own renderer it should work fine.
> >
> > On Aug 31, 2010, at 8:26 AM, A. J. wrote:
> >
> >> Hi,
> >> Is it possible to use path expressions in TableView column names ?
> >> ex:
> >>
> >> <TableView.Column name="otherObj.property" />
> >>
> >> thanks
> >> AJ
> >>
> >
> 
> 

Reply via email to