public Object[] alignCells(String align,Object[] cells,Object param){
  if (cells == null) {
    cells=getSelectionCells();
  }
  if (cells != null && cells.length > 1) {
    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());
            }
          }
        }
      }
    }
    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()) {
            resetEdges(new Object[]{cells[i]});
          }
        }
      }
      fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"cells",cells,"align",align));
    }
  finally {
      model.endUpdate();
    }
  }
  return cells;
}

public Object [ ] alignCells ( String align , Object [ ] cells , Object param ) { if ( cells == null ) { cells = getSelectionCells ( ) ; } if ( cells != null && cells . length > 1 ) { 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 ( ) ) ; } } } } } 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 ( ) ) { resetEdges ( new Object [ ] { cells [ i ] } ) ; } } } fireEvent ( new mxEventObject ( mxEvent . ALIGN_CELLS , "cells" , cells , "align" , align ) ) ; } finally { model . endUpdate ( ) ; } } return cells ; }
aligns the given cells vertically or horizontally according to the given alignment using the optional parameter as the coordinate .
