Home » Modeling » EMF » [EMF] Change-Notifications in ItemProviders
| |
Re: [EMF] Change-Notifications in ItemProviders [message #1395321 is a reply to message #1394372] |
Sun, 06 July 2014 19:10 |
Samuel Leisering Messages: 34 Registered: July 2014 |
Member |
|
|
Hi,
thats too bad. Some of those affected objects are unrelated in regards
to the model hierarchy (or at least more complicated than
parent/children relations). How are the notifications generated, and
where is decided which itemprovider gets notified? Because the generated
notifyChanged(Notification) method you mentioned contains a switch-case
to decide if the notification applies to the node. But after further
inspection i saw that only notifications about the particular objects
this ItemProvider adapts come through anyway (which is basically the
problem here).
Greetings
Samuel
On 05.07.2014 08:45, Ed Merks wrote:
> Samuel,
>
> No, there's no prescribed way. If it's affected by the labels of
> contained children, one can often write the child item provider so it
> generates notifications for the parent, e.g.,
> org.eclipse.emf.ecore.provider.EGenericTypeItemProvider.notifyChanged(Notification).
>
>
> On 04/07/2014 5:48 PM, Samuel Leisering wrote:
>> Hi
>>
>> Is there a documentation about how notifications in ItemProviders are
>> handled? I am currently using the item providers generated by the CDO
>> generator, and notifications are working just fine. After modifying some
>> of those Item Providers i noticed that there is no obvious way to
>> subscribe item providers to events happening on other items.
>> I created a tree where some nodes display content of other items, and
>> therefore should be changed when this content changes. Is there a
>> predefined way to do this?
>>
>>
>> Greetings
>> Samuel
>
|
|
|
Re: [EMF] Change-Notifications in ItemProviders [message #1395607 is a reply to message #1395321] |
Mon, 07 July 2014 06:06 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Samuel,
Comments below.
On 06/07/2014 9:10 PM, Samuel Leisering wrote:
> Hi,
>
> thats too bad. Some of those affected objects are unrelated in regards
> to the model hierarchy (or at least more complicated than
> parent/children relations).
Yes, that makes things more complicated. Even Ecore has such issues
where the labels classifiers are used where those types themselves are
referenced; and even those do not properly refresh the tree when the
classifier is renamed.
> How are the notifications generated,
By the model when you change it.
> and
> where is decided which itemprovider gets notified?
An item provider is an adapter and is notified.
> Because the generated
> notifyChanged(Notification) method you mentioned contains a switch-case
> to decide if the notification applies to the node.
Yes.
> But after further
> inspection i saw that only notifications about the particular objects
> this ItemProvider adapts come through anyway (which is basically the
> problem here).
Yes. An item provider computing a label that involves visiting other
objects would generally need to add adapters to those objects and listen
for changes to any of the features it's using for computing the label.
It's a significantly challenging problem.
>
> Greetings
> Samuel
>
> On 05.07.2014 08:45, Ed Merks wrote:
>> Samuel,
>>
>> No, there's no prescribed way. If it's affected by the labels of
>> contained children, one can often write the child item provider so it
>> generates notifications for the parent, e.g.,
>> org.eclipse.emf.ecore.provider.EGenericTypeItemProvider.notifyChanged(Notification).
>>
>>
>> On 04/07/2014 5:48 PM, Samuel Leisering wrote:
>>> Hi
>>>
>>> Is there a documentation about how notifications in ItemProviders are
>>> handled? I am currently using the item providers generated by the CDO
>>> generator, and notifications are working just fine. After modifying some
>>> of those Item Providers i noticed that there is no obvious way to
>>> subscribe item providers to events happening on other items.
>>> I created a tree where some nodes display content of other items, and
>>> therefore should be changed when this content changes. Is there a
>>> predefined way to do this?
>>>
>>>
>>> Greetings
>>> Samuel
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: [EMF] Change-Notifications in ItemProviders [message #1395802 is a reply to message #1395321] |
Mon, 07 July 2014 12:18 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
On 06-07-14 21:10, Samuel Leisering wrote:
> Hi,
>
> thats too bad. Some of those affected objects are unrelated in regards
> to the model hierarchy (or at least more complicated than
> parent/children relations).
This is the reason I moved away from ItemProviders and use EMF
Databinding. Most model changes can be reflected in the UI as wished.
There is excellent documentation, and if you have an odd use case,
please ask here. (i.e. a case where multiple model changes would
aggregate to a single UI change or the other way around).
How are the notifications generated, and
> where is decided which itemprovider gets notified? Because the generated
> notifyChanged(Notification) method you mentioned contains a switch-case
> to decide if the notification applies to the node. But after further
> inspection i saw that only notifications about the particular objects
> this ItemProvider adapts come through anyway (which is basically the
> problem here).
>
> Greetings
> Samuel
>
> On 05.07.2014 08:45, Ed Merks wrote:
>> Samuel,
>>
>> No, there's no prescribed way. If it's affected by the labels of
>> contained children, one can often write the child item provider so it
>> generates notifications for the parent, e.g.,
>> org.eclipse.emf.ecore.provider.EGenericTypeItemProvider.notifyChanged(Notification).
>>
>>
>> On 04/07/2014 5:48 PM, Samuel Leisering wrote:
>>> Hi
>>>
>>> Is there a documentation about how notifications in ItemProviders are
>>> handled? I am currently using the item providers generated by the CDO
>>> generator, and notifications are working just fine. After modifying some
>>> of those Item Providers i noticed that there is no obvious way to
>>> subscribe item providers to events happening on other items.
>>> I created a tree where some nodes display content of other items, and
>>> therefore should be changed when this content changes. Is there a
>>> predefined way to do this?
>>>
>>>
>>> Greetings
>>> Samuel
>>
>
|
|
|
Re: [EMF] Change-Notifications in ItemProviders [message #1395852 is a reply to message #1395802] |
Mon, 07 July 2014 13:40 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Christophe,
Is it easy to build a fully functional tree this way? I.e., one that
has a properties view, supports creation of new children (extensibly),
drag-and-drop, and so on?
On 07/07/2014 2:18 PM, Christophe Bouhier wrote:
> On 06-07-14 21:10, Samuel Leisering wrote:
>> Hi,
>>
>> thats too bad. Some of those affected objects are unrelated in regards
>> to the model hierarchy (or at least more complicated than
>> parent/children relations).
> This is the reason I moved away from ItemProviders and use EMF
> Databinding. Most model changes can be reflected in the UI as wished.
> There is excellent documentation, and if you have an odd use case,
> please ask here. (i.e. a case where multiple model changes would
> aggregate to a single UI change or the other way around).
>
>
> How are the notifications generated, and
>> where is decided which itemprovider gets notified? Because the generated
>> notifyChanged(Notification) method you mentioned contains a switch-case
>> to decide if the notification applies to the node. But after further
>> inspection i saw that only notifications about the particular objects
>> this ItemProvider adapts come through anyway (which is basically the
>> problem here).
>>
>> Greetings
>> Samuel
>>
>> On 05.07.2014 08:45, Ed Merks wrote:
>>> Samuel,
>>>
>>> No, there's no prescribed way. If it's affected by the labels of
>>> contained children, one can often write the child item provider so it
>>> generates notifications for the parent, e.g.,
>>> org.eclipse.emf.ecore.provider.EGenericTypeItemProvider.notifyChanged(Notification).
>>>
>>>
>>>
>>> On 04/07/2014 5:48 PM, Samuel Leisering wrote:
>>>> Hi
>>>>
>>>> Is there a documentation about how notifications in ItemProviders are
>>>> handled? I am currently using the item providers generated by the CDO
>>>> generator, and notifications are working just fine. After modifying
>>>> some
>>>> of those Item Providers i noticed that there is no obvious way to
>>>> subscribe item providers to events happening on other items.
>>>> I created a tree where some nodes display content of other items, and
>>>> therefore should be changed when this content changes. Is there a
>>>> predefined way to do this?
>>>>
>>>>
>>>> Greetings
>>>> Samuel
>>>
>>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: [EMF] Change-Notifications in ItemProviders [message #1396514 is a reply to message #1395852] |
Tue, 08 July 2014 12:04 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
On 07-07-14 15:40, Ed Merks wrote:
> Christophe,
>
> Is it easy to build a fully functional tree this way? I.e., one that
> has a properties view, supports creation of new children (extensibly),
> drag-and-drop, and so on?
Hi Ed, My statement is in the context of the question, which is
how to reflect ui <--> model changes in an arbitrary object structure
(Through contained/non-contained relationships or whatever else). The
question is also about notifications and CDO. Here a CDO invalidation
event can be caught and the Tree refreshed, which is how I handle it.
For this EMF Databinding has (Amongst much more) two powerfull concepts
for trees,
TreeStructureAdvisor => Define the structure of the tree.
IObservableFactory => Create observables.
Feeding the tree, is possible with a ComputedList which is a concept I
like very much in Databinding. I use for example to aggregate the
content from multiple EMF resources.
Of course, I use the EMF.Edit framework for other functionality you
mention (Command framework, PropertySource etc..). It is for sure that
Databinding doesn't offer this functionality.
>
>
> On 07/07/2014 2:18 PM, Christophe Bouhier wrote:
>> On 06-07-14 21:10, Samuel Leisering wrote:
>>> Hi,
>>>
>>> thats too bad. Some of those affected objects are unrelated in regards
>>> to the model hierarchy (or at least more complicated than
>>> parent/children relations).
>> This is the reason I moved away from ItemProviders and use EMF
>> Databinding. Most model changes can be reflected in the UI as wished.
>> There is excellent documentation, and if you have an odd use case,
>> please ask here. (i.e. a case where multiple model changes would
>> aggregate to a single UI change or the other way around).
>>
>>
>> How are the notifications generated, and
>>> where is decided which itemprovider gets notified? Because the generated
>>> notifyChanged(Notification) method you mentioned contains a switch-case
>>> to decide if the notification applies to the node. But after further
>>> inspection i saw that only notifications about the particular objects
>>> this ItemProvider adapts come through anyway (which is basically the
>>> problem here).
>>>
>>> Greetings
>>> Samuel
>>>
>>> On 05.07.2014 08:45, Ed Merks wrote:
>>>> Samuel,
>>>>
>>>> No, there's no prescribed way. If it's affected by the labels of
>>>> contained children, one can often write the child item provider so it
>>>> generates notifications for the parent, e.g.,
>>>> org.eclipse.emf.ecore.provider.EGenericTypeItemProvider.notifyChanged(Notification).
>>>>
>>>>
>>>>
>>>> On 04/07/2014 5:48 PM, Samuel Leisering wrote:
>>>>> Hi
>>>>>
>>>>> Is there a documentation about how notifications in ItemProviders are
>>>>> handled? I am currently using the item providers generated by the CDO
>>>>> generator, and notifications are working just fine. After modifying
>>>>> some
>>>>> of those Item Providers i noticed that there is no obvious way to
>>>>> subscribe item providers to events happening on other items.
>>>>> I created a tree where some nodes display content of other items, and
>>>>> therefore should be changed when this content changes. Is there a
>>>>> predefined way to do this?
>>>>>
>>>>>
>>>>> Greetings
>>>>> Samuel
>>>>
>>>
>>
>
|
|
|
Re: [EMF] Change-Notifications in ItemProviders [message #1396518 is a reply to message #1395881] |
Tue, 08 July 2014 12:07 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
On 07-07-14 16:31, Felix Dorner wrote:
> On 07/07/2014 14:18, Christophe Bouhier wrote:
>> On 06-07-14 21:10, Samuel Leisering wrote:
>>> Hi,
>>>
>>> thats too bad. Some of those affected objects are unrelated in regards
>>> to the model hierarchy (or at least more complicated than
>>> parent/children relations).
>> This is the reason I moved away from ItemProviders and use EMF
>> Databinding. Most model changes can be reflected in the UI as wished.
>> There is excellent documentation, and if you have an odd use case,
>> please ask here. (i.e. a case where multiple model changes would
>> aggregate to a single UI change or the other way around).
>
> Excellent documentation? Where? Thanks for sharing. I only ever found
> blog posts
Yes, that's what I meant. Perhaps I should rephrase excellent to
satisfying, at least for me.
Tom's been through great length to share what he did, with a series of
blogs.
http://tomsondev.bestsolution.at/category/databinding/emf//
and the like with warnings that this and that changed and
> will change in the future.. and felt I'm the only one using it and other
> people at work look at me like I'm crazy to use that even for the
> simplest things.
>
> Felix
>
|
|
|
Goto Forum:
Current Time: Sun Sep 22 15:48:21 GMT 2024
Powered by FUDForum. Page generated in 0.04321 seconds
|