JGoDemo - MakeSubGraph action

link label gets out of collapsed bounds

1) entering long label:
2) selecting
3) menu->edit->Make Subgraph action
4) collapsing
Link label is visible and out of collapsed bounds

I’m not able to reproduce this problem. I used the following code:

JGoSubGraph sg = new JGoSubGraph("subgraph");
JGoBasicNode n1 = new JGoBasicNode("aaa");
n1.setLocation(100, 100);
JGoBasicNode n2 = new JGoBasicNode("bbb");
n2.setLocation(300, 300);
JGoLabeledLink l1 = new JGoLabeledLink(n1.getPort(), n2.getPort());
JGoText mid = new JGoText("this is a very very long label that doesn't work well");
l1.setMidLabel(mid);
sg.addObjectAtTail(n1);
sg.addObjectAtTail(n2);
sg.addObjectAtTail(l1);
jGoView1.getDocument().add(sg);
Does this code work for you?

jGoView1.getDocument().add(sg); <-jGoView1.getDocument().addObjectAtTail(sg) ?
your code works, but users wish to make subgraphs interactively, with content of JGoSelection.
To reproduce the problem above try this code:
[code]
JGoBasicNode n1 = new JGoBasicNode("aaa");
n1.setLocation(100, 100);
JGoBasicNode n2 = new JGoBasicNode("bbb");
n2.setLocation(300, 300);
JGoLabeledLink l1 = new JGoLabeledLink(n1.getPort(), n2.getPort());
JGoText mid = new JGoText("this is a very very long label that doesn't work well");
l1.setMidLabel(mid);
myView.getDocument().addObjectAtTail(n1);
myView.getDocument().addObjectAtTail(n2);
myView.getDocument().addObjectAtTail(l1);
[/code]
select objects...
then call subgraphAction
[code]
void subgraphAction() {
startTransaction();
JGoSelection selection = myView.getSelection();
JGoObject primary = selection.getPrimarySelection();
JGoSubGraph sg = new JGoSubGraph();
sg.initialize("subgraph!");
// now add the area to the document
primary.getLayer().addObjectAtTail(sg);
// add the selected objects to the area
sg.addCollection(selection, true, myMainLayer);
// update the selection too, for the user's convenience
selection.selectObject(sg);
endTransaction(SubgraphAction.toString());
}
[/code]
collapse subgraph.

That works for me too.

I think what you may be doing is using rubber-band selection to select the objects, but because the label is very long, it is not entirely within the selection rectangle and therefore doesn't become part of the selection. Then, when you turn the selection into a subgraph, the mid label isn't part of the subgraph, yet the position of the label is changed when the subgraph is collapsed so that it overlays the collapsed subgraph as shown in your image.