nullpointer
nullpointer

Reputation: 532

Ordering of nested figures in GEF by getChildren()

I have a figure with a ToolBar Layout. I have added a Label in it(Draw 2D).

I have to add another figure in it dynamically. But when I do add it, the Label moves down and the newly added figure comes at the top.

I have tried adding the label by add(IFigure, index) method, with 0 index but no use!

I noticed the getChilden() list has my label at the bottom. I can keep re-ordering the list, but I don't think its a good idea.

What can I do so that the newly added figures are always at the bottom?

I can't use any other layout than Toolbar layout.

Upvotes: 2

Views: 170

Answers (1)

vainolo
vainolo

Reputation: 6987

You should probably do add(figure, getChildren().length() which adds your figure to the end of the children list. The ToolbarLayour uses the list order to show the figures, so this should work. Doing add(figure, 0) puts your figure as the first one in the list, so the behavior you see is expected.

Upvotes: 1

Related Questions