Community
Participate
Working Groups
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.
Created attachment 180007 [details] The tutorial modified to add a IGraphcsAlgorithmRenderer
I was able to reproduce this when more than one of the EEnums are on the screen
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...)
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;
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
Issue solved by providing a sample implementation for a custom renderer
No further steps necessary