Default GEF behavor; why figures are added where they are? [message #132157] |
Thu, 13 May 2004 21:21  |
Eclipse User |
|
|
|
Originally posted by: smallpocks.yahoo.com
Hey Guys,
I have a question about the default behavior of GEF. I may be wrong in my
assumptions so just let me know if I've got this all wrong but...
It seems to me that a normal EditPart's figure is added as a child to the
figure of its parent EditPart. On the other hand, a ConnectionEditPart's
figure gets added to the CONNECTION_LAYER of the root edit part. So I guess
my question is, why this difference in behavior? Wouldn't it still make a
lot of sense if every figure was added as a child to the parent figure? It's
frustrating me right now...
Thanks a lot.
Guy
|
|
|
|
Re: Default GEF behavor; why figures are added where they are? [message #132312 is a reply to message #132157] |
Sun, 16 May 2004 16:06  |
Eclipse User |
|
|
|
Originally posted by: rlemaigr.ulb.ac.be
Hi,
I'm not a specialist in gef and draw2d so my answer could contain mistak=
es =
and approximations.
In addition to what brian have said, there's also the fact that draw2d =
provides a special layer (ConnectionLayer) for connections. Connections =
=
added to that special layer share automaticaly the same connection route=
r =
(by default, I think), wich is the one define for the connection layer.
By putting all the Connections as children of the ConnectionLayer, the =
programmer can easily insure that all the connections "live" in the same=
=
plane, for example on top of everything else, and that Connections added=
=
to this layer share the same connection router. If you place the =
connection layer as the last child of the root figure, the connections =
will all be on top of everything else, if you place the connection layer=
=
as the first child of the root figure, the connections will all be below=
=
everything else.
Another thing that makes the use of such a layer necessary is that =
Connections can't live as children of a Figure with a layout manager, =
because I don't think calling setBounds() on a Connection is safe...mayb=
e =
it has no effect I don't know...but connections are not made to be handl=
ed =
by layout managers of their parent. So I think you must put them in a =
special layer with no layout manager associated.
That's why Gef adds all connections to the CONNECTION_LAYER wich is a =
ConnectionLayer.
Also remember that if a Figure A is a child of a Figure B, then the =
drawing of the Figure A is clipped by the bounding box of the Figure B a=
nd =
connections don't make exception to this rule. So adding a connection to=
=
one of its parent would result in clipping it by the bounding box of its=
=
parent, wich is certainly not the expected behaviour...
hope this will help you,
r=E9gis
On Thu, 13 May 2004 18:21:54 -0700, Guy Beckman <smallpocks@yahoo.com> =
wrote:
> Hey Guys,
> I have a question about the default behavior of GEF. I may be wrong in=
my
> assumptions so just let me know if I've got this all wrong but...
> It seems to me that a normal EditPart's figure is added as a child to =
the
> figure of its parent EditPart. On the other hand, a ConnectionEditPart=
's
> figure gets added to the CONNECTION_LAYER of the root edit part. So I =
=
> guess
> my question is, why this difference in behavior? Wouldn't it still mak=
e a
> lot of sense if every figure was added as a child to the parent figure=
? =
> It's
> frustrating me right now...
>
> Thanks a lot.
> Guy
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05462 seconds