Home » Modeling » Graphiti » Transient (run time only) graphics in Graphiti?
Transient (run time only) graphics in Graphiti? [message #723523] |
Thu, 08 September 2011 18:18 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
In Graphiti all drawing (from the programmer point of view) corresponds to a Graphic Algorithm, to be included (and persisted) in a Diagram and in some business object: any color, polygon, line, etc "lives in the diagram universe".
Suppose that I want to add some runtime graphical behaviour to my editor, so that some events produce some graphical output (perhaps changing the color of a Shape, perhaps drawing some arrow, circle, etc not necessarily tied to any shape), so that this is NOT linked to my Pictogram hierarchy and my business objects (in particular, this is not to be persisted, it only makes sense inside the running ide.)
(I believe this would be similar to what the editor does, eg when drawing a connection with different color/style while creating it: this style/color does not live in the "diagram universe")
Is there some standard approach to do this, or some example to get ideas?
I understand that Graphiti hides GEF, and won't happily let me touch it directly. Would this also apply to Draw2D?
|
|
| |
Re: Transient (run time only) graphics in Graphiti? [message #723544 is a reply to message #723530] |
Thu, 08 September 2011 18:56 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
Jos Warmer wrote on Thu, 08 September 2011 15:30
I have not seen any option to draw anything outside the Diagram hierarchy, nor do I think this is a good idea.
Thanks, but what I'm pointing out is rather to draw directtly using Draw2D. For example, when I click a shape in the editor, a dashed line appears around it. I guess (I may be wrong) that this dashed line is not part of the shape, (when this line appears visually and disappears, it does not hit the pictogram hierachy), this line does not live in the Diagram but rather in other layer, in the editor itself (indeed, it's not persisted).
|
|
|
(no subject) [message #723747 is a reply to message #723544] |
Fri, 09 September 2011 10:48 |
Michael Wenz Messages: 1931 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
There's a hook for visualizing the selection state or hoven-state
differently. There's methods in the DiagramTypeProvider to influence that; I
would need to look up the names...
But these hooks are not capable of influencing the standard visualization.
So, I don't have a really good idea beyond what Jos already proposed.
Michael
"Hernan" schrieb im Newsbeitrag news:j4b2gl$gjl$1@news.eclipse.org...
Jos Warmer wrote on Thu, 08 September 2011 15:30
> I have not seen any option to draw anything outside the Diagram hierarchy,
> nor do I think this is a good idea.
Thanks, but what I'm pointing out is rather to draw directtly using Draw2D.
For example, when I click a shape in the editor, a dashed line appears
around it. I guess (I may be wrong) that this dashed line is not part of the
shape, (when this line appears visually and disappears, it does not hit the
pictogram hierachy), this line does not live in the Diagram but rather in
other layer, in the editor itself (indeed, it's not persisted).
|
|
| |
Re: (no subject) [message #725635 is a reply to message #725549] |
Thu, 15 September 2011 11:50 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
Murthybhat wrote on Thu, 15 September 2011 03:55Hi,
I have a small working solution for a similar case. My scenario had a emf based domain model which can have basic information on the diagram model like <x,y,width,height & color>. I have attached a parser to my specific file extension using the extension "org.eclipse.emf.ecore.extension_parser".
So whenever the resourceset is created/loaded with my domain model, I manually create a parallel resource with the graphical model within the resourceset. After linking the diagram model with the resource, it works like any other graphiti editor. While saving, however i ensure that i only save the domain related information with updated graphical properties.
Not exactly what I was looking for here, but interesting nonetheless, and related to other issues I've been experiencing and I've been thinking. My scenario is very near this one: the persistent graphic information is (almost) implicitly contained in the domain model, so it's actually redundant to save the diagram: it would be enough to save the model and to recreate the diagram elements at loading (invoking the Add features). I still didnt' implement it in this way, because it makes little difference for me (apart from file size; I doubt if would make a speed difference, to load the diagram as a xml file or to recreate it with the Add features). However, perhaps I end taking that path, it makes more sense (for example, I don't really like to store some graphical details as Font, colors, etc; it should be the software -which could change- who decides that)
I know that Graphiti is designed to support a non redundant scenario (the diagram have more information: eg, position and size, connections shapes; and also the diagram could represent a partial view of the model; eg a partial UML graph). But perhaps this scenario should also be considered (at least as an item in the FAQ/HOwto).
[Updated on: Thu, 15 September 2011 14:36] Report message to a moderator
|
|
|
Re: (no subject) [message #725698 is a reply to message #725635] |
Thu, 15 September 2011 14:38 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
@Murthybhat: I see now that you have several posts dealing with this kind of approach (ej1 ej2). I guess you managed to solve your issues? (in particular, the creation of connections; are you storing the bendpoints inside your model?)
I really think that this "transient diagram" approach should be (as a recipe or list of tips) in the docs or a wiki. I seems to put a new perspective on Graphiti.
[Updated on: Thu, 15 September 2011 14:39] Report message to a moderator
|
|
| |
Re: (no subject) [message #726168 is a reply to message #723747] |
Fri, 16 September 2011 17:29 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
Michael Wenz wrote on Fri, 09 September 2011 07:48There's a hook for visualizing the selection state or hoven-state
differently. There's methods in the DiagramTypeProvider to influence that; I
would need to look up the names...
But these hooks are not capable of influencing the standard visualization.
So, I don't have a really good idea beyond what Jos already proposed.
Now I see that the behaviour I'm looking for (purely display modifier, only runtime, not living in the pictogram world) is more conceptually akin to a graphiti Decorator: what I'd like to have is some type of decorator that, instead of placing an image on top of the figure, draws a border, or change the background, etc.
|
|
|
Re: (no subject) [message #727029 is a reply to message #726168] |
Tue, 20 September 2011 08:22 |
Michael Wenz Messages: 1931 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
Currently we do not have something like that, but that sounds resonable.
Would you file an enhancement bugzilla?
Thanks,
Michael
"Hernan" schrieb im Newsbeitrag news:j500bo$dqv$1@news.eclipse.org...
Michael Wenz wrote on Fri, 09 September 2011 07:48
> There's a hook for visualizing the selection state or hoven-state
> differently. There's methods in the DiagramTypeProvider to influence that;
> I would need to look up the names...
>
> But these hooks are not capable of influencing the standard visualization.
> So, I don't have a really good idea beyond what Jos already proposed.
Now I see that the behaviour I'm looking for (purely display modifier, only
runtime, not living in the pictogram world) is more conceptually akin to a
graphiti Decorator: what I'd like to have is some type of decorator that,
instead of placing an image on top of the figure, draws a border, or change
the background, etc.
|
|
|
Goto Forum:
Current Time: Tue Sep 24 01:27:37 GMT 2024
Powered by FUDForum. Page generated in 0.04333 seconds
|