Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsTransient (run time only) graphics in Graphiti?
https://www.eclipse.org/forums/index.php/mv/msg/239130/723523/#msg_723523
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?
]]>Hernan Gonzalez2011-09-08T18:18:40-00:00Re: Transient (run time only) graphics in Graphiti?
https://www.eclipse.org/forums/index.php/mv/msg/239130/723530/#msg_723530
I have not seen any option to draw anything outside the Diagram hierarchy, nor do I think this is a good idea. I can think of two ways of achieving what you need:
You could try to get a handle on the Graphiti save() and remove the unwanted shapes before saving. Note however, that the shapes will then dissappear from the open diagram as well (if this is kept open).
Alternatively, you can save the shapes with an additional self-defined property and remove these shapes when the diagram is read from file.
Jos]]>Jos Warmer2011-09-08T18:30:29-00:00Re: Transient (run time only) graphics in Graphiti?
https://www.eclipse.org/forums/index.php/mv/msg/239130/723544/#msg_723544
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).
]]>Hernan Gonzalez2011-09-08T18:56:58-00:00(no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/723747/#msg_723747
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.
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).]]>Michael Wenz2011-09-09T10:48:52-00:00Re: (no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/725549/#msg_725549
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.
Hope it helps.
Best Regards,
Murthy]]>Murthy Bhat2011-09-15T06:55:22-00:00Re: (no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/725635/#msg_725635
Murthybhat wrote on Thu, 15 September 2011 03:55
Hi,
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).
]]>Hernan Gonzalez2011-09-15T11:50:06-00:00Re: (no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/725698/#msg_725698
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.]]>Hernan Gonzalez2011-09-15T14:38:49-00:00Re: (no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/725868/#msg_725868
Not much success with the connection thing yet. Still trying to get it working. But other things are working as expected. And yes, i store a list of points in my model.
Regards,
Murthy]]>Murthy Bhat2011-09-16T02:57:00-00:00Re: (no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/726168/#msg_726168
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.
]]>Hernan Gonzalez2011-09-16T17:29:14-00:00Re: (no subject)
https://www.eclipse.org/forums/index.php/mv/msg/239130/727029/#msg_727029
Would you file an enhancement bugzilla?
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.]]>Michael Wenz2011-09-20T08:22:25-00:00