int connectionEndPt = 0;
GraphModel model = GraphModel.forElement(getElement());
for ( Enumeration els = model.getGraph().elements(); els.hasMoreElements();) {
GraphElement ge = (GraphElement) els.nextElement();
if(ge instanceof FB){
FB fb = (FB)ge;
if(fb.getMainLabel().getText().equals(sourceFBName))
connectionStartPt = fb.getPreferredBounds().x;
else if(fb.getMainLabel().getText().equals(destinationFBName))
connectionEndPt = fb.getPreferredBounds().x;
}
}
float dx1 = connectionStartPt + (Math.abs(connectionEndPt - connectionStartPt)/2) / scaleFactor;
newConnectionElement.setAttribute("dx1", ""+dx1);