Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » >>>> Changing the Achors of a custom shape <<<<
>>>> Changing the Achors of a custom shape <<<< [message #94357] Fri, 19 January 2007 08:16 Go to next message
Eclipse UserFriend
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 #94372 is a reply to message #94357] Fri, 19 January 2007 10:23 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

AFAIU connections you are trying to draw are pretty similar to the "containment
reference link" (aggregation link) for ECore diagram (link with filled diamond
decoration). If yes, you can take “org.eclipse.gmf.ecore.editor” as an example
- corresponding diagram contains such a connections. If you are going to
create these connection figures by hands you can at least take EReferenceEditPart.SolidLineWDstArrow
as a prototype of figure.

-----------------
Alex Shatalin
Re: >>>> Changing the Achors of a custom shape <<<< [message #94429 is a reply to message #94372] Fri, 19 January 2007 11:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.tauber.t-online.de

Hello Alex,

thanks for your responce! I think there is a misunderstanding here. I
don't want to decorate the connection. I want my custom figure to have
custom anchors where the connections can snap on to.

I have checked out the ecore diagram project, but I have no clue where
to start looking. It looks totaly different to the gmf projects that I
have created.

Am I right, that the changed have to be done in the edit parts? I tried
to overright the getTargetConnection() and getSourceConnection() methods
in my generated editpart. I just return null. But debugging shows that
these methods are actually never called.

Hm - any help here is appreciated.

Regards
Martin


Alex Shatalin schrieb:
> Hello Martin,
>
> AFAIU connections you are trying to draw are pretty similar to the
> "containment reference link" (aggregation link) for ECore diagram (link
> with filled diamond decoration). If yes, you can take
> “org.eclipse.gmf.ecore.editor” as an example - corresponding diagram
> contains such a connections. If you are going to create these connection
> figures by hands you can at least take
> EReferenceEditPart.SolidLineWDstArrow as a prototype of figure.
>
> -----------------
> Alex Shatalin
>
>
Re: >>>> Changing the Achors of a custom shape <<<< [message #94444 is a reply to message #94429] Fri, 19 January 2007 12:47 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
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 #94458 is a reply to message #94429] Fri, 19 January 2007 13:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: helmecke.pro-sign.de

Hello Martin,

perhaps we have the same problem. I look for a method to generate terminals
automatically.

Greetings Danny!

"Martin Tauber" <martin.tauber@t-online.de> schrieb im Newsbeitrag
news:eoqbl2$e6o$1@utils.eclipse.org...
> Hello Alex,
>
> thanks for your responce! I think there is a misunderstanding here. I
> don't want to decorate the connection. I want my custom figure to have
> custom anchors where the connections can snap on to.
>
> I have checked out the ecore diagram project, but I have no clue where
> to start looking. It looks totaly different to the gmf projects that I
> have created.
>
> Am I right, that the changed have to be done in the edit parts? I tried
> to overright the getTargetConnection() and getSourceConnection() methods
> in my generated editpart. I just return null. But debugging shows that
> these methods are actually never called.
>
> Hm - any help here is appreciated.
>
> Regards
> Martin
>
>
> Alex Shatalin schrieb:
>> Hello Martin,
>>
>> AFAIU connections you are trying to draw are pretty similar to the
>> "containment reference link" (aggregation link) for ECore diagram (link
>> with filled diamond decoration). If yes, you can take
>> "org.eclipse.gmf.ecore.editor" as an example - corresponding diagram
>> contains such a connections. If you are going to create these connection
>> figures by hands you can at least take
>> EReferenceEditPart.SolidLineWDstArrow as a prototype of figure.
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: >>>> Changing the Achors of a custom shape <<<< [message #94487 is a reply to message #94444] Fri, 19 January 2007 14:09 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
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 #94547 is a reply to message #94487] Fri, 19 January 2007 14:38 Go to previous messageGo to next message
Eclipse UserFriend
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 15:35 Go to previous messageGo to next message
Eclipse UserFriend
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 #94588 is a reply to message #94357] Fri, 19 January 2007 16:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.tauber.t-online.de

I'm getting frustrated here. Where is the point to set the anchors for a
figure? Is it the generated edit part or should I use the Interfaces
IPolygonAnchorableFigure or IAnchorableFigure of my figure?

WHERE CAN I FIND DOCUMENTATION REGRADING THIS????????????????

Regards
Martin



P.S. A powerful tool is useless without documentation!

Martin Tauber schrieb:
> 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 #94765 is a reply to message #94357] Sat, 20 January 2007 19:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.tauber.t-online.de

Hi everybody,

I'm still stuck here. I found the tutorial in the online help of eclipse
(BTW why is the online help not installed when gmf is installed via
the "Software Update" action of eclipse???). There it states that I am
on the right track overrighting the getSourceConnectionAnchorAt() method
of the figure. Well but this method is never called. So overrighting it
doesn't really make sence.

I'm trying to debug all this stuff, but the source code is also not
installed via the Software Update Action.

So could someone please shed some light on this?

Thank You!
Martin



Martin Tauber schrieb:
> 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 #94779 is a reply to message #94765] Sat, 20 January 2007 21:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.tauber.t-online.de

I have now debugged this. Remember I created a custom figure which
extends NodeFigure. I now wanted to create my own anchors by
overrighting getSourceConnectionAnchorAt() but this method was never called.

Now debugging the code I found out, that my custum figure is used when
the figure is painted (so I guess the mapping in .gmfgraph worked. But
when I set a breakpoint on NodeFigure.getSourceConnectionAnchorAt() it
is not called from my customFigure, but from DefaultSizeNodeFigure. So
my CustomFigure is not in the game here. But why this? It is used to
paint the figure, but not for the rest. Is this a bug?

Regards
Martin

Martin Tauber schrieb:
> Hi everybody,
>
> I'm still stuck here. I found the tutorial in the online help of eclipse
> (BTW why is the online help not installed when gmf is installed via the
> "Software Update" action of eclipse???). There it states that I am on
> the right track overrighting the getSourceConnectionAnchorAt() method of
> the figure. Well but this method is never called. So overrighting it
> doesn't really make sence.
>
> I'm trying to debug all this stuff, but the source code is also not
> installed via the Software Update Action.
>
> So could someone please shed some light on this?
>
> Thank You!
> Martin
>
>
>
> Martin Tauber schrieb:
>> 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 #95307 is a reply to message #94779] Mon, 22 January 2007 20:34 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Question regarding generated CustumLayoutData + CustomAttribute code (GMF 2.0M4)
Next Topic:What is an IMapModel?
Goto Forum:
  


Current Time: Tue Jul 23 11:32:08 GMT 2024

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

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

Back to the top