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 07:41  |
Eclipse User |
|
|
|
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 10:41   |
Eclipse User |
|
|
|
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 09:55  |
Eclipse User |
|
|
|
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 Apr 30 23:02:17 EDT 2025
Powered by FUDForum. Page generated in 0.05885 seconds
|