|Re: How do I pre-populate a sub-diagram? [message #757860 is a reply to message #757859]
||Fri, 18 November 2011 13:59
| Nigel Daniels
Registered: July 2009
One further finding, if I only add nodes to the diagram then even though |
I do not see them added to the diagram EditPart the diagram continues to
open and the items I added are there. But because it seems my commands
are not executing until a later point I cannot access the compartments
to add and place nodes that should appear within those EditParts.
On 18/11/2011 13:32, Nigel Daniels wrote:
> further debugging turns up that when I form a request and execute a
> command on the diagram EditPart when setting up the main diagram I can
> see the other EditParts appear as children of the diagram. However when
> I do the same thing with the sub-diagram nothing is added but the
> command seems to have executed ok.
> If any one else has got his to work I could really do with your advice,
> On 16/11/2011 10:01, Nigel Daniels wrote:
>> I am working on a project in which I like to pre-populate a diagram with
>> some elements so that the user can focus on the task in hand. I already
>> have this working on the main diagram, in this case I have added a
>> static method *DiagramEditorUtil.createInitialLayout(DiagramEditPart
>> diagram) that is called by the diagram creation wizard to add and layout
>> the necessary elements.
>> When I tried to take the same approach for a sub-diagram (opened using
>> diagram partitioning) this approach fails. I tried to add the
>> appropriate method call to the OpenDiagramEditPolicy but the EditParts
>> that get returned are all DummyEditParts. It seems that the
>> OpenDiagramEditPolicy does not actually open the diagram itself.
>> Can anyone suggest where a better place may be to add my call? I cannot
>> see where in the GMF generated code the opening of the diagram happens,
>> so I suspect this is buried elsewhere in the stack. Is there a better
>> place for me to do this? I have been trying to identify a point in the
>> diagrams lifecycle where I could add the call? Specifically is there a
>> 'do stuff once I'm opened' point that would make sense for me to use?
>> BTW. I have tried adding the elements directly to the model, and they do
>> get drawn. However I am not able to control the layout of elements in
>> using this approach. I still need to find a place suggested above to
>> control the layout.
>> I'd rather not leave the diagram looking a mess that the user then has
>> to sort out.
>> Thanks for any advice,
Powered by FUDForum
. Page generated in 0.07194 seconds