Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » take over coordinates from model into the diagram of the GMF editor?
take over coordinates from model into the diagram of the GMF editor? [message #59883] Fri, 06 October 2006 03:50 Go to next message
Eclipse UserFriend
Hi all,
according to the thread
news://news.eclipse.org:119/efbkdg$q04$1@utils.eclipse.org I wonder if
the reverse direction (getting coordinates from model to diagram) is
also possible?

To be more precise: I want to build a diagram while just having the
modelfile of it --> I have to use the saved layout-information in order
to get the user-defined layout for my created diagram.

The idea behind is that I want rebuild previously saved used-defined
layout so that the new created diagram looks just like the user defined
it before.
I know that the layout is saved in the diagramfile, but I'd like to
rebuild the same diagram from scratch (without having the old *_diagram
file).

Any help or hints are very appreciated

Thanks in advance Alex
Re: take over coordinates from model into the diagram of the GMF editor? [message #59932 is a reply to message #59883] Fri, 06 October 2006 06:36 Go to previous messageGo to next message
Eclipse UserFriend
Guess, GMFGraph editor from SDK-experimental could be helpful

Artem

"Alex Haag" <Alexander.Haag@esg.de> wrote in message
news:eg51rt$1hh$1@utils.eclipse.org...
> Hi all,
> according to the thread
> news://news.eclipse.org:119/efbkdg$q04$1@utils.eclipse.org I wonder if the
> reverse direction (getting coordinates from model to diagram) is also
> possible?
>
> To be more precise: I want to build a diagram while just having the
> modelfile of it --> I have to use the saved layout-information in order to
> get the user-defined layout for my created diagram.
>
> The idea behind is that I want rebuild previously saved used-defined
> layout so that the new created diagram looks just like the user defined it
> before.
> I know that the layout is saved in the diagramfile, but I'd like to
> rebuild the same diagram from scratch (without having the old *_diagram
> file).
>
> Any help or hints are very appreciated
>
> Thanks in advance Alex
Re: take over coordinates from model into the diagram of the GMF editor? [message #60102 is a reply to message #59932] Fri, 06 October 2006 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi Artem,

I downloaded SDK-experimental and the sources, but I did not get to the
point. Do you have any idea where to look for the
diagram-creation-method? especially the part where the stored layout of
the model is used to create layout for the diagram.

Thanks for any hint
Alex


Artem Tikhomirov wrote:
> Guess, GMFGraph editor from SDK-experimental could be helpful
>
> Artem
>
> "Alex Haag" <Alexander.Haag@esg.de> wrote in message
> news:eg51rt$1hh$1@utils.eclipse.org...
>> Hi all,
>> according to the thread
>> news://news.eclipse.org:119/efbkdg$q04$1@utils.eclipse.org I wonder if the
>> reverse direction (getting coordinates from model to diagram) is also
>> possible?
>>
>> To be more precise: I want to build a diagram while just having the
>> modelfile of it --> I have to use the saved layout-information in order to
>> get the user-defined layout for my created diagram.
>>
>> The idea behind is that I want rebuild previously saved used-defined
>> layout so that the new created diagram looks just like the user defined it
>> before.
>> I know that the layout is saved in the diagramfile, but I'd like to
>> rebuild the same diagram from scratch (without having the old *_diagram
>> file).
>>
>> Any help or hints are very appreciated
>>
>> Thanks in advance Alex
>
>
Re: take over coordinates from model into the diagram of the GMF editor? [message #60292 is a reply to message #60102] Fri, 06 October 2006 11:02 Go to previous messageGo to next message
Eclipse UserFriend
Hello Alex,

First of all, I’d like to go back to your original question: if you are
willing to get grid of diagram file and deal only with one file with the
model you can tune GMF to store diagram in the same file as model. M.b. this
is the fastest and applicable solution for you? To do it just modify .gmfgen
model and set “Same file for diagram and model” property of Gen Editor Generator
to “true” + regenerate the code -> diagram and all the diagram elements +
layout constraints will be stored just in the model file.
If you’d like to get create diagram on the fly – this is not so easy question.
First you can try to store all layout information in model (like you requested).
To see an example you can take a look on org.eclipse.gmf.graphdef.editor.edit.parts.RectangleEditPart
from org.eclipse.gmf.graphdef.editor plugin. An idea is: all the position
information will be propagated from domain model element to the corresponding
notation element on activating an EditPart and then saved back to the model
element by special listener installed on notation model element. RectangleEditPart
contains some additional code but you do not need it because this plugin
deals with a lot of other properties taken from domain model and propagated
to the notation one.

-----------------
Alex Shatalin
Re: take over coordinates from model into the diagram of the GMF editor? [message #60551 is a reply to message #60292] Sat, 07 October 2006 17:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mail.volker-wegert.de

Hello,

Alex Shatalin <vano@borland.com> writes:
> If you’d like to get create diagram on the fly – this is not so easy
> question. First you can try to store all layout information in model (like
> you requested). To see an example you can take a look on
> org.eclipse.gmf.graphdef.editor.edit.parts.RectangleEditPart from
> org.eclipse.gmf.graphdef.editor plugin. An idea is: all the position
> information will be propagated from domain model element to the
> corresponding notation element on activating an EditPart and then saved back
> to the model element by special listener installed on notation model
> element. RectangleEditPart contains some additional code but you do not need
> it because this plugin deals with a lot of other properties taken from
> domain model and propagated to the notation one.

Just to be sure that I don't misunderstand this: The method activate() where
all this happens is marked as "@generated" (at least in the version I checked
out) - is all this coding really generated somehow (and if wo, how?) or is
just the @generated NOT missing?

Volker

--
* Volker Wegert * http://www.volker-wegert.de/contact *
* "Liebe deine Feinde - es wird sie um den Verstand bringen." (Eleanor
* Doan)
*
Re: take over coordinates from model into the diagram of the GMF editor? [message #60576 is a reply to message #60551] Sun, 08 October 2006 10:21 Go to previous messageGo to next message
Eclipse UserFriend
There are custom templates that are used to generate that code.

Artem

"Volker Wegert" <mail@volker-wegert.de> wrote in message
news:87mz87u8zx.fsf@sinclair.home.volker-wegert.de...
> Hello,
>
> Alex Shatalin <vano@borland.com> writes:
>> If you'd like to get create diagram on the fly - this is not so easy
>> question. First you can try to store all layout information in model
>> (like
>> you requested). To see an example you can take a look on
>> org.eclipse.gmf.graphdef.editor.edit.parts.RectangleEditPart from
>> org.eclipse.gmf.graphdef.editor plugin. An idea is: all the position
>> information will be propagated from domain model element to the
>> corresponding notation element on activating an EditPart and then saved
>> back
>> to the model element by special listener installed on notation model
>> element. RectangleEditPart contains some additional code but you do not
>> need
>> it because this plugin deals with a lot of other properties taken from
>> domain model and propagated to the notation one.
>
> Just to be sure that I don't misunderstand this: The method activate()
> where
> all this happens is marked as "@generated" (at least in the version I
> checked
> out) - is all this coding really generated somehow (and if wo, how?) or is
> just the @generated NOT missing?
>
> Volker
>
> --
> * Volker Wegert * http://www.volker-wegert.de/contact *
> * "Liebe deine Feinde - es wird sie um den Verstand bringen." (Eleanor
> * Doan)
> *
Re: take over coordinates from model into the diagram of the GMF editor? [message #60581 is a reply to message #60292] Mon, 09 October 2006 05:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

comments below.

Alex Shatalin wrote:
> M.b. this is the fastest and applicable solution for you?
Sorry, but I need to have the diagramfile seperate from the modelfile,
because the used modelfile is more complex than the needed diagramfile
(only a part of the model(modelfile) is displayed in the diagram).

> If you’d like to get create diagram on the fly – this is not so easy
> question. First you can try to store all layout information in model
> (like you requested).
I managed this one using the handleNotification-method as discribed in
thread (news://news.eclipse.org:119/efbkdg$q04$1@utils.eclipse.org)

> To see an example you can take a look on
> org.eclipse.gmf.graphdef.editor.edit.parts.RectangleEditPart from
> org.eclipse.gmf.graphdef.editor plugin. An idea is: all the position
> information will be propagated from domain model element to the
> corresponding notation element on activating an EditPart
I managed to reuse the code from RectangleEditPart in my xxxEditParts.
At first I thought it all works fine, but that was only the fact when I
only got one or two editParts in the diagram. As soon as I got a
connection between those EditParts or a third EditPart of the same Type
as one of the first two EditParts, the nodes were only displayed in
defaultLayout (the connected EditParts in one column, the not connected
EditPart adjacent to this column on the right or left /or/ all EditParts
lined up in a horizontal line(wo connection)).
The manual set Layoutpoints are still set in the properties, but this
layout is not displayed.

Any idea how to deactivate the default-layout or why this happens if I
got more modes than two?
If you need more information for an answer please let me know!

Thanks for the help by now
Alex
Re: take over coordinates from model into the diagram of the GMF editor? [message #60592 is a reply to message #60581] Mon, 09 October 2006 08:06 Go to previous messageGo to next message
Eclipse UserFriend
Hello Alex,

So, AFAIU, nodes “jumps” on the diagram after creation of additional diagram
element (node or link). Can you please check that corresponding positions
are saved correctly into the diagram file before it?

-----------------
Alex Shatalin
Re: take over coordinates from model into the diagram of the GMF editor? [message #60600 is a reply to message #60592] Mon, 09 October 2006 10:29 Go to previous message
Eclipse UserFriend
Hi Alex,

The nodes don't jump on the diagram after creation. Creation of nodes
seems to be no problem at all. The Layoutpoints are all saved correctly
to the modelfile via the handleNotification-method (@see thread 'Copy
GMF diagram coordinates to model'). My problem is, that during
diagram-creation the nodes loose their layout somehow.

By now I think I managed to isolate the problem to the
refreshSemantic()-method in SequenceTypeCanonicalEditPolicy, where the
created views get an initial Layout.
After removing this part of the method the user-defined layout seems to
be accepted. By now I don't know id removing the following section* has
any other bad influence on what I'm doing later on.

---*
//if (createdViews.size() > 1) {
// // perform a layout of the container
// DeferredLayoutCommand layoutCmd = new
DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
// executeCommand(new ICommandProxy(layoutCmd));
//}
---*
Well, time will tell.

Many thanks by now for your excellent help and for all hint you gave me
to point me to the right solution!

Bye Alex
Previous Topic:Drag & drop into container
Next Topic:Regenerate gmfmap?
Goto Forum:
  


Current Time: Sun May 11 13:25:02 EDT 2025

Powered by FUDForum. Page generated in 0.03572 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top