Home » Modeling » GMF (Graphical Modeling Framework) » How to create a rectangle-with-dog-ear figure? Gallery anywhere?
How to create a rectangle-with-dog-ear figure? Gallery anywhere? [message #70713] |
Fri, 27 October 2006 11:41 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Michael Moser![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mmo%40zurich.ibm.com) Messages: 914 Registered: July 2009 |
Senior Member |
|
|
What's an elegant way to create a figure like the ones used for notes
(the sheet with a dog-ear, i.e. a triangle bent down in the upper
right)? Is there a gallery or resource that one can import for that?
With "elegant" I also mean, that the figure should nicely resize,
provide a reflowing label, etc. etc,
I didn't find any such figure in the standard galleries
(platform:/plugin/org.eclipse.gmf.graphdef/models/basic.gmfg raph,
platform:/plugin/org.eclipse.gmf.graphdef/models/classDiagra m.gmfgraph,
platform:/plugin/org.eclipse.gmf.graphdef/models/stateDiagra m.gmfgraph),
but apparently it's around somewhere, since the created diagram plugins
all provide a "Note" palette entry.
Michael
|
|
|
Re: How to create a rectangle-with-dog-ear figure? Gallery anywhere? [message #70898 is a reply to message #70713] |
Fri, 27 October 2006 14:41 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Mohammed Mostafa![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mmostafa%40ca.ibm.com) Messages: 143 Registered: July 2009 |
Senior Member |
|
|
The figure used by notes is called NoteFigure it is public in the
plugin org.eclipse.gmf.runtime.diagram.ui. You can use it or subclass it
to do any customizations you need
The way to use change the figure created by the edit part is to change
the code in the your edit part's createFigure() method to create
NoteFigure or a sub class of it
Michael Moser wrote:
> What's an elegant way to create a figure like the ones used for notes
> (the sheet with a dog-ear, i.e. a triangle bent down in the upper
> right)? Is there a gallery or resource that one can import for that?
> With "elegant" I also mean, that the figure should nicely resize,
> provide a reflowing label, etc. etc,
>
> I didn't find any such figure in the standard galleries
> (platform:/plugin/org.eclipse.gmf.graphdef/models/basic.gmfg raph,
> platform:/plugin/org.eclipse.gmf.graphdef/models/classDiagra m.gmfgraph,
> platform:/plugin/org.eclipse.gmf.graphdef/models/stateDiagra m.gmfgraph),
> but apparently it's around somewhere, since the created diagram plugins
> all provide a "Note" palette entry.
>
> Michael
>
|
|
| | | |
Re: How to create a rectangle-with-dog-ear figure? Gallery anywhere? [message #71590 is a reply to message #71381] |
Mon, 30 October 2006 14:55 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Mohammed Mostafa![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mmostafa%40ca.ibm.com) Messages: 143 Registered: July 2009 |
Senior Member |
|
|
I've tried a very simple case with the generated code where i use the
note figure instead of the generated figure , and noticed that width and
height works as i expect. It respect the value i pass (as long as I just
drop the shape on the diagram surface, otherwise it will use the exact
rectangle i draw on the diagram surface)
this is the way i create my figure :
/**
* @generated Not
*/
protected IFigure createNodeShape() {
Insets insets = new Insets(getMapMode().DPtoLP(30),
getMapMode().DPtoLP(30), getMapMode().DPtoLP(30), getMapMode().DPtoLP(45));
primaryShape = new MyFigure(getMapMode().DPtoLP(300),
getMapMode().DPtoLP(400), insets);
return primaryShape;
}
i have not tried to add labels though ; (I'll try it when i have free time)
Michael Moser wrote:
> This NoteFigure has a life of its own! I have created a sub-class of
> NoteFigure:
>
> public MyNotesFigure extends NoteFigure {
> super(50, 75, new Insets(5,5,5,5));
> }
>
> but for some strange reason NoteFigure ignores the width and height
> parameters that I pass into the super-constructor. The figure is always
> displayed with a size of (I would estimate) 100x100. It also seems to
> ignore child items! I added a label to it and this label is not displayed.
>
> So, this internal figure seems not very useful for derivation of custom
> figures. Or has anybody else managed to extend this class properly?
>
> Michael
>
|
|
|
Goto Forum:
Current Time: Wed Jul 17 20:23:59 GMT 2024
Powered by FUDForum. Page generated in 0.04097 seconds
|