Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326730 - Refresh issues with IGraphicsAlgorithmRenderer
Summary: Refresh issues with IGraphicsAlgorithmRenderer
Status: CLOSED WORKSFORME
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 23:53 EDT by Romain Raugi CLA
Modified: 2010-10-07 03:11 EDT (History)
2 users (show)

See Also:


Attachments
The tutorial modified to add a IGraphcsAlgorithmRenderer (50.50 KB, application/x-zip-compressed)
2010-09-30 23:54 EDT, Romain Raugi CLA
no flags Details
Example implementation of an IGraphicsAlgorithmRenderer (9.73 KB, text/plain)
2010-10-01 04:34 EDT, Michael Wenz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Raugi CLA 2010-09-30 23:53:13 EDT
Build Identifier: 20100617-1415

Tested with Graphiti 0.7.0RC1 and RC2.

The synchronization between the undo/redo and what is displayed in the diagram is not consistent when using custom renderers.

Reproducible: Always

Steps to Reproduce:
1. Download the modified attached tutorial.
2. Run an Eclipse with this modified tutorial
3. Create a new tutorial diagram
4. Create an EEnum, it is renderered using a IGraphicsAlgorithmRenderer
5. Move it several times
6. Play with the undo/redo. You will sometimes observe the figure appearing twice, or more general refresh issues.
Comment 1 Romain Raugi CLA 2010-09-30 23:54:58 EDT
Created attachment 180007 [details]
The tutorial modified to add a IGraphcsAlgorithmRenderer
Comment 2 Michael Wenz CLA 2010-10-01 04:07:42 EDT
I was able to reproduce this when more than one of the EEnums are on the screen
Comment 3 Michael Wenz CLA 2010-10-01 04:34:29 EDT
Created attachment 180025 [details]
Example implementation of an IGraphicsAlgorithmRenderer

It seems as if your renderer does not correctly update the diagram. In certain situations old remains stay on the screen.

Attached is a CanFigure which is an example of an implementation of an  IGraphicsAlgorithmRenderer. Using this class as a renderer for the EEnum there are no refresh problems.

Could you have a look into this example to see if that solves this issue? (I'm not the hard-core GEF guy...)
Comment 4 Michael Wenz CLA 2010-10-01 04:36:51 EDT
I forgot to mention that in your renderer factory you should check the ID of the passed graphics algorithm:
if ("EEnum".equals(rendererContext.getPlatformGraphicsAlgorithm().getId())) {
	PictogramElement pe = rendererContext.getGraphicsAlgorithm().getPictogramElement();
	EObject modelObj = (EObject) rendererContext.getMappingProvider().getBusinessObjectForPictogramElement(pe);
	if (EcorePackage.eINSTANCE.getEObject().isInstance(modelObj)) {
		return new MyRenderer(rendererContext);
	}
}
return null;
Comment 5 Romain Raugi CLA 2010-10-01 09:20:27 EDT
Hi Michael,

The cause of the issue in my renderer is the overridden getBounds() method. In a IGraphicsAlgorithmRenderer, As far as I understand, we should not dynamically compute the bounds according to the GraphicsAlgorithm bounds stored in the notational model. Graphiti is responible of setting the bounds of the renderer.

This sample helped me a lot and remove an embarrassing issue.

Thanks,

Romain
Comment 6 Michael Wenz CLA 2010-10-05 07:51:33 EDT
Issue solved by providing a sample implementation for a custom renderer
Comment 7 Michael Wenz CLA 2010-10-07 03:11:50 EDT
No further steps necessary