Home » Eclipse Projects » JFace » [Databinding] binding to objects attributes
[Databinding] binding to objects attributes [message #13379] |
Wed, 10 June 2009 08:32  |
Eclipse User |
|
|
|
Hi,
is it possible to bind to attributes of objects within objects?
E.g. I have an Object Person with the attributes:
String firstName;
String lastName;
Address address;
where Address is an object with the attribute:
String street;
Can I bind direct to street via the person object? Something like this:
BeansObservables.observeValue(person, "address.street");
Or do I to use
BeansObservables.observeValue(person.getAddress(), "street");
Best regards, Lars
|
|
| |
Re: [Databinding] binding to objects attributes [message #14063 is a reply to message #13400] |
Wed, 10 June 2009 10:33   |
Eclipse User |
|
|
|
Hi Tom,
xool, this is a nice feature in Eclipse 3.5.
I'll add a beans example to my databinding tutorial and put your blog
entries as references into it:
http://www.vogella.de/articles/EclipseDataBinding/article.ht ml
Thank you,
Lars
Tom Schindl wrote:
> Hi,
>
> With 3.4 you need to do this your own
> -----------8<-----------
> IObservable parent = BeansObservables.observeValue(person,"address");
> IObservableValue child =
> BeansObservables.observeDetail(parent,"street",Person.class);
> -----------8<-----------
>
> With 3.5 this works out of the box (when using Properties-API):
>
> -----------8<-----------
> IObservableValue v = BeanProperties.value("address.street").observe(person);
> -----------8<-----------
>
> You can read some details in my current blog. I'm discussing this at
> EMF-Level but the code is the same for Beans. The nice thing with 3.5 is
> that this even works in Table/Trees :-)
>
> Tom
>
> [1] http://tomsondev.bestsolution.at/2009/06/07/galileo-emf-data binding-part-2/
>
> Lars Vogel schrieb:
>> Hi,
>>
>> is it possible to bind to attributes of objects within objects?
>>
>> E.g. I have an Object Person with the attributes:
>>
>> String firstName;
>> String lastName;
>> Address address;
>>
>> where Address is an object with the attribute:
>>
>> String street;
>>
>> Can I bind direct to street via the person object? Something like this:
>>
>> BeansObservables.observeValue(person, "address.street");
>>
>> Or do I to use
>>
>> BeansObservables.observeValue(person.getAddress(), "street");
>>
>> Best regards, Lars
>>
|
|
|
Re: [Databinding] binding to objects attributes [message #14130 is a reply to message #13400] |
Wed, 10 June 2009 15:30   |
Eclipse User |
|
|
|
Hi Tom,
thanks again, I included a tiny bean example for the Properties API in
my tutorial.
Best regards, Lars
Tom Schindl wrote:
> Hi,
>
> With 3.4 you need to do this your own
> -----------8<-----------
> IObservable parent = BeansObservables.observeValue(person,"address");
> IObservableValue child =
> BeansObservables.observeDetail(parent,"street",Person.class);
> -----------8<-----------
>
> With 3.5 this works out of the box (when using Properties-API):
>
> -----------8<-----------
> IObservableValue v = BeanProperties.value("address.street").observe(person);
> -----------8<-----------
>
> You can read some details in my current blog. I'm discussing this at
> EMF-Level but the code is the same for Beans. The nice thing with 3.5 is
> that this even works in Table/Trees :-)
>
> Tom
>
> [1] http://tomsondev.bestsolution.at/2009/06/07/galileo-emf-data binding-part-2/
>
> Lars Vogel schrieb:
>> Hi,
>>
>> is it possible to bind to attributes of objects within objects?
>>
>> E.g. I have an Object Person with the attributes:
>>
>> String firstName;
>> String lastName;
>> Address address;
>>
>> where Address is an object with the attribute:
>>
>> String street;
>>
>> Can I bind direct to street via the person object? Something like this:
>>
>> BeansObservables.observeValue(person, "address.street");
>>
>> Or do I to use
>>
>> BeansObservables.observeValue(person.getAddress(), "street");
>>
>> Best regards, Lars
>>
|
|
|
Re: [Databinding] binding to objects attributes [message #14147 is a reply to message #14130] |
Wed, 10 June 2009 17:56  |
Eclipse User |
|
|
|
Hi,
I just saw that there's a bug in my example :-) Naturally the second
line should be:
BeansObservables.observeDetail(parent,"street",Address.class);
Tom
Lars Vogel schrieb:
> Hi Tom,
>
> thanks again, I included a tiny bean example for the Properties API in
> my tutorial.
>
> Best regards, Lars
>
> Tom Schindl wrote:
>> Hi,
>>
>> With 3.4 you need to do this your own
>> -----------8<-----------
>> IObservable parent = BeansObservables.observeValue(person,"address");
>> IObservableValue child =
>> BeansObservables.observeDetail(parent,"street",Person.class);
>> -----------8<-----------
>>
>> With 3.5 this works out of the box (when using Properties-API):
>>
>> -----------8<-----------
>> IObservableValue v =
>> BeanProperties.value("address.street").observe(person);
>> -----------8<-----------
>>
>> You can read some details in my current blog. I'm discussing this at
>> EMF-Level but the code is the same for Beans. The nice thing with 3.5 is
>> that this even works in Table/Trees :-)
>>
>> Tom
>>
>> [1] http://tomsondev.bestsolution.at/2009/06/07/galileo-emf-data binding-part-2/
>>
>>
>> Lars Vogel schrieb:
>>> Hi,
>>>
>>> is it possible to bind to attributes of objects within objects?
>>>
>>> E.g. I have an Object Person with the attributes:
>>>
>>> String firstName;
>>> String lastName;
>>> Address address;
>>>
>>> where Address is an object with the attribute:
>>>
>>> String street;
>>>
>>> Can I bind direct to street via the person object? Something like this:
>>>
>>> BeansObservables.observeValue(person, "address.street");
>>>
>>> Or do I to use
>>>
>>> BeansObservables.observeValue(person.getAddress(), "street");
>>>
>>> Best regards, Lars
>>>
|
|
|
Goto Forum:
Current Time: Tue May 13 20:39:52 EDT 2025
Powered by FUDForum. Page generated in 0.03772 seconds
|