// Finds the required coordinate for the alignment
if (param == null)
{
for (int i = 0; i < cells.length; i++)
{
mxGeometry geo = getCellGeometry(cells[i]);
if (geo != null && !model.isEdge(cells[i]))
{
if (param == null)
{
if (align == null
|| align.equals(mxConstants.ALIGN_LEFT))
{
param = geo.getX();
}
else if (align.equals(mxConstants.ALIGN_CENTER))
{
param = geo.getX() + geo.getWidth() / 2;
break;
}
else if (align.equals(mxConstants.ALIGN_RIGHT))
{
param = geo.getX() + geo.getWidth();
}
else if (align.equals(mxConstants.ALIGN_TOP))
{
param = geo.getY();
}
else if (align.equals(mxConstants.ALIGN_MIDDLE))
{
param = geo.getY() + geo.getHeight() / 2;
break;
}
else if (align.equals(mxConstants.ALIGN_BOTTOM))
{
param = geo.getY() + geo.getHeight();
}
}
else
{
double tmp = Double.parseDouble(String
.valueOf(param));
if (align == null
|| align.equals(mxConstants.ALIGN_LEFT))
{
param = Math.min(tmp, geo.getX());
}
else if (align.equals(mxConstants.ALIGN_RIGHT))
{
param = Math.max(tmp,
geo.getX() + geo.getWidth());
}
else if (align.equals(mxConstants.ALIGN_TOP))
{
param = Math.min(tmp, geo.getY());
}
else if (align.equals(mxConstants.ALIGN_BOTTOM))
{
param = Math.max(tmp,
geo.getY() + geo.getHeight());
}
}
}
}
}
// Aligns the cells to the coordinate
model.beginUpdate();
try
{
double tmp = Double.parseDouble(String.valueOf(param));
for (int i = 0; i < cells.length; i++)
{
mxGeometry geo = getCellGeometry(cells[i]);
if (geo != null && !model.isEdge(cells[i]))
{
geo = (mxGeometry) geo.clone();
if (align == null
|| align.equals(mxConstants.ALIGN_LEFT))
{
geo.setX(tmp);
}
else if (align.equals(mxConstants.ALIGN_CENTER))
{
geo.setX(tmp - geo.getWidth() / 2);
}
else if (align.equals(mxConstants.ALIGN_RIGHT))
{
geo.setX(tmp - geo.getWidth());
}
else if (align.equals(mxConstants.ALIGN_TOP))
{
geo.setY(tmp);
}
else if (align.equals(mxConstants.ALIGN_MIDDLE))
{
geo.setY(tmp - geo.getHeight() / 2);
}
else if (align.equals(mxConstants.ALIGN_BOTTOM))
{
geo.setY(tmp - geo.getHeight());
}
model.setGeometry(cells[i], geo);
if (isResetEdgesOnMove())