|
Re: Affected tree elements [message #895793 is a reply to message #895777] |
Mon, 16 July 2012 05:21 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Mike,
Comments below.
On 16/07/2012 2:28 AM, Michael Spertus wrote:
> My item provider's getText method looks at many descendants
> (children/great-grandchildren/etc.). If the descendant is changed,
> however, the item's label is not updated. I have (sort of) worked
> around this by modifying the arguments used to create the
> ViewerNotification in DescendantClassItemProvider.notifyChanged, but
> this breaks encapsulation horribly.
It's an obvious problem, but we've not addressed this is a nice way. Do
you mean that the descendants themselves produce notifications to update
their ancestors? That's the approach I too with EGenericType. But the
problem is worse there because the labels depend on non-containment
references (names of referenced classifiers and type parameters) and
that I didn't handle at all.
> Is there a recommended way of handling this?
The nicest idea I've heard would depend on notifiers producing
read/access notifications that would allow one to determine all the
objects accessed to produce the label and attach listeners to each of
them. E.g., some type of content adapter that listens to all objects
and some thread-local logic that notices the notifications during the
label computation. Eike and I did work on a design for read/access
notification, but it's highly invasive and would require modifications
to all list implementations and all generated models...
>
> Sorry if this is an obvious question,
>
> Mike
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Affected tree elements [message #896003 is a reply to message #895793] |
Mon, 16 July 2012 20:12 |
Michael Spertus Messages: 78 Registered: July 2009 |
Member |
|
|
Thanks for your response, Ed. See below
Ed Merks wrote on Mon, 16 July 2012 01:21Mike,
Comments below.
On 16/07/2012 2:28 AM, Michael Spertus wrote:
> My item provider's getText method looks at many descendants
> (children/great-grandchildren/etc.). If the descendant is changed,
> however, the item's label is not updated. I have (sort of) worked
> around this by modifying the arguments used to create the
> ViewerNotification in DescendantClassItemProvider.notifyChanged, but
> this breaks encapsulation horribly.
It's an obvious problem, but we've not addressed this is a nice way. Do
you mean that the descendants themselves produce notifications to update
their ancestors?
I just modified the element in the ViewerNotification constructor to be the parent of the parent of the notifier (That's such a gross hack I didn't really want to spell it out explicitly in the original post).
Quote:That's the approach I too with EGenericType. But the
problem is worse there because the labels depend on non-containment
references (names of referenced classifiers and type parameters) and
that I didn't handle at all.
> Is there a recommended way of handling this?
The nicest idea I've heard would depend on notifiers producing
read/access notifications that would allow one to determine all the
objects accessed to produce the label and attach listeners to each of
them. E.g., some type of content adapter that listens to all objects
and some thread-local logic that notices the notifications during the
label computation. Eike and I did work on a design for read/access
notification, but it's highly invasive and would require modifications
to all list implementations and all generated models...
That's exactly what I want. Since it sounds like it's not in the cards for the foreseeable future, how hard is it for the ancestor to attach and maintain listeners to all of its descendants? Is there some sample code where this is done? Fortunately, handling containment references would meet my needs.
Thanks again,
Mike
|
|
|
Re: Affected tree elements [message #896053 is a reply to message #896003] |
Tue, 17 July 2012 05:35 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Michael,<br>
<br>
Comments below.<br>
<br>
<br>
<div class="moz-cite-prefix">On 16/07/2012 10:12 PM, Michael Spertus
wrote:<br>
</div>
<blockquote cite="mid:ju1sk9$t9f$1@xxxxxxxxe.org" type="cite">Thanks
for your response, Ed. See below
<br>
Ed Merks wrote on Mon, 16 July 2012 01:21
<br>
<blockquote type="cite">Mike,
<br>
<br>
Comments below.
<br>
<br>
On 16/07/2012 2:28 AM, Michael Spertus wrote:
<br>
> My item provider's getText method looks at many descendants
> (children/great-grandchildren/etc.). If the descendant is
changed, > however, the item's label is not updated. I have
(sort of) worked > around this by modifying the arguments
used to create the > ViewerNotification in
DescendantClassItemProvider.notifyChanged, but > this breaks
encapsulation horribly. <br>
It's an obvious problem, but we've not addressed this is a nice
way. Do you mean that the descendants themselves produce
notifications to update their ancestors?
<br>
</blockquote>
<br>
I just modified the element in the ViewerNotification constructor
to be the parent of the parent of the notifier (That's such a
gross hack I didn't really want to spell it out explicitly in the
original post).
<br>
</blockquote>
Yes, similar to what we do in EGenericTypeItemProvider.<br>
<blockquote cite="mid:ju1sk9$t9f$1@xxxxxxxxe.org" type="cite">Quote:
<br>
<blockquote type="cite">That's the approach I too with
EGenericType. But the problem is worse there because the labels
depend on non-containment references (names of referenced
classifiers and type parameters) and that I didn't handle at
all.
<br>
> Is there a recommended way of handling this?
<br>
The nicest idea I've heard would depend on notifiers producing
read/access notifications that would allow one to determine all
the objects accessed to produce the label and attach listeners
to each of them. E.g., some type of content adapter that
listens to all objects and some thread-local logic that notices
the notifications during the label computation. Eike and I did
work on a design for read/access notification, but it's highly
invasive and would require modifications to all list
implementations and all generated models...
<br>
</blockquote>
<br>
That's exactly what I want. Since it sounds like it's not in the
cards for the foreseeable future, how hard is it for the ancestor
to attach and maintain listeners to all of its descendants?</blockquote>
Something like an EContentAdapter can do that automatically, though
it attaches to <b>all </b>contained objects so you might need to
specialize it to ignore things. In any case, it's a good example.<br>
<blockquote cite="mid:ju1sk9$t9f$1@xxxxxxxxe.org" type="cite"> Is
there some sample code where this is done? Fortunately, handling
containment references would meet my needs.
<br>
</blockquote>
That certainly simplifies the problem. You have to be careful about
the appropriate times to remove such additional adapters, e.g., in
the derived ItemProviderAdapter's dispose.<br>
<blockquote cite="mid:ju1sk9$t9f$1@xxxxxxxxe.org" type="cite">
<br>
<br>
Thanks again,
<br>
<br>
Mike
<br>
</blockquote>
<br>
<br>
</body>
</html>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03394 seconds