How to stop Connection from moving when Nodes are moved? [message #148808] |
Mon, 03 September 2007 16:42  |
Eclipse User |
|
|
|
Originally posted by: mail.micke.gmail.com
Hi,
in an application that I might implement the connections are key, and
especially how they are positioned by the user.
Currently when moving the nodes the connections move with them
(debugging the code it seems their coordinates are relative to the
source and target nodes). Can I prevent this behaviour?
Is this related to Edit policies? (atm I'm struggling to grasp how they
are involved in gef/gmf).
Also wonder how I can remove the Router choices from the Properties
view, thought I'd sneak this question in here.
Many thanks,
Mike
|
|
|
|
Re: How to stop Connection from moving when Nodes are moved? [message #149486 is a reply to message #149449] |
Sat, 08 September 2007 18:04  |
Eclipse User |
|
|
|
Originally posted by: mail.micke.gmail.com
Hi
Finally got some time sit down with this and tried it and managed to
modify the behaviour at the node connection point, which isn't really
what I wanted to do.
What I really wanted was that the points on the polyline remain fixed
when moving the node. The anchor point on the nodes should move, just
not the points making up the polyline.
Do you know if this is possible accomplish?
Cheers,
Mike
Arpit wrote:
> Hi Mike,
>
> I guess you should try the concept of fixedconnectionAnchor. Try to
> extend the class AbstractConnectionAnchor nad override the mehods
> getLocation() and the getOwner() method to suit to your needs.
>
> then go to the editpart you wish the connection to stick to and just
> write the following code -
>
> public ConnectionAnchor
> getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
> if (fixedAnchor == null) {
> fixedAnchor = new FixedConnectionAnchor(getNodeFigure());
> getNodeFigure().addAncestorListener(fixedAnchor);
> }
> return fixedAnchor;
> }
> public ConnectionAnchor getTargetConnectionAnchor(Request request) {
> if (fixedAnchor == null) {
> fixedAnchor = new FixedConnectionAnchor(getNodeFigure());
> getNodeFigure().addAncestorListener(fixedAnchor);
> }
> return fixedAnchor;
> }
>
> GO and search for fixed connectionanchor in the LogicExample provided by
> GMF.
>
> You may put forward any doubt regarding the same.
>
> cheers!
> -Arpit
>
|
|
|
Powered by
FUDForum. Page generated in 0.07123 seconds