Skip to main content



      Home
Home » Eclipse Projects » GEF » Strange rendering order problem
Strange rendering order problem [message #241816] Tue, 18 March 2008 05:00 Go to next message
Eclipse UserFriend
Hi all!
I have a strange rendering order problem which I can't solve.

I have two edit parts. Parent edit part returns model objects for child
edit parts in getModelChildren() method.

Simplified code here:

****************************
Parent edit part

protected IFigure createFigure() {
RectangleFigure parentRectangle = new RectangleFigure();

parentRectangle.setOutline(false);
parentRectangle.setFill(false);

parentRectangle.addMouseListener(new MouseListener(){
...
});

anotherParentRectangle = new RectangleFigure();
parentRectangle.add(anotherParentRectangle);
anotherParentRectangle.setFill(false);

return parentRectangle;
}



Child edit part

protected IFigure createFigure() {

RectangleFigure childRectangle = new RectangleFigure();
childRectangle.setOutline(false);
childRectangle.setFill(false);

childImage = new ImageFigure( ...);
childRectangle.add(childImage);

return childRectangle;
}

****************************

Strangely the z-order of these figures end up to be (from top to bottom):

anotherParentRectangle (ParentEditPart)
childImage (ChildEditPart)
childRectangle (ChildEditPart)
parentRectangle (ParentEditPart)



I don't know why this happens. I thought child edit part's figures are
always drawn top of the parent edit part's figures. In general it seems
work just fine. I don't know why in this case the order is different.
Any ideas what might cause this or how I can fix it?

Thanks!

-Pasi
Re: Strange rendering order problem [message #241827 is a reply to message #241816] Tue, 18 March 2008 11:35 Go to previous message
Eclipse UserFriend
Hi,
Seems you should provide a contentpane figure.
Override the part's getContentPane method, provide anotherparentrect to it.

BTW, the Figure's paint method source code may help you.

Regards,
Qinxian

Pasi Lehtimaki 写道:
> Hi all!
> I have a strange rendering order problem which I can't solve.
>
> I have two edit parts. Parent edit part returns model objects for child
> edit parts in getModelChildren() method.
>
> Simplified code here:
>
> ****************************
> Parent edit part
>
> protected IFigure createFigure() {
> RectangleFigure parentRectangle = new RectangleFigure();
>
> parentRectangle.setOutline(false);
> parentRectangle.setFill(false);
>
> parentRectangle.addMouseListener(new MouseListener(){
> ...
> });
>
> anotherParentRectangle = new RectangleFigure();
> parentRectangle.add(anotherParentRectangle);
> anotherParentRectangle.setFill(false);
>
> return parentRectangle;
> }
>
>
>
> Child edit part
>
> protected IFigure createFigure() {
>
> RectangleFigure childRectangle = new RectangleFigure();
> childRectangle.setOutline(false);
> childRectangle.setFill(false);
>
> childImage = new ImageFigure( ...);
> childRectangle.add(childImage);
>
> return childRectangle;
> }
>
> ****************************
>
> Strangely the z-order of these figures end up to be (from top to bottom):
>
> anotherParentRectangle (ParentEditPart)
> childImage (ChildEditPart)
> childRectangle (ChildEditPart)
> parentRectangle (ParentEditPart)
>
>
>
> I don't know why this happens. I thought child edit part's figures are
> always drawn top of the parent edit part's figures. In general it seems
> work just fine. I don't know why in this case the order is different.
> Any ideas what might cause this or how I can fix it?
>
> Thanks!
>
> -Pasi
Previous Topic:removing all children of a IFigure
Next Topic:[Announce] GEF 3.4.0 I200803111830 is available
Goto Forum:
  


Current Time: Sat Jul 19 14:40:25 EDT 2025

Powered by FUDForum. Page generated in 0.03866 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top