Skip to main content


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 MirazFriend
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 572 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 WenzFriend
Messages: 1931
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 MirazFriend
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: Tue Apr 16 04:11:57 GMT 2024

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

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

Back to the top