[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: When is Child Access needed in graphical definition?

Have a look at the attachment. This creates an image with a label below, inside a rectangle.

Swavek Lorenc schrieb:
Alex,

Thanks and let me ask another question.
Lets say I want to have a figure consisting of an icon and a label below it.
If I define the figure descriptor like this.

Figure Descriptor IconAndLabelFigureDescriptor
- Rectangle BoundingRectangleWithoutBorder
- FlowLayout true
- CustomFigure MyIconFigure - uses custom class extending ImageFigure

then also have Node definititions like so:

Node SomeNode (IconAndLabelFigureDescriptor)
Diagram Label SomeLabel

So in this case should I add the Child Access under Figure Descriptor for accessing the Rectangle BoundingRectangleWithoutBorder?

I got my figure to work without child access. I override 'add' method of my generated Rectangle derived class to force children to be added at the end (index = -1).

Otherwise the label would always appear above the icon. I think this is not the cleanest way though. Should I add something to the mapping model for the icon so it is added above the label?

Thanks,
Swavek

"Alex Shatalin" <vano@xxxxxxxxxxx> wrote in message news:3c3172e617f758c9c4d2f3c227c8@xxxxxxxxxxxxxxxxxxx
Hello Swavek,

ChildAccess should be used to create complex figure and expose some inner figure as a "content pane" for all the children. For exaple - you can create Node figure consisting of several rectangles, borders, .... but in this case you should be able to specify some inner figure in this figure hierarchy as a "content pane" to put all child figures there (compartments or direct children figures).

-----------------
Alex Shatalin





GIF image