private int insertGridCells(RadContainer grid, int cellIndex, boolean isRow, boolean isBefore, FormSpec formSpec) {
    FormLayout formLayout = (FormLayout) grid.getLayout();
    int index = isBefore ? cellIndex+1 : cellIndex+2;
    if (isRow) {
      if (getGridCellCount(grid, true) > 0) {
        insertOrAppendRow(formLayout, index, FormFactory.RELATED_GAP_ROWSPEC);
        if (!isBefore) index++;
      }
      insertOrAppendRow(formLayout, index, (RowSpec) formSpec);
    }
    else {
      if (getGridCellCount(grid, false) > 0) {
        insertOrAppendColumn(formLayout, index, FormFactory.RELATED_GAP_COLSPEC);
        if (!isBefore) index++;
      }
      insertOrAppendColumn(formLayout, index, (ColumnSpec)formSpec);
    }
    updateGridConstraintsFromCellConstraints(grid);
    return index-1;
  }
private int insertGridCells(RadContainer grid, int cellIndex, boolean isRow, boolean isBefore, FormSpec formSpec)