int len = 0;
float sizes = 0;
float r = 0;
float g = 0;
float b = 0;
Node group = graph.groupNodes(nodes);
group.getNodeData().setLabel(NbBundle.getMessage(GraphElementsControllerImpl.class, "Group.nodeCount.label", nodes.length));
group.getNodeData().setSize(10f);
for (Node child : nodes) {
centroidX += child.getNodeData().x();
centroidY += child.getNodeData().y();
len++;
sizes += child.getNodeData().getSize() / 10f;
r += child.getNodeData().r();
g += child.getNodeData().g();
b += child.getNodeData().b();
}
centroidX /= len;
centroidY /= len;
group.getNodeData().setSize(sizes);
group.getNodeData().setColor(r / len, g / len, b / len);
group.getNodeData().setX(centroidX);
group.getNodeData().setY(centroidY);
} catch (Exception e) {
graph.readUnlockAll();
NotifyDescriptor.Message nd = new NotifyDescriptor.Message(e.getMessage());
DialogDisplayer.getDefault().notifyLater(nd);
return false;