void (final RadContainer grid, final int cellIndex, final boolean isRow, final boolean isBefore) { check(grid, isRow, cellIndex); final RadAbstractGridLayoutManager oldLayout = grid.getGridLayoutManager(); int beforeIndex = cellIndex; if (!isBefore) { // beforeIndex can actually be equal to get{Row|Column}Count an case we add row after the last row/column beforeIndex++; } final LayoutManager newLayout = oldLayout.copyLayout(grid.getLayout(), isRow ? 1 : 0, isRow ? 0 : 1); GridConstraints[] oldConstraints = copyConstraints(grid); for (int i=grid.getComponentCount() - 1; i >= 0; i--){ final GridConstraints constraints = grid.getComponent(i).getConstraints(); adjustConstraintsOnInsert(constraints, isRow, beforeIndex, 1); } grid.setLayout(newLayout); fireAllConstraintsChanged(grid, oldConstraints); }