Zest custom figures [message #243252] |
Thu, 29 May 2008 10:44  |
Eclipse User |
|
|
|
I'm working on, essentially, displaying a flowchart using Zest. I would,
of course, like to create custom figures for some of the nodes. Nothing
fancy, just diamonds and ovals to start. Unfortunately Bug 201960
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=201960> removed support
for custom figures and says "... the client is expected to subclass the
node if they wish to add a figure. The UML Example shows how this can be
done."
There's a Draw2d UML example, but it says nothing about Zest. The Zest
Snippets have nothing about UML or custom figures. There's an
org.eclipse.zest.examples.uml directory in the CVS repository, but it's
empty (as are all the other examples.* folders).
http://www.eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2 d.html
http://www.eclipse.org/mylyn/sandbox/zest/zest_snippets.php
My solution is to subclass GraphNode and override createFigureForModel()
to use a new class. I noted that GraphNode#updateFigureForModel() skips
a lot of good stuff if the figure doesn't subclass GraphLabel. Since I'd
like to use as much of the existing work in Zest as possible, the new
class derives from GraphLabel; I overrode paint() and
adjustBoundsToFit() to draw the new shape and return its new size. Since
GraphLabel is an internal class, I had to modify the Zest core JAR's
MANIFEST.MF to export internal.*. (Yes, ew.)
I doubt this is the most elegant solution. Please let me know if I'm
missing something. I'm quite new to Eclipse and Zest, so that's totally
(hopefully?) possible.
I'm using Zest/Draw2d 3.4.0 RC2, but there doesn't seem to be anything
new since the Jan 15 release. I checked out the source from CVS, in
hopes of getting any updates. I don't see any difference between the
HEAD and the Jan 15 source. Is that correct or am I doing something wrong?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.26931 seconds