Create Diagram Model Programatically [message #708892] |
Wed, 03 August 2011 05:06  |
Eclipse User |
|
|
|
Hello,
I have a graphiti editor which i use to create/edit certain domain model. The diagram information is all stored in the same file when saved. However there are some old domain models which do not have the Diagram model within them. So when I load the old files, I want to create corresponding pictogram elements and other graphics programmatically.
I have created the diagram using:
Diagram diagram = Graphiti.getPeCreateService().createDiagram(diagramTypeId, diagramName, true);
Is there any way to create pictogram elements and graphics algorithms programmatically or should I create each element using the create features only?
Thanks in advance for help.
Best Regards,
Murthy
[Updated on: Wed, 03 August 2011 05:11] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Create Diagram Model Programatically [message #875708 is a reply to message #717737] |
Wed, 23 May 2012 04:01  |
Eclipse User |
|
|
|
Hi Joerg, Hi Murthy
I have the same question now. I am a bigger at Graphiti.
Could you please give the code example about "you can as usual create your graphical elements and link them with the corresponding domain model objects"
Thank you very much
Joerg Reichert wrote on Mon, 22 August 2011 04:26Hi Murthy,
I just looked into my code once again and noticed that only depend on the feature provider as I use the direct editing support. In any other case you should not depend on that.
I also had two use cases
- Create Diagram file (and content) for existing domain model
- Create initial domain model and associated initial diagram file
My notion was just to reuse the logic of the PictogramElement add(IAddContext context), but you may redefine such logic also outside the add feature class. You only need your loaded domain model and a diagram object as starting point, this can be easily created by
Diagram diagram = Graphiti.getPeCreateService().createDiagram(yourDiagramTypeId, diagramName, true);
The you have the create services:
IPeService peService = Graphiti.getPeService();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
IGaService gaService = Graphiti.getGaService();
and you can as usual create your graphical elements and link them with the corresponding domain model objects.
Regards
Joerg
|
|
|
Powered by
FUDForum. Page generated in 0.05339 seconds