Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO Databinding] Attempting to data bind to derived attribute
[CDO Databinding] Attempting to data bind to derived attribute [message #525589] Wed, 07 April 2010 04:21 Go to next message
Gavin Crayk is currently offline Gavin CraykFriend
Messages: 13
Registered: February 2010
Junior Member
I am having a fair bit of trouble getting derived, transient, volatile, and unchangeable CDO attributes to data bind to widgets, only null ever seems to be returned to them.

The really weird thing is that if I use the same model prior to CDO'ifying the data binding works as expected.

E.G
Say I have the following model

/** @model */
public interface Example {
      /** @model */
     public String getFirstname();
   
     /** @model */
     public String getSurname();

     /** @model transient="true" volatile="true" changeable="false" derived="true"*/
     public String getFullname();
}


After generation I alter the method getFullname in ExampleImpl.java to
/** @generated */
public String getFullname() {
      return getSurname() + ", " + getFirstname();
}


If I was to then run it, the default EMF editor would update the Fullname property as I saved changes to either Surname or Firstname fields, as expected.

However if I CDO'ify the genmodel and then rebuild, altering the updated getFullname() in ExampleImpl.java like so:
/** @generated */
public String getFullname() {
      return getSurname() + ", " + getFirstname();
      // return (String)eGet(ExamplePackage.Literals.EXAMPLE__FULL_NAME, true);
}


when I run the generated editor as before, the Fullname remains null regardless of what values I place in firstname or surname property fields.

If you manually call the getFullname() method, the correct results are called. This leads me to think its some sort of notification issue. However I have applied the CDO derived notifier recipe and while that fires notifications when relied upon attributes change, any widgets data binded to the derived attribute still report null.

My Google searches haven't shed any light on this, what am I doing wrong?
Cheers,
Gavin.
Re: [CDO Databinding] Attempting to data bind to derived attribute [message #525590 is a reply to message #525589] Wed, 07 April 2010 04:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

The databinding code will call eGet() and my guess is that in CDO this
is NOT delegating to your getFullname() method and hence things are
failing. Eike?

Tom

Am 07.04.10 06:21, schrieb Gavin Crayk:
> I am having a fair bit of trouble getting derived, transient, volatile,
> and unchangeable CDO attributes to data bind to widgets, only null ever
> seems to be returned to them.
>
> The really weird thing is that if I use the same model prior to
> CDO'ifying the data binding works as expected.
>
> E.G
> Say I have the following model
>
>
> /** @model */
> public interface Example {
> /** @model */
> public String getFirstname();
> /** @model */
> public String getSurname();
>
> /** @model transient="true" volatile="true" changeable="false"
> derived="true"*/
> public String getFullname();
> }
>
>
> After generation I alter the method getFullname in ExampleImpl.java to
>
> /** @generated */
> public String getFullname() {
> return getSurname() + ", " + getFirstname();
> }
>
>
> If I was to then run it, the default EMF editor would update the
> Fullname property as I saved changes to either Surname or Firstname
> fields, as expected.
>
> However if I CDO'ify the genmodel and then rebuild, altering the updated
> getFullname() in ExampleImpl.java like so:
>
> /** @generated */
> public String getFullname() {
> return getSurname() + ", " + getFirstname();
> // return (String)eGet(ExamplePackage.Literals.EXAMPLE__FULL_NAME,
> true);
> }
>
>
> when I run the generated editor as before, the Fullname remains null
> regardless of what values I place in firstname or surname property fields.
>
> If you manually call the getFullname() method, the correct results are
> called. This leads me to think its some sort of notification issue.
> However I have applied the CDO derived notifier recipe and while that
> fires notifications when relied upon attributes change, any widgets data
> binded to the derived attribute still report null.
>
> My Google searches haven't shed any light on this, what am I doing wrong?
> Cheers,
> Gavin.
Re: [CDO Databinding] Attempting to data bind to derived attribute [message #525612 is a reply to message #525590] Wed, 07 April 2010 07:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ralf.ellner.cs.fau.de

Hi,

> The databinding code will call eGet() and my guess is that in CDO this
> is NOT delegating to your getFullname() method and hence things are
> failing. Eike?

have you set the value of "Feature Delegation" in your .genmodel to
"Dynamic"?

Cheers, Ralf
Re: [CDO Databinding] Attempting to data bind to derived attribute [message #525865 is a reply to message #525612] Thu, 08 April 2010 05:06 Go to previous messageGo to next message
Gavin Crayk is currently offline Gavin CraykFriend
Messages: 13
Registered: February 2010
Junior Member
Thankyou for your replies.

Setting the Feature Delegation to dynamic sorts out the issue for my test case, will alter my project when I am at work tomorrow and see if that sorts the issue that I have been having, but that looks promising - thanks Smile

I notice that when i run the EMF to CDO migration tool that setting "Feature Delegation" to reflective is one of the few steps that it performs. Will altering it back to dynamic cause problems further down the line when hooking up the models to a CDO repository?

Cheers,
Gavin.
Re: [CDO Databinding] Attempting to data bind to derived attribute [message #525897 is a reply to message #525865] Thu, 08 April 2010 08:29 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Guys,

Dynamic feature delegation is an adequate means to make your custom
getter and setter code being called and at the same time operate well
with CDO. The CDO migrator tool is quite old now and has not been
updated when dynamic feature delegation was introduced to EMF. Please
feel free to submit a bugzilla so that we can look at it.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 08.04.2010 07:06, schrieb Gavin Crayk:
> Thankyou for your replies.
>
> Setting the Feature Delegation to dynamic sorts out the issue for my
> test case, will alter my project when I am at work tomorrow and see if
> that sorts the issue that I have been having, but that looks promising
> - thanks :)
>
> I notice that when i run the EMF to CDO migration tool that setting
> "Feature Delegation" to reflective is one of the few steps that it
> performs. Will altering it back to dynamic cause problems further down
> the line when hooking up the models to a CDO repository?
>
> Cheers,
> Gavin.


Re: [CDO Databinding] Attempting to data bind to derived attribute [message #526150 is a reply to message #525589] Thu, 08 April 2010 23:38 Go to previous message
Gavin Crayk is currently offline Gavin CraykFriend
Messages: 13
Registered: February 2010
Junior Member
Thanks all, altering Feature Delegation to dynamic has solved my data binding problem.

I've added a enhancement bugzilla request to look at the migration tool (https://bugs.eclipse.org/bugs/show_bug.cgi?id=308582)

Cheers,
Gavin.
Previous Topic:EMF Dependencies in VE
Next Topic:Problem with IEditorInput
Goto Forum:
  


Current Time: Fri Apr 19 23:19:58 GMT 2024

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

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

Back to the top