Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gef-dev] Connection not touching figure.


You shouldn't need to use multiple figures to render an Icon+Text.  Label does this.  Then, you can override the getBox() method in chopbox anchor to return the icon's box.

But, avoiding the text makes me think this should be a special type of anchor.  You need chopboxes, with two separate rectangles.



"Brian Fernandes" <brian.fernandes@xxxxxxxxxxxx>
Sent by: gef-dev-admin@xxxxxxxxxxx

01/14/2005 01:05 PM

Please respond to
gef-dev

To
<gef-dev@xxxxxxxxxxx>
cc
Subject
Re: [gef-dev] Connection not touching figure.





Fergal's answer made me rethink...

The simplest solution, if normal chopbox functionality is good enough for
you -  is to simply pass the correct figure (your inner rectangle) to the
ChopboxAnchor constructor :) in your implementation of
NodeEditPart#getSource/TargetConnectionAnchor.

Usually you create the ChopboxAnchor like so

new ChopboxAnchor(getFigure())

But you can use something like

new ChopboxAnchor(getFigure().getChildren().get(0))  //or whatever index
your inner rectangle is in your custom figure.

Sorry for not thinking straight the first time.

Brian.



----- Original Message -----
From: "Fergal Somers" <fsomers@xxxxxxxxxxxxx>
To: <gef-dev@xxxxxxxxxxx>
Sent: Friday, January 14, 2005 11:18 PM
Subject: Re: [gef-dev] Connection not touching figure.


> You need to connect the connection to the inner figure.
>
> One way to do this is to create your own Anchor type (try sub-classing
> ChopBoxAnchor). Override the getLocation method to connect to the bounds
> of the inner figure (the figure is passed as part of the constructor).
> The getLocation method just allows you to specify the point at which
> the connection is attached to your figure.
>
> You may also want to control how it connects, for example only left, top
> or right connections, but not bottom or it will obscure the text.
>
> Fergal.
>
> Michael MacFadden wrote:
>
>> All,
>>
>> I am having a small but painful problem with GEF.  I have created some
>> custom figures.  One of them has an icon with some text below it.  Looks
>> something like this
>>
>>       _____
>>      |          |
>>      |_____|
>> Some Text Here
>>
>> The bounds of the figure is a rectangle around the whole thing,
>> encompassing the icon and the text label.  The problem is when I have a
>> connection attach to the figure that is coming off the left or right of
>> the object the connection stops at the rectangular bounds of the object.
>> I would like the arrow to be drawn all the way to where it actually hits
>> some part of the figure that is actually being drawn.  I guess I should
>> mention that for selection purposes I need to keep the bounds a rectangle
>> around the whole object.  Any ideas on how I would do this?  Thanks.
>>
>> Mike
>>
>
> _______________________________________________
> gef-dev mailing list
> gef-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/gef-dev
>


_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/gef-dev


Back to the top