Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: [databinding] bind to a null EReference
Re: [databinding] bind to a null EReference [message #331354] Wed, 03 September 2008 12:47 Go to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Lusso,

Let's give it a try. Does your model look like this?

Person
+ address: Address
+ street: String

And you want to bind address.street? But it is possible that address is
null and you expect that if someone is entering a text in the TextField
a new Address-instance is created and its street value is filled?

If that's the case then no sorry this is *not possible* because
Databinding has no idea how to create the Address-Instance (it might not
even know/has access to the implementation-class because EMF is only
presenting the interface from the out side and OSGi is hidding the
implementation).

Still I think you can work around this using a trick like this:

Person
+ address: Address
+ street: String
+ addressStreet: String (volatile transient derived feature)
+ ... => other attributes of the none mandatory address-attributes

The trick shown here is a very cool one and I used it a e.g. for the
following problem.

Person
+ addresses: EList<Address>
+ homeAddress: Address (volatile transient derived feature)
+ billingAddress: Address (volatile transient derived feature)

So EMF makes this fairly easy but even with any other Model-Technology ;-)

Maybe I should write a small example for the Databinding-Snippet pages
using Standard Beans (or anyone else eager on doing so).

Tom

Ed Merks schrieb:
> Lusso,
>
> It seems like a relatively common type of situation. Unfortunately my
> data binding skills are close to zero, so I'm hoping Tom or someone else
> will see your question, which is more of a general data binding question
> than a specific-EMF one, and provide some guidance...
>
>
> Luca Lusso wrote:
>> Hi, I have a model object with a optional reference to an other model
>> object. Sometimes this reference is NULL because it's optional. In my
>> GUI what I want to do is bind some attribute of the optional reference
>> to text field. Is possible to use databinding in such a way that, when
>> user fill those fields, the referenced object will be created, filled
>> with correct data and attached to parent model object? I think I have
>> to write custom code to do so, and I'm looking for suggestion.
>>
>> Thanks
>>
>> Lusso Luca


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: [databinding] bind to a null EReference [message #331361 is a reply to message #331354] Wed, 03 September 2008 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cagiva92.hotmail.com

Hey Tom,

Would you mind posting the the link to the Databinding-Snippets page?

Thanks!
Re: [databinding] bind to a null EReference [message #331362 is a reply to message #331361] Wed, 03 September 2008 15:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080509010601050107050708
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Ben,

Google search can answer such questions extremely quickly:
<http://wiki.eclipse.org/JFace_Data_Binding/Snippets>

http://wiki.eclipse.org/JFace_Data_Binding/Snippets


Ben wrote:
> Hey Tom,
>
> Would you mind posting the the link to the Databinding-Snippets page?
>
> Thanks!
>

--------------080509010601050107050708
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ben,<br>
<br>
Google search can answer such questions extremely quickly:<a
href="http://wiki.eclipse.org/JFace_Data_Binding/Snippets"><br>
</a>
<blockquote><a
href="http://wiki.eclipse.org/JFace_Data_Binding/Snippets">http://wiki.eclipse.org/JFace_Data_Binding/Snippets</a><br>
</blockquote>
<br>
Ben wrote:
<blockquote
cite="mid:237c7cbb5371b0a8b388f8b86ea2e17f$1@www.eclipse.org"
type="cite">Hey Tom,
<br>
<br>
Would you mind posting the the link to the Databinding-Snippets page?
<br>
<br>
Thanks!
<br>
<br>
</blockquote>
</body>
</html>

--------------080509010601050107050708--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [databinding] bind to a null EReference [message #331414 is a reply to message #331354] Fri, 05 September 2008 07:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: axel.nitert.de

Hi Tom,

thanks for this example. It really helped me to save a lot of time. I
would like to suggest to include this into your example application.

I didn't have the time yet to test your example application but I will
do so soon. I am very curiour on the CDO part.

Axel
Re: [databinding] bind to a null EReference [message #331415 is a reply to message #331414] Fri, 05 September 2008 08:21 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Axel,

Good I idea. I'll add such a thing to the example application. The CDO
thing is in fact so straight forward because all the real magic happens
inside this framework. The only thing I had to figure out was how to
make create connect to the server and for this problem there are great
snippets available.

Tom

Axel Nitert schrieb:
> Hi Tom,
>
> thanks for this example. It really helped me to save a lot of time. I
> would like to suggest to include this into your example application.
>
> I didn't have the time yet to test your example application but I will
> do so soon. I am very curiour on the CDO part.
>
> Axel


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: [databinding] bind to a null EReference [message #331418 is a reply to message #331415] Fri, 05 September 2008 11:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: axel.nitert.de

Hi Tom,

I thought about the data model and it seems that the example is not
quite correct compared to the reality.

The data structure should be like

FIFA (world-wide)
UEFA (Europe)
DFB (Germany)

What I mean is that the class Country should be a specialization of a
class like Region.

Region
Country
World
Continent

or something like this.

I didn't want to be pedantic it's just a remark.

Axel


Tom Schindl schrieb:
> Hi Axel,
>
> Good I idea. I'll add such a thing to the example application. The CDO
> thing is in fact so straight forward because all the real magic happens
> inside this framework. The only thing I had to figure out was how to
> make create connect to the server and for this problem there are great
> snippets available.
>
> Tom
>
> Axel Nitert schrieb:
>> Hi Tom,
>>
>> thanks for this example. It really helped me to save a lot of time. I
>> would like to suggest to include this into your example application.
>>
>> I didn't have the time yet to test your example application but I will
>> do so soon. I am very curiour on the CDO part.
>>
>> Axel
>
>
Re: [databinding] bind to a null EReference [message #331421 is a reply to message #331418] Fri, 05 September 2008 12:08 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Axel,

You are right I'll correct this :-)

Tom

Axel Nitert schrieb:
> Hi Tom,
>
> I thought about the data model and it seems that the example is not
> quite correct compared to the reality.
>
> The data structure should be like
>
> FIFA (world-wide)
> UEFA (Europe)
> DFB (Germany)
>
> What I mean is that the class Country should be a specialization of a
> class like Region.
>
> Region
> Country
> World
> Continent
>
> or something like this.
>
> I didn't want to be pedantic it's just a remark.
>
> Axel
>
>
> Tom Schindl schrieb:
>> Hi Axel,
>>
>> Good I idea. I'll add such a thing to the example application. The CDO
>> thing is in fact so straight forward because all the real magic happens
>> inside this framework. The only thing I had to figure out was how to
>> make create connect to the server and for this problem there are great
>> snippets available.
>>
>> Tom
>>
>> Axel Nitert schrieb:
>>> Hi Tom,
>>>
>>> thanks for this example. It really helped me to save a lot of time. I
>>> would like to suggest to include this into your example application.
>>>
>>> I didn't have the time yet to test your example application but I will
>>> do so soon. I am very curiour on the CDO part.
>>>
>>> Axel
>>
>>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Previous Topic:Accessing SharedImages in plugin.xml (for ex. org.eclipse.ui.menus)
Next Topic:CVS : how to "replace with" branch:date
Goto Forum:
  


Current Time: Fri Dec 27 08:28:03 GMT 2024

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

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

Back to the top