Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Connections with Horizontal start and end & Moving Bendpoints
icon5.gif  Connections with Horizontal start and end & Moving Bendpoints [message #756165] Fri, 11 November 2011 10:56 Go to next message
Matteo Miraz is currently offline Matteo Miraz
Messages: 38
Registered: March 2011
Member
Hi,

I'm building a graph editor, and I have the requirement that all edges start and ends horizontally:

index.php/fa/6099/0/

I chose to implement it by using a FreeFormConnection, which has two bendpoints located in the correct position... is this a good way? I cannot use Manhattan because (1) we want diagonal connections and (2) we cannot force the connection to start horizontally.

Additionally I want that the user cannot move those bendpoints... how can I do that? I tryied to provide a custom MoveBendpointFeature (subclassing DefaultMoveBendpointFeature) and disable the ability to move the first and the last bendpoint. However, even if my method canMoveBendpoint returns false, the diagram editor lets the user move the bendpoint. Is this a bug or am I missing something?

Thanks,
Matteo

  • Attachment: demo.png
    (Size: 12.25KB, Downloaded 270 times)
Re: Connections with Horizontal start and end & Moving Bendpoints [message #756186 is a reply to message #756165] Fri, 11 November 2011 12:23 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1618
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Matteo,

I was able to implement this in the tutorial (quick and dirty):
public boolean canMoveBendpoint(IMoveBendpointContext context) {
EList<Point> bendpoints = context.getConnection().getBendpoints();
int bendpointIndex = context.getBendpointIndex();
if (bendpointIndex == 0 || bendpointIndex == bendpoints.size() - 1) {
System.out.println("Not movable");
return false;
}
return super.canMoveBendpoint(context);
}

Maybe you mistake the drag points to add additional bendpoints (little
smaller) with the actual bendpoints (little larger)?

HTH,
Michael
Re: Connections with Horizontal start and end &amp; Moving Bendpoints [message #756200 is a reply to message #756186] Fri, 11 November 2011 13:11 Go to previous message
Matteo Miraz is currently offline Matteo Miraz
Messages: 38
Registered: March 2011
Member
Hi,

the code you posted is really close to the one I wrote Smile

I confirm that it is working correctly, as the bendpoint is not moved. However, I would like to prevent the user to move the bend point. Let me explain better. With your (and mine) implementation, the user can select and move the first (last) bendpoint. While the left button of the mouse is pressed, the user thinks that he can move the bend point (this is what confused me). However, as soon as the left button is released, the bendpoint returns to the original position.

Conversely, I'd expect that the user was forbidden to move the bendpoint (and not just restoring the correct position of the bendpoint afterwards)... is it possible to do that?

Thanks,
Matteo


ps. Since you mentioned the smaller points, usable to add new bendpoints, let me add that I also disabled the ability of the user to add a bendpoint in the first and last position. The code is like the one you posted, except that (1) it extends DefaultAddBendpointFeature, and (2) it compares bendpointIndex with bendpoints.size() (without -1).

Previous Topic:Anchors
Next Topic:Call Direct Edit feature
Goto Forum:
  


Current Time: Fri Oct 24 15:26:44 GMT 2014

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

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