Use image in FigureDescriptor [message #481662] |
Sat, 22 August 2009 13:12 |
|
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 #482582 is a reply to message #481868] |
Thu, 27 August 2009 07:21 |
Eclipse User |
|
|
|
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 #483239 is a reply to message #482615] |
Mon, 31 August 2009 17:31 |
|
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 #483460 is a reply to message #483371] |
Tue, 01 September 2009 16:43 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.04228 seconds