Connection with Selectable End Points [message #92116] |
Tue, 02 September 2003 15:33  |
Eclipse User |
|
|
|
Originally posted by: brianv.phreaker.net
I need a connection with selectable endpoints - ie. endpoints which can be
selected seperately from the connection. (So I can select either the
connection or the source point or the target point individually)
Since I also need to set properties for the endpoints, I suppose I have to
use separate EditParts for each endpoint, as well as the usual EditPart for
the connection. I would then connect the connection to these endpoint
EditParts.
In my connections Model constructor, I've added 2 endpoint models as
children of the connection model. I've installed a CONTAINER_ROLE for my
connection's EditPart and overriden getModelChildren() to return the 2
endpoint models.
For the figures of the endpoints , I will use PolygonDecorations.
I'm unsure of what to do in refreshVisuals for the endpoints EditParts.
I should probably be using an ArrowLocator as a constraint, but am not too
sure of how exactly to code this.
Will this work ?
((GraphicalEditPart) getParent()).setLayoutConstraint(
this,
getFigure(),
new ArrowLocator(getParent(), ConnectionLocator.TARGET);
Another requirement is; when I drag the endpoint editparts, the connection
should re-rout... exactly what happens during re-anchoring the source or
target endpoints of a normal connection. In other words, I should see the
feedback of the connection re-routing itself while moving the edit part to
which it is connected to...
How to I implement this ?
I also need to attach a connection to an existing connection... earlier on
the newsgroup it was stated that a specific anchor was to be created for
this purpose... which Anchor do I use for this ?
Any suggestions appreciated,
Brian.
p.s. I am aware that a normal connection can have decorations, but it is
imperative that the endpoints of my connections are individually selectable.
|
|
|
|
|
Re: Connection with Selectable End Points [message #92404 is a reply to message #92389] |
Thu, 04 September 2003 10:14   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> For all those who are interested, I think I've solved this... ;)
> I overrode getDragTracker in the dummy endPoints edit parts to return a a
> special dragtracker.
>
> This tracker was derived from ConnectionEndpointTracker and and it's
command
> was set to RequestConstants.REQ_RECONNECT_TARGET
>
> In this tracker, I had to override handleButtonDown similar to how it was
> written in SelectEditPartTracker...
Nice! So, you send all requests to the conneciton editpart, and not the
endpoint, right? Or, at least the feedback goes to the connection, i'm
assuming.
> Now I can select the endpoint, drag it , and the connection re-routs while
> dragging the endpoint.
>
> Contrary to my previous post, I do not need to install a PRIMARY_DRAG_ROLE
> for these endpoints.
>
> Ole !
>
> Thanks,
> Brian.
>
>
>
|
|
|
Re: Connection with Selectable End Points [message #92433 is a reply to message #92404] |
Thu, 04 September 2003 10:50  |
Eclipse User |
|
|
|
Originally posted by: brian.fernandes.codito.com
> Nice! So, you send all requests to the conneciton editpart, and not the
> endpoint, right? Or, at least the feedback goes to the connection, i'm
> assuming.
>
Yup, I guess this is what's happening... I traced thru the code in
ConnectionEndPointEditPolicy and realized that this is what I need...
So in the fake end Point editParts, in the overridden getDragTracker... I
return a tracker similar to this ...
ConnectionEndpointTracker((ConnectionEditPart) this.getParent());
since this.getParent() is the Connection EditPart, I think the request are
going to the connection... and because the fake endpoints are children of
the connection, they move when the connection moves.... all seems very
logical (after having done it of course...) lol.
Another problem I faced with the tracker was , even though the connection
was re-routing and anchoring during the drag, finally when you release the
mouse it wasn't sticking to it's new position. I traced this to some code in
the overridden handleButtonDown(int button) ...
stateTransition(STATE_INITIAL, STATE_DRAG);
I had to comment this out.. and then it all fell into place ... hurrah !
|
|
|
Powered by
FUDForum. Page generated in 0.02863 seconds