Home » Modeling » GMF (Graphical Modeling Framework) » Figure with two Anchors
Figure with two Anchors [message #161052] |
Sun, 18 November 2007 09:50  |
Eclipse User |
|
|
|
Originally posted by: martin.tauber.t-online.de
Hello Newsgroup,
I am trying to create a Figure with two Anchors (Let's say NORTH and
SOUTH). How do I do this. (Please do not refer me to any of the
examples, because they are just to complex!)
Thanks
Martin
|
|
| | |
Re: Figure with two Anchors [message #161148 is a reply to message #161084] |
Sun, 18 November 2007 20:20   |
Eclipse User |
|
|
|
Your question was in reference to figures and anchors, both of which are
GEF/draw2d concepts, and made no mention to anything GMF-specific. GMF
builds upon GEF, so there are obviously related classes/methods. I'd start
by looking at the hierarchy for org.eclipse.draw2d.ConnectionAnchor.
You'll find that your questions will get a better response if you include
specific details, as in the question about 2.0.1 installation.
- Rich
On 11/18/07 12:50 PM, in article fhpu3f$jib$1@build.eclipse.org, "Martin
Tauber" <martin.tauber@t-online.de> wrote:
> No it's not a gef question. GMF runtime uses methods like
> org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPa rt#getSourceConnec
> tion
> and
> org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure#getConnect ionAnchors.
>
> Since this is the GMF runtime I guess the invetor of the runtime had an
> idea how to integrate anchors into gmf. So still: How do I just simply
> add two anchors NORTH and SOUTH to the figure?
>
> I really think this is one of the basic concepts of gmf and I am very
> suprised how little knowledge about this concept there is in the field.
>
> Regards
> Martin
>
> P.S. Are any gmf developers reading this newsgroup?
>
> Richard Gronback wrote:
>> This is a GEF question, so I suggest you post this question to that
>> newsgroup (eclipse.tools.gef) after first searching its history. I know
>> you're not interested in the examples, but the GEF logic diagram example get
>> you close.
>>
>> - Rich
>>
>>
>> On 11/18/07 9:50 AM, in article fhpjgd$t4f$1@build.eclipse.org, "Martin
>> Tauber" <martin.tauber@t-online.de> wrote:
>>
>>> Hello Newsgroup,
>>>
>>> I am trying to create a Figure with two Anchors (Let's say NORTH and
>>> SOUTH). How do I do this. (Please do not refer me to any of the
>>> examples, because they are just to complex!)
>>>
>>> Thanks
>>> Martin
>>
|
|
| |
Re: Figure with two Anchors [message #161405 is a reply to message #161148] |
Mon, 19 November 2007 10:43   |
Eclipse User |
|
|
|
Originally posted by: martin.tauber.t-online.de
Hi Rich,
sorry if I may sound rude, but I think it is a very simple and elematary
question and I would have thought that there would be a simple answer to
it. Let me explain more specific:
I am creating a flowchart diagram. The flowchart diagram contains a
diamand figure for a Branch. Now I would be able to start connections
only at the corners of the Diamand. I understand that Connections need a
source and a target anchor and I see that the default anchor created by
GMF for the ShapeNodeEditPart is a ChopboxAnchor.
Looking at the Classes involved I found methods for the <branch>EditPart
which returns the Anchor getSourceConnectionAnchor(...) and
getTargetConnectionAnchor(...). overriding these methods work fine. But
now I want to create an anchor depending on which of the diamonds
corners is the closest.
Looking at the NodeFigure class I saw poorly documented methods that
also deal with anchor like getSourceConnectionAnchorAt(...) These look
like they could be dealing with the situation, but scanning the source
code they don't seam to be doing so.
So I have already invesigated a bit to find a solution for the question
on how to set anchors for my figure. I like the idea of having the
figure telling me what anchors it supports and not the editpart. (Since
the figure knows its shape ...)
Now my ultimate question again: What is the best practice in GMF to set
the anchors according to my requirements.
If you need more information please don't hesitate to contact me!
Regards
Martin
Richard Gronback wrote:
> Your question was in reference to figures and anchors, both of which are
> GEF/draw2d concepts, and made no mention to anything GMF-specific. GMF
> builds upon GEF, so there are obviously related classes/methods. I'd
start
> by looking at the hierarchy for org.eclipse.draw2d.ConnectionAnchor.
>
> You'll find that your questions will get a better response if you include
> specific details, as in the question about 2.0.1 installation.
>
> - Rich
>
>
> On 11/18/07 12:50 PM, in article fhpu3f$jib$1@build.eclipse.org, "Martin
> Tauber" <martin.tauber@t-online.de> wrote:
>
>> No it's not a gef question. GMF runtime uses methods like
>>
org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPa rt#getSourceConnec
>> tion and
org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure#getConnect ionAnchors.
>>
>> Since this is the GMF runtime I guess the invetor of the runtime had an
>> idea how to integrate anchors into gmf. So still: How do I just simply
>> add two anchors NORTH and SOUTH to the figure?
>>
>> I really think this is one of the basic concepts of gmf and I am very
>> suprised how little knowledge about this concept there is in the field.
>>
>> Regards
>> Martin
>>
>> P.S. Are any gmf developers reading this newsgroup?
>>
>> Richard Gronback wrote:
>>> This is a GEF question, so I suggest you post this question to that
>>> newsgroup (eclipse.tools.gef) after first searching its history. I
know
>>> you're not interested in the examples, but the GEF logic diagram
example get
>>> you close.
>>>
>>> - Rich
>>>
>>> On 11/18/07 9:50 AM, in article fhpjgd$t4f$1@build.eclipse.org, "Martin
>>> Tauber" <martin.tauber@t-online.de> wrote:
>>>
>>>> Hello Newsgroup,
>>>>
>>>> I am trying to create a Figure with two Anchors (Let's say NORTH and
>>>> SOUTH). How do I do this. (Please do not refer me to any of the
>>>> examples, because they are just to complex!)
>>>>
>>>> Thanks
>>>> Martin
>
|
|
|
Re: Figure with two Anchors [message #161664 is a reply to message #161405] |
Tue, 20 November 2007 06:45   |
Eclipse User |
|
|
|
Originally posted by: 5d5.mail.ru
Hello!
Interface org.eclipse.gef.NodeEditPart exposes contract of editpart to
support incoming and outgoing connections and it's well documented. GMF
introduces ShapeNodeEditPart and NodeFigure so editpart asks figure for
anchors but the contract of NodeEditPart remains in power. So you should
write your own custom connection anchor and subclass NodeFigure of your
editpart to return your custom anchors.
Martin Tauber wrote:
> Hi Rich,
>
> sorry if I may sound rude, but I think it is a very simple and elematary
> question and I would have thought that there would be a simple answer to
> it. Let me explain more specific:
>
> I am creating a flowchart diagram. The flowchart diagram contains a
> diamand figure for a Branch. Now I would be able to start connections
> only at the corners of the Diamand. I understand that Connections need a
> source and a target anchor and I see that the default anchor created by
> GMF for the ShapeNodeEditPart is a ChopboxAnchor.
>
> Looking at the Classes involved I found methods for the <branch>EditPart
> which returns the Anchor getSourceConnectionAnchor(...) and
> getTargetConnectionAnchor(...). overriding these methods work fine. But
> now I want to create an anchor depending on which of the diamonds
> corners is the closest.
>
> Looking at the NodeFigure class I saw poorly documented methods that
> also deal with anchor like getSourceConnectionAnchorAt(...) These look
> like they could be dealing with the situation, but scanning the source
> code they don't seam to be doing so.
>
> So I have already invesigated a bit to find a solution for the question
> on how to set anchors for my figure. I like the idea of having the
> figure telling me what anchors it supports and not the editpart. (Since
> the figure knows its shape ...)
>
> Now my ultimate question again: What is the best practice in GMF to set
> the anchors according to my requirements.
>
> If you need more information please don't hesitate to contact me!
>
> Regards
> Martin
>
>
> Richard Gronback wrote:
> > Your question was in reference to figures and anchors, both of which are
> > GEF/draw2d concepts, and made no mention to anything GMF-specific. GMF
> > builds upon GEF, so there are obviously related classes/methods. I'd
> start
> > by looking at the hierarchy for org.eclipse.draw2d.ConnectionAnchor.
> >
> > You'll find that your questions will get a better response if you
> include
> > specific details, as in the question about 2.0.1 installation.
> >
> > - Rich
> >
> >
> > On 11/18/07 12:50 PM, in article fhpu3f$jib$1@build.eclipse.org, "Martin
> > Tauber" <martin.tauber@t-online.de> wrote:
> >
> >> No it's not a gef question. GMF runtime uses methods like
> >>
> org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPa rt#getSourceConnec
>
> >> tion and
> org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure#getConnect ionAnchors.
> >>
> >> Since this is the GMF runtime I guess the invetor of the runtime had an
> >> idea how to integrate anchors into gmf. So still: How do I just simply
> >> add two anchors NORTH and SOUTH to the figure?
> >>
> >> I really think this is one of the basic concepts of gmf and I am very
> >> suprised how little knowledge about this concept there is in the field.
> >>
> >> Regards
> >> Martin
> >>
> >> P.S. Are any gmf developers reading this newsgroup?
> >>
> >> Richard Gronback wrote:
> >>> This is a GEF question, so I suggest you post this question to that
> >>> newsgroup (eclipse.tools.gef) after first searching its history. I
> know
> >>> you're not interested in the examples, but the GEF logic diagram
> example get
> >>> you close.
> >>>
> >>> - Rich
> >>>
> >>> On 11/18/07 9:50 AM, in article fhpjgd$t4f$1@build.eclipse.org,
> "Martin
> >>> Tauber" <martin.tauber@t-online.de> wrote:
> >>>
> >>>> Hello Newsgroup,
> >>>>
> >>>> I am trying to create a Figure with two Anchors (Let's say NORTH and
> >>>> SOUTH). How do I do this. (Please do not refer me to any of the
> >>>> examples, because they are just to complex!)
> >>>>
> >>>> Thanks
> >>>> Martin
> >
|
|
|
Re: Figure with two Anchors [message #161673 is a reply to message #161664] |
Tue, 20 November 2007 07:57   |
Eclipse User |
|
|
|
Hi Martin,
Sorry, but for some reason your reply below does not appear in my news
client, although Dmitry's reply does (obviously).
I used a variant of FixedConnectionAnchor to accomplish something similar to
what you're looking for, returning it from getTargetConnectionAnchor(), just
as Dmitry suggests. While I agree it should be easier to
define/restrict/select anchor points, I don't know of a way other than to
write this code yourself.
Maybe look at BorderItemConnectionAnchor as well?
- Rich
On 11/20/07 6:45 AM, in article fhuhcd$ovl$1@build.eclipse.org, "Dmitry
Stadnik" <5d5@mail.ru> wrote:
> Hello!
>
> Interface org.eclipse.gef.NodeEditPart exposes contract of editpart to
> support incoming and outgoing connections and it's well documented. GMF
> introduces ShapeNodeEditPart and NodeFigure so editpart asks figure for
> anchors but the contract of NodeEditPart remains in power. So you should
> write your own custom connection anchor and subclass NodeFigure of your
> editpart to return your custom anchors.
>
> Martin Tauber wrote:
>> Hi Rich,
>>
>> sorry if I may sound rude, but I think it is a very simple and elematary
>> question and I would have thought that there would be a simple answer to
>> it. Let me explain more specific:
>>
>> I am creating a flowchart diagram. The flowchart diagram contains a
>> diamand figure for a Branch. Now I would be able to start connections
>> only at the corners of the Diamand. I understand that Connections need a
>> source and a target anchor and I see that the default anchor created by
>> GMF for the ShapeNodeEditPart is a ChopboxAnchor.
>>
>> Looking at the Classes involved I found methods for the <branch>EditPart
>> which returns the Anchor getSourceConnectionAnchor(...) and
>> getTargetConnectionAnchor(...). overriding these methods work fine. But
>> now I want to create an anchor depending on which of the diamonds
>> corners is the closest.
>>
>> Looking at the NodeFigure class I saw poorly documented methods that
>> also deal with anchor like getSourceConnectionAnchorAt(...) These look
>> like they could be dealing with the situation, but scanning the source
>> code they don't seam to be doing so.
>>
>> So I have already invesigated a bit to find a solution for the question
>> on how to set anchors for my figure. I like the idea of having the
>> figure telling me what anchors it supports and not the editpart. (Since
>> the figure knows its shape ...)
>>
>> Now my ultimate question again: What is the best practice in GMF to set
>> the anchors according to my requirements.
>>
>> If you need more information please don't hesitate to contact me!
>>
>> Regards
>> Martin
>>
>>
>> Richard Gronback wrote:
>>> Your question was in reference to figures and anchors, both of which are
>>> GEF/draw2d concepts, and made no mention to anything GMF-specific. GMF
>>> builds upon GEF, so there are obviously related classes/methods. I'd
>> start
>>> by looking at the hierarchy for org.eclipse.draw2d.ConnectionAnchor.
>>>
>>> You'll find that your questions will get a better response if you
>> include
>>> specific details, as in the question about 2.0.1 installation.
>>>
>>> - Rich
>>>
>>>
>>> On 11/18/07 12:50 PM, in article fhpu3f$jib$1@build.eclipse.org, "Martin
>>> Tauber" <martin.tauber@t-online.de> wrote:
>>>
>>>> No it's not a gef question. GMF runtime uses methods like
>>>>
>> org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPa rt#getSourceConne
>> c
>>
>>>> tion and
>> org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure#getConnect ionAnchors.
>>>>
>>>> Since this is the GMF runtime I guess the invetor of the runtime had an
>>>> idea how to integrate anchors into gmf. So still: How do I just simply
>>>> add two anchors NORTH and SOUTH to the figure?
>>>>
>>>> I really think this is one of the basic concepts of gmf and I am very
>>>> suprised how little knowledge about this concept there is in the field.
>>>>
>>>> Regards
>>>> Martin
>>>>
>>>> P.S. Are any gmf developers reading this newsgroup?
>>>>
>>>> Richard Gronback wrote:
>>>>> This is a GEF question, so I suggest you post this question to that
>>>>> newsgroup (eclipse.tools.gef) after first searching its history. I
>> know
>>>>> you're not interested in the examples, but the GEF logic diagram
>> example get
>>>>> you close.
>>>>>
>>>>> - Rich
>>>>>
>>>>> On 11/18/07 9:50 AM, in article fhpjgd$t4f$1@build.eclipse.org,
>> "Martin
>>>>> Tauber" <martin.tauber@t-online.de> wrote:
>>>>>
>>>>>> Hello Newsgroup,
>>>>>>
>>>>>> I am trying to create a Figure with two Anchors (Let's say NORTH and
>>>>>> SOUTH). How do I do this. (Please do not refer me to any of the
>>>>>> examples, because they are just to complex!)
>>>>>>
>>>>>> Thanks
>>>>>> Martin
>>>
|
|
| |
Goto Forum:
Current Time: Fri Sep 19 04:23:48 EDT 2025
Powered by FUDForum. Page generated in 0.04963 seconds
|