model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
mxGeometry geo = getCellGeometry(cells[i]);
if (geo != null)
{
Object[] children = getChildCells(cells[i]);
if (children != null && children.length > 0)
{
mxRectangle childBounds = getBoundingBoxFromGeometry(children);
if (childBounds.getWidth() > 0
&& childBounds.getHeight() > 0)
{
mxRectangle size = (isSwimlane(cells[i])) ? getStartSize(cells[i])
: new mxRectangle();
geo = (mxGeometry) geo.clone();
if (moveParent)
{
geo.setX(geo.getX() + childBounds.getX()
- size.getWidth() - border);
geo.setY(geo.getY() + childBounds.getY()
- size.getHeight() - border);
}
geo.setWidth(childBounds.getWidth()
+ size.getWidth() + 2 * border);
geo.setHeight(childBounds.getHeight()
+ size.getHeight() + 2 * border);
model.setGeometry(cells[i], geo);
moveCells(children,
-childBounds.getX() + size.getWidth()