[CDO Databinding] Attempting to data bind to derived attribute [message #525589] |
Wed, 07 April 2010 04:21 |
Gavin Crayk 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 |
Thomas Schindl 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 #525897 is a reply to message #525865] |
Thu, 08 April 2010 08:29 |
|
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.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Powered by
FUDForum. Page generated in 0.04391 seconds