int (final RadContainer grid, final int cellIndex, final boolean isRow) { int result = 1; FormLayout formLayout = (FormLayout) grid.getLayout(); adjustDeletedCellOrigins(grid, cellIndex, isRow); if (isRow) { int[][] groupIndices = formLayout.getRowGroups(); groupIndices = removeDeletedCell(groupIndices, cellIndex+1); formLayout.setRowGroups(groupIndices); formLayout.removeRow(cellIndex+1); updateGridConstraintsFromCellConstraints(grid); if (formLayout.getRowCount() > 0 && formLayout.getRowCount() % 2 == 0) { int gapRowIndex = (cellIndex >= grid.getGridRowCount()) ? cellIndex-1 : cellIndex; if (GridChangeUtil.isRowEmpty(grid, gapRowIndex)) { formLayout.removeRow(gapRowIndex+1); updateGridConstraintsFromCellConstraints(grid); result++; } } } else { int[][] groupIndices = formLayout.getColumnGroups(); groupIndices = removeDeletedCell(groupIndices, cellIndex+1); formLayout.setColumnGroups(groupIndices); formLayout.removeColumn(cellIndex+1); updateGridConstraintsFromCellConstraints(grid); if (formLayout.getColumnCount() > 0 && formLayout.getColumnCount() % 2 == 0) { int gapColumnIndex = (cellIndex >= grid.getGridColumnCount()) ? cellIndex-1 : cellIndex; if (GridChangeUtil.isColumnEmpty(grid, gapColumnIndex)) { formLayout.removeColumn(gapColumnIndex+1); updateGridConstraintsFromCellConstraints(grid); result++; } } } return result; }