Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [Databinding] binding to sub objects
[Databinding] binding to sub objects [message #516376] Tue, 23 February 2010 19:07 Go to next message
Matt Biggs is currently offline Matt Biggs
Messages: 68
Registered: July 2009
Member
Is it possible to bind a tableviewer to a model and its sub objects, for example using properties?

eg: my model consists of

public class Person {
public String name;
public List<Address> addresses;
}

public class Address {
public String postcode;
}

I would like my tableviewer to display column 1 Persons name, column 2 first address postcode, column 3 second address postcode etc etc.
Re: [Databinding] binding to sub objects [message #516475 is a reply to message #516376] Wed, 24 February 2010 07:29 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico Schnepel
Messages: 121
Registered: July 2009
Senior Member
Hi Matt,

if addresses is implemented by WritableList you could use a ComputedValue
and get the first/second/etc. element from the list. if you have multiple
persons you would need a ComputedMap. The writable list is needed to
automatically update the computed value/map upon changes in the list.

Enrico

"Matt Biggs" <zebbedi@gmail.com> schrieb im Newsbeitrag
news:hm191f$ine$1@build.eclipse.org...
> Is it possible to bind a tableviewer to a model and its sub objects, for
> example using properties?
>
> eg: my model consists of
>
> public class Person {
> public String name;
> public List<Address> addresses;
> }
>
> public class Address {
> public String postcode;
> }
>
> I would like my tableviewer to display column 1 Persons name, column 2
> first address postcode, column 3 second address postcode etc etc.
>
Re: [Databinding] binding to sub objects [message #516557 is a reply to message #516376] Wed, 24 February 2010 12:00 Go to previous message
Matt Biggs is currently offline Matt Biggs
Messages: 68
Registered: July 2009
Member
Hi Enrico,

Do you have a very quick example of this? Im still struggling with the concept of hooking it all up together.

cheers
Previous Topic:ControlDecoration on table items
Next Topic:Refresh TreeViewer with attached ViewerFilter
Goto Forum:
  


Current Time: Sat Oct 25 15:17:49 GMT 2014

Powered by FUDForum. Page generated in 0.03424 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software