Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Use image in FigureDescriptor
Use image in FigureDescriptor [message #481662] Sat, 22 August 2009 13:12 Go to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

I want to know if it is now possible to use image in FigureDescriptor.

I saw this bug that I hink is the one whoch talk about it :
http://bugs.eclipse.org/131910
It was targeted to 2.2 but it is not set as resolved, so is it really in
2.2? And if yes, how can we use it? I don't see it.

A workaround to do it seems to extend the XXXEditPart... The
YYYFigureDescriptor which is declared in XXXEditPart.
I refer to this newsgroup thread :
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg18904.html

The problem is that the YYYFigureDescriptor.createContents method is
private. As I want to not use @Genrated NOT tag. I would extend this but
it is a little heavy with the private method.

So are they better way to do it? Is the support for Image already exist?
planned? hard to add it?

Aurelien Pupier


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: Use image in FigureDescriptor [message #481868 is a reply to message #481662] Mon, 24 August 2009 15:30 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Aurelien,

Bugsilla request is still open, so corresponding functionality was not implemented.
As a workarounf you can use custom figure in .gmfgraph model and initialize
proper ImageFigure from this custom class or you can use SVGFigure (is in
GMF since 2.2).

-----------------
Alex Shatalin
Re: Use image in FigureDescriptor [message #482582 is a reply to message #481868] Thu, 27 August 2009 07:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aurelien.pupier.esial.net

Hi,

as I don't want to modifiy generated code I will use the SVGFigure.
It works for me if I declare it just under the FigureDescriptor.
But I can't include it in a more complex FigureDescriptor. (For instance, I want to set a label beside it)

The Eclipse documentation and Eclipse wiki are not enough for me to understand.
http://wiki.eclipse.org/GMFGraph_Hints#SVG
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .gmf.doc/reference/api/tooling/org/eclipse/gmf/gmfgraph/SVGF igure.html

Which are the "SVG propertie" that can be used?

"SVGFigure does not inherit colors from it's parent figure. You must specify setBackgroundColor and setForegroundColor properties and you must set colors directly to SVGFigure."
What are they? How to specify them?

Is there examples somewhere? open source project that already used that?

Thanks for any help

Aurelien Pupier

Alex Shatalin a écrit :
> Hello Aurelien,
>
> Bugsilla request is still open, so corresponding functionality was not
> implemented.
> As a workarounf you can use custom figure in .gmfgraph model and
> initialize proper ImageFigure from this custom class or you can use
> SVGFigure (is in GMF since 2.2).
>
> -----------------
> Alex Shatalin
>
>
Re: Use image in FigureDescriptor [message #482615 is a reply to message #482582] Thu, 27 August 2009 09:50 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Aurelien,

> as I don't want to modifiy generated code I will use the SVGFigure.
Using custom figure does not mean modify generatedd code - you just need
to create separate Figure implementation and refer to this class using fully
qualified name from .gmfgraph model.

> But I can't include it in a more complex FigureDescriptor. (For
> instance, I want to set a label beside it)
Use StackLayout to overlap SVG figure with other figures and place Label
upon it.

> "SVGFigure does not inherit colors from it's parent figure. You must
> specify setBackgroundColor and setForegroundColor properties and you
> must set colors directly to SVGFigure."
>
> What are they? How to specify them?
in .gmfgraph model you can select SVG figure and you'll see these properties
in properties view.

-----------------
Alex Shatalin
Re: Use image in FigureDescriptor [message #483239 is a reply to message #482615] Mon, 31 August 2009 17:31 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

I can use SVGFigure as direct child of Figure Descriptor and if that FigureDescriptor is directly use by a Node.

But I encountered some difficulties to use it inside other figure...

What I want :
a rectangle with two colums : one with a label, one with a SVGFigure

So I tried several configurations, the only way to have something near the result is :
Figure descriptor
+-Rectangle
+-gridLayout 2
+-Label
+-Rectangle
+-StackLayout
+-Label <===== this label contains a long string of space
+-SVGFigure

In fact the SVG Figure is paint above the label hich contains only white spaces...

If I don't use this label, this exception is thrown :
Caused by: java.lang.IllegalArgumentException: 0.0 incompatible with org.apache.batik.transcoder.keys.LengthKey@f1cdfb
at org.apache.batik.transcoder.TranscodingHints.put(Unknown Source)
at org.apache.batik.transcoder.TranscoderSupport.addTranscoding Hint(Unknown Source)
at org.eclipse.gmf.internal.runtime.lite.svg.SimpleImageTransco der.updateImage(SimpleImageTranscoder.java:127)
at org.eclipse.gmf.internal.runtime.lite.svg.SimpleImageTransco der.getBufferedImage(SimpleImageTranscoder.java:175)
at org.eclipse.gmf.runtime.lite.svg.SVGFigure.paintFigure(SVGFi gure.java:155)
at org.eclipse.draw2d.Figure.paint(Figure.java:1049)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1087)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1119)
at org.eclipse.draw2d.ScalableFreeformLayeredPane.paintClientAr ea(ScalableFreeformLayeredPane.java:61)
at org.eclipse.gmf.runtime.draw2d.ui.internal.graphics.Scalable FreeformLayeredPane.paintClientArea(ScalableFreeformLayeredP ane.java:82)
at org.eclipse.draw2d.Figure.paint(Figure.java:1051)
at org.eclipse.gmf.runtime.draw2d.ui.internal.parts.ThumbnailEx $ThumbnailUpdater.run(ThumbnailEx.java:160)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:134)


This exception is also thrown when I try to replace the blank label with a rectangle with a minimum size.

Use the label with spaces :
- is ugly
- make difficult to have the right size if the SVGFigure
- and it seems sure that there is an other solution and that I make something wrong

So what is the right way?

Thanks for help

Aurelien Pupier


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: Use image in FigureDescriptor [message #483371 is a reply to message #483239] Tue, 01 September 2009 11:41 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Aurélien,

The right way is to use SVG figure just like a normal (but not resizable)
one..
So, if you cannot create a layout and put SVG figure in one of it's cells
then this is a bug.
BTW, are you specifying proper layout constraints for this SVG figure if
you place it in grid layout?

-----------------
Alex Shatalin
Re: Use image in FigureDescriptor [message #483460 is a reply to message #483371] Tue, 01 September 2009 16:43 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

ok thanks, it was an issue with layout data.

The solution :
Figure descriptor
.+-Rectangle
....+-gridLayout 2
....+-Label
....+-SVGFigure
........+-GridlayoutData <=== with FILL as alignment


The SVGFigure can't get his own place, you need to set a layout data to get the place and then the SVGFigure can be drawn inside.

I think that more explanations will be useful, it was not my first thought to use layout data.
BTW I think that there is also a lack of documentation with SVGProperty. I looked into gmfgraph.ecore directly but it is still not understandable for me. There are also the parameters "no canvas height" and "no canvas width" with no description.
Perhaps these properrties are more relative to SVG or draw2d or something else than GMF but a link to this documentation will be really helpful.

Effectively, the SVG Figure is not really resizable. I can only enlarge it but not make it smaller...
Is that something which will be hard to implement? Where can we modify this behavior?

And one more time,
really thanks Alex

Aurelien Pupier


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team

[Updated on: Tue, 01 September 2009 16:46]

Report message to a moderator

Re: Use image in FigureDescriptor [message #483819 is a reply to message #483460] Thu, 03 September 2009 08:28 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Aurélien,


> Is that something which will be hard to implement? Where can we modify
> this behavior?
I suppose so. I'm not an author of SVG figure, but I think it's not easy
to cat a part of the figure to squeeze it into the less size rectangle..
You can always subclass SVG figure and modify it.

-----------------
Alex Shatalin
Previous Topic:Using a custom figure for a container
Next Topic:Shortcuts working but not drag-drop
Goto Forum:
  


Current Time: Sun Sep 22 09:16:30 GMT 2024

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

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

Back to the top