I want Link reshape as in Microsoft Visio


#1

Hi
I saw Microsoft Visio tool,in which they are providing facility for the user to reshape the Link(BPLink).EX:

By using that green point, I can grab and able to reshape.
Are there any method(s) in JGo,which gives the same effect for Link reshape?
Thanks in advance,
Radhika


#2

The way to implement that is to override the gainedSelection and handleResize methods.
The default behavior of JGoLink.gainedSelection is to add JGoHandles at each Point of the stroke (JGoLink inherits from JGoStroke). You could add additional handles at the mid-points of each segment, and then call the super method. Each new handle would need a distinct handle ID (JGoHandle.handleType) so that the handleResize method can decide what to do.
The override of handleResize would check the “whichHandle” parameter, and if it’s one of your new mid-segment handles, you would insert a Point into the stroke there and call the super method. After the super call I guess you would need to see if the new point is in line with the real points before and after, so you can decide to remove that point, if the “event” parameter is JGoView.EventMouseUp.