private static void delete( List<RadComponent> deletedComponents, GridInfo gridInfo, RadComponent[][] components, RadCaptionGridRow row) throws Exception { if (row.myIndex > 0) { GridLayoutOperation.shiftRowSpan(gridInfo, row.myIndex - 1, -1); } for (RadComponent component : components[row.myIndex]) { if (component != null) { Rectangle cellIndex = RadGridLayoutComponent.getCellInfo(component); GridInfo.setNull( components, gridInfo.components, cellIndex.y, cellIndex.y + cellIndex.height, cellIndex.x, cellIndex.x + cellIndex.width); component.delete(); deletedComponents.add(component); } } }
@Override public void delete(List<RadComponent> rows) throws Exception { List<RadComponent> deletedComponents = new ArrayList<RadComponent>(); GridInfo gridInfo = myContainer.getVirtualGridInfo(); RadComponent[][] components = myContainer.getGridComponents(false); for (RadComponent row : rows) { delete(deletedComponents, gridInfo, components, (RadCaptionGridRow) row); } RadComponent[][] newComponents = new RadComponent[components.length - rows.size()][]; for (int i = 0, index = 0; i < components.length; i++) { boolean add = true; for (RadComponent row : rows) { if (i == ((RadCaptionGridRow) row).myIndex) { add = false; break; } } if (add) { newComponents[index++] = components[i]; } } GridLayoutOperation.validateLayoutParams(newComponents); deselect(deletedComponents); }