>>>> Changing the Achors of a custom shape <<<< [message #94357] |
Fri, 19 January 2007 03:16  |
Eclipse User |
|
|
|
Originally posted by: martin.tauber.t-online.de
Hi Team, I have postet this about two weeks ago, but I didn't get any
responce. Since I think this is a very fundamental question I am really
supriced that nobody has an answer to it. Where are the experts?
Thanks
Here is what I asked:
Hi Virtual Team,
I am trying to create a gmf application using custom figures. I managed
to create the models and the code for the figures and the diagram. But
now the connections seam to snap to the edges of the box where I paint
my custom figure. But this is not what I want. I am creating for example
a diamand and I only want the connection to snap to the edges of the
diamond.
How do I do that?
Thanks
Martin
|
|
|
|
|
|
|
|
Re: >>>> Changing the Achors of a custom shape <<<< [message #94547 is a reply to message #94487] |
Fri, 19 January 2007 09:38   |
Eclipse User |
|
|
|
Originally posted by: martin.tauber.t-online.de
Cherie,
thanks, this is nearly what I want, except that I don't want the
connection to slide around the edges of the diamond. I want them to
stick to the corner of the the diamond. So only exactly four points are
sources of targets for the connection.
To solve the problem, I remembered my first gef steps (on which gmf
actually builds) So there the EditPart implements the Node<whatever>
interface with the following methods:
getSourceConnection(Request)
getSourceConnectionAnchor(ConnectionEditPart)
getTargetConnection(Request)
getTargetConnectionAnchor(ConnectionEditPart)
Where the ...Source... methods are responsible for returning a source
anchor and the ...Target... methods are responsible for handling the
target connections (surprice surprice). The methods handling the Request
parameter are used before the connection is established during the
create connection request. The ConnectionEditPart method is used when
the request is actually completed.
Well so far so good. I am able to overright the "Request" methods, which
delivers expected results during the creation request of the
connection. The connection snaps to the edge of the diamand.
Now when I establish the connection, the
getSourceConnectionAnchor(ConnectionEditPart) is never called and the
result is still the same, the connection snaps to the squared border
edges of the bounds of the shape. :(
Any Ideas?
I will now test your idea implementing the IPolygonAnchorableFigure or
maybe I'll find something simular....
Regards
Martin
Cherie Revells schrieb:
> Martin,
>
> Are you looking for behavior like in the Geoshapes Example? If you
> create a diamond with a line, you can drag the connection anchor around
> so it connects to the border of the diamond.
>
> If this is the behavior you want, the BaseSlidableAnchor is responsible
> for this behavior. All you should have to do is have your figure
> implement IPolygonAnchorableFigure and return the polygon points that
> make up your diamond.
>
> Regards,
> Cherie
>
> Alex Shatalin wrote:
>> Hello Martin,
>>
>>> don't want to decorate the connection. I want my custom figure to have
>>> custom anchors where the connections can snap on to.
>> Yes, this is another case and it is not covered by Ecore sample. Are you
>> going to have something like ports in UML?
>>
>> -----------------
>> Alex Shatalin
>>
>>
|
|
|
Re: >>>> Changing the Achors of a custom shape <<<< [message #94573 is a reply to message #94487] |
Fri, 19 January 2007 10:35   |
Eclipse User |
|
|
|
Originally posted by: martin.tauber.t-online.de
Hm - why is there no documentation on a fudamantal subject like this?
I now have tested the IAnchorableFigure interface. My figures extends
NodeFigure and overrights the appropriate methods. Well but suprice
surprice, still nothing happens. I would have been surpriced, since even
though I implemented this interface, someone has to know that it is
implemented to call it. Do I still have to configure something?
Thanks
Martin
Cherie Revells schrieb:
> Martin,
>
> Are you looking for behavior like in the Geoshapes Example? If you
> create a diamond with a line, you can drag the connection anchor around
> so it connects to the border of the diamond.
>
> If this is the behavior you want, the BaseSlidableAnchor is responsible
> for this behavior. All you should have to do is have your figure
> implement IPolygonAnchorableFigure and return the polygon points that
> make up your diamond.
>
> Regards,
> Cherie
>
> Alex Shatalin wrote:
>> Hello Martin,
>>
>>> don't want to decorate the connection. I want my custom figure to have
>>> custom anchors where the connections can snap on to.
>> Yes, this is another case and it is not covered by Ecore sample. Are you
>> going to have something like ports in UML?
>>
>> -----------------
>> Alex Shatalin
>>
>>
|
|
|
|
|
|
Re: >>>> Changing the Achors of a custom shape <<<< [message #95307 is a reply to message #94779] |
Mon, 22 January 2007 15:34  |
Eclipse User |
|
|
|
Originally posted by: skannoor.xyz.xyz
Hello martin,
NodeFigure.getSourceConnectionAnchorAt() is called from
DefaultSizeNodeFigure, because in the figure's EditPart code(generated
code from gmf model) there is method : "protected NodeFigure
createNodePlate()" it returns "DefaultSizeNodeFigure" by default. Where
as the custom figure is return from "createNodeShape()" method. If you
override createNodePlate() method and return your custom figure. Then you
can access getSourceconnectionAnchorAt from you custom figure code.
One more thing, try to override getTargetConnectionAnchor and
getSourceConnectionAnchor of your CustomFigure's editPart will be easier
to set connectionAnchor at any place of shape.
|
|
|
Powered by
FUDForum. Page generated in 0.07076 seconds