[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Reparenting child figures to children from contentPane

ryanp wrote:
Thomas,

It might also be achieved by setting a SPECIAL layout
manager for FigureA. In the layout() method, dispatch
all children figures into sub panels.

Thanks a lot for your ideas, Ryan. However I have a feeling that using your first one does not work because I think that is basically the same I am doing right now: I "kidnap" some of the children and GEF seems to be "exceptionally surprised" that the number of *direct* children is less than it thinks:


I have skimmed some GEF methods and it seems to like to
keep the indices for models, editparts and figures
identical, so at


org.eclipse.gef.editparts.AbstractGraphicalEditPart.addChildVisual

there is

protected void addChildVisual(EditPart childEditPart, int
index) { IFigure child =
((GraphicalEditPart)childEditPart).getFigure();
getContentPane().add(child, index); }

which leads to the IndexOutOfBoundsException later on in
Figure.add(), because the children are "kidnapped" and
there are less than GEF supposes.

It seems to me GEF does not like it when reparenting
children this way.
Is there another way to achieve it?  From a user point of
view I would have thought (and actually did) that when
returning a figure from createFigure() that already has a
parent, that might be respected and a
new parent only set when it is null.  Thoughts?

Or does it matter when I reparent the children?

Thomas

--
Thomas Maier <Thomas.Maier@xxxxxxxxxxxxx>