Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326733

Summary: GraphicsAlgorithm properties update and IGraphicsAlgorithmRenderer repaint
Product: [Modeling] Graphiti Reporter: Romain Raugi <romain.raugi>
Component: CoreAssignee: Michael Wenz <michael.wenz>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: michael.wenz, romain.raugi
Version: 0.7.0Flags: michael.wenz: indigo+
Target Milestone: 0.8.0   
Hardware: All   
OS: All   
Whiteboard: Indigo M4 theme_bug
Attachments:
Description Flags
The tutorial modified to highlight the need for such requirement none

Description Romain Raugi CLA 2010-10-01 00:15:37 EDT
Build Identifier: 20100617-1415

The Property collection is a way to store graphical data in the PlatformGraphicsAlgorithm to be used by the renderer. By this way, there is no need to extend the notational metamodel for this purpose. But an update in these properties is not handled and does not trigger any refresh of the renderer.

Reproducible: Always

Steps to Reproduce:
1. Download the modified attached tutorial.
2. Run an Eclipse with it.
3. Create a diagram.
4. Create an EEnum, it uses a GraphicsAlgorithmRenderer.
5. Show the property sheet, modify the name attribute to "" - (if the name is empty, the rectangle should be in gray, otherwise it is in green - managed by the MyUpdateEEnumFeature).
6. The rectangle is still in green.
7. Move the cursor above the rectangle, it becomes gray. The refresh is not automatic.
Comment 1 Romain Raugi CLA 2010-10-01 00:18:01 EDT
Created attachment 180009 [details]
The tutorial modified to highlight the need for such requirement
Comment 2 Romain Raugi CLA 2010-11-10 10:22:43 EST
Hi Michael,

Although it can be seen as minor, it has a great importance for us. We cannot make our GraphicsAlgorithms automatically refreshed when our domain objects are updated.

When do you think you will be able to provide a solution for this? Or do you have any idea for a workaround?

Thanks a lot,

Regards,

Romain
Comment 3 Romain Raugi CLA 2010-11-11 14:31:51 EST
Hi Michael,

I would prefer to extend PlatformGraphicsAlgorithm to add my custom attributes. It is a nicer way to do that. Such extension is nearly possible. A priori, only the refresh is problematic.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=330035.

Thanks a lot,

Regards,

Romain
Comment 4 Michael Wenz CLA 2010-11-12 07:59:14 EST
Hi Romain,

by setting this from "enhancement" to "minor" I was just reflecting that this is rather a bug than an enhancement request. From my feeling it was rather "minor" than "major", but since you require that feature you may also rise its importance.

Anyway, I had a deeper look onto this and found that the missing update was caused by that old obsolete check in PictogramElementDelegate.refreshFigureForGraphicsAlgorithm you pointed out in Bugzilla 330035. I have removed that check now, so the original issue is fixed.

Michael
Comment 5 Romain Raugi CLA 2010-11-12 08:41:24 EST
Hello Michael,

It is not completely fixed yet :(. It works when a property is added or removed from the GraphicsAlgorithm's properties because the notifier is a PictogramElement. But there is still an issue when a property is simply updated:  DiagramChangeListener.calculateActiveContainerPe(EObject) returns null in this case (because the notifier is a IProperty object).

DiagramChangeListener.calculateActiveContainerPe(EObject) should also be updated.

In my use case I use custom attributes to change colors but also other kind of IFigure properties (line style for example). As far as I understand,  PictogramElementDelegate.refreshFigureColors() has for effect to refresh entirely the renderer, what is fine.

Thanks Michael,

Romain
Comment 6 Michael Wenz CLA 2010-11-15 07:44:10 EST
Of course you're perfectly right. I added a check for properties in DiagramChangeListener.calculateActiveContainerPe to update the corresponding shape.
Thanks for pointing that out.

Michael
Comment 7 Romain Raugi CLA 2010-11-15 09:18:01 EST
Hi Michael,

I confirm that the fix works.

Nevertheless, https://bugs.eclipse.org/bugs/show_bug.cgi?id=330035 is still a high priority. For each node, we have several custom properties and so, persisted files are much more verbose (and large) - (<properties key="..." value="..."/>*) than if these properties were declared as XML attributes. And we can have many nodes...

Thanks a lot,

Romain
Comment 8 Michael Wenz CLA 2010-11-16 03:05:40 EST
Fix was verified.

We'll have a closer look into  https://bugs.eclipse.org/bugs/show_bug.cgi?id=330035 and see what is possible there.

Michael
Comment 9 Michael Wenz CLA 2011-06-24 09:02:53 EDT
Part of Graphiti Indigo 0.8.0