Using a custom figure for a container [message #482867] |
Fri, 28 August 2009 11:46 |
Eclipse User |
|
|
|
Originally posted by: cedric.moonen.fmtc.be
Hello,
I need to be able to create a diagram node which will contain two
compartments. These two compartments should use a custom figure to render
themselves (two different custom figures).
So, I created two "Figure Descriptor" (one for each compartment) in the
gmfgraph file. They both have a child "Custom Figure" which indicates my
custom figure.
I then created two new compartments under the Canvas and set the "Figure"
property to the correct "Figure Descriptor" that I just created.
In the gmfmap file, I create a "Top Node Reference" and add two
compartment mappings with the "Compartment" property set to the correct
compartment of my gmfgraph.
The problem is that the generated code doesn't use my custom figures for
the compartments: when I run the application, my node contains two
compartments which behave as expected for the addition of children but
they are just the default rectangles. Looking at the generated code I also
realized that my two custom figures are never used (I searched for the
class name and it is not use anywhere in the generated code).
Is this a bug, or I am misunderstanding the concept of compartments ?
Thanks
Cédric
|
|
|
Re: Using a custom figure for a compatment [message #482920 is a reply to message #482867] |
Fri, 28 August 2009 14:30 |
Eclipse User |
|
|
|
Originally posted by: cedric.moonen.fmtc.be
After searching for a while, I realized that maybe my approach using
compartments is maybe not the most adapted one.
Let me try to explain my problem from a higher point of view:
I need to have a top node figure containing two other figures (not diagram
nodes at this level). Those two figures are custom figures. The user will
be able to create children diagram nodes in both of these figures (or
compartment).
I was able to have two compartments in which I can add the children nodes
but the compartments are standard compartments and I really need to draw
the compartment myself using a custom figure (and using a particular
layout manager inside the compartment).
Is there a different way to do that than using compartments ?
Thanks
Cédric
|
|
|
|
Re: Using a custom figure for a compatment [message #483093 is a reply to message #482924] |
Mon, 31 August 2009 06:50 |
Eclipse User |
|
|
|
Originally posted by: cedric.moonen.fmtc.be
Hello Artur,
Thanks for your reply. Unfortunately I'm very new to GMF and I didn't
really understand your reply. I'm having trouble with the part "You can
mark that one as a compartment". I didn't find anything like the ability
to specify that a figure is a compartment. The only thing that comes close
is to create a compartment node and specify a figure in the "Figure"
property. But then, as explained in my first message, the figure seems to
be unused and the default compartment is used instead.
Thanks
Cédric
|
|
|
|
Re: Using a custom figure for a container [message #483157 is a reply to message #483145] |
Mon, 31 August 2009 12:07 |
Cedric Moonen Messages: 274 Registered: August 2009 |
Senior Member |
|
|
Hello Alex,
Thanks for your reply. However, I can't get to a working solution. Let me first re-explain what I'm trying to do by showing you an image.
You can see that my top-level node is made of three "areas":
- a header in which some custom drawing will be made
- a main compartment in which I have a column with some text and custom drawing and a part where children are added
- a secondary compartment which contain a column and only one child
I really need to have full control of my layout and sizing, so I don't want any scroll bar from the compartment.
If I try to follow your advice, here iswhat I have for the structure in the gmfgraph:
- Canvas
- Figure Gallery
- Figure Descriptor MainFigure
- Custom Figure MainFigure
- Custom Figure MainCompartment
- Rectangle CompartmentPlaceholder
- Figure Descriptor MainCompartment
- Figure Ref (Points to the CompartmentPlaceholder)
- Compartment (Points to the Figure Descr of the compartment).
To simplify the example and trying to find a solution, I deliberately ignored the secondary compartment.
It doesn't work as expected (well, as I was expecting ) because if I debug, I see that my top-level node is created correctly but if I look at its children, it has the custom figure for my compartment as direct child (which is fine) and a ShapeCompartmentFigure (which is not fine). The custom figure has a height of 0 (so, it is not visible) and whenever I am adding children, they are added to the ShapeCompartmentFigure and I want them to be children of my custom figure.
In fact, I am using compartments only because it seems to be the only way to be able to add children in two different areas of my figure.
If I would be able to use figures and to specify that some children have to be contained in a figure, this would probably be a better solution.
Do you have any idea how I can end-up with something like that ? Or do you think this is impossible ?
Thanks
Cédric
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04223 seconds