Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to stop Connection from moving when Nodes are moved?
How to stop Connection from moving when Nodes are moved? [message #148808] Mon, 03 September 2007 16:42 Go to next message
Eclipse UserFriend
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 #149449 is a reply to message #148808] Fri, 07 September 2007 00:13 Go to previous messageGo to next message
Eclipse UserFriend
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
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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:How to programmatically arrange diagram after expanding container editpart?
Next Topic:Making editor background fixed size with background image
Goto Forum:
  


Current Time: Fri Apr 25 19:01:14 EDT 2025

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

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

Back to the top