Link selection + move

If we select only links and try to move them on the canvas , then the associated nodes should be also moved. Does JGo API implement this by default?. Which event do I need to override to get this done - onMouseDown or onMouseMove … I did try doing this but did not work for me. I am iterating through the selection of links, then get the “toPort.parent” and “fromPort.parent” nodes and then calling the selectObject …
Any ideas on this would be really helpful
Thanx in advance

No, that’s not the normal behavior.
First, JGoLinks are not Draggable, by default.
Second, you’ll need to override JGoView.computeEffectiveSelection so that you’ll include the nodes that are connected to selected links. That’s where you should be putting that code for looking at the ports and their parent nodes.

I did try putting my code for selecting nodes in the JGoView.computeEffectiveSelection method. I tried to invoke this method in the MouseUp/Down events when the MouseState=MouseStateMove
But since the JGoLinks are not draggable by default this method is not getting called at all …

No, you shouldn’t need to override doMouseDown/Move/Up.
And that’s why you should call setDraggable(true).

I wrote this method in the class that extends JGoView
I need to select the associated nodes only
When a user selects only links
and then move the selection using a mouse or arrowkeys
public ArrayList computeEffectiveSelection(JGoSelection selection)
{
ArrayList nodesList = (ArrayList)getSelectedNodes();
JGoSelection sel = this.getSelection();
JGoListPosition pos = sel.getFirstObjectPos();
ArrayList dragElementsList = new ArrayList();
if(nodesList.size()<=0){
while(pos!=null)
{
JGoObject obj = getSelection().getObjectAtPos(pos);
BPLink link = (BPLink) obj;
BPNode fromNode = (BPNode) link.getFromPort().getParent();
BPNode toNode = (BPNode) link.getToPort().getParent();
//sel.extendSelection(fromNode);
//sel.extendSelection( toNode);
link.setDraggable(true);
dragElementsList.add(link);
dragElementsList.add(fromNode);
dragElementsList.add(toNode);
pos = sel.getNextObjectPos(pos);
}
}
return dragElementsList;
}
It isn’t working

I think you have to make the links draggable to begin with.
I’m not sure why you are calling getSelectedNodes, which I assume is a method you wrote. I would think you would have to iterate through the JGoSelection in any case.